[HOpenGL] Size and position of subwindows

Sven Panne Sven.Panne at informatik.uni-muenchen.de
Thu Nov 13 18:19:03 EST 2003


Patrick Scheibe wrote:

 > [...]In the past one defined a subwindow in the following way:
 >
 > uniW<- createSubWindow mainW (WindowPosition space space)
 >	       (WindowSize 600 400)
 >
 > Now the parameters are away.

Huh? The parameters are still there, only the types have been renamed
a bit (because they are now not only used for windows):

    uniW <- createSubWindow mainW (Position space space) (Size 600 400)

 > [...] And how does the reshaping of subwindows work? If you resize
 > your mainwindow, the mainreshape is called with the new size. When
 > and with what size is the subwindow reshapecallback-func called by
 > OpenGL? Or am I forced to call it by myself in the mainreshape?

First a small nitpicking comment: OpenGL never does any window handling,
It is always the windowing toolkit used, which is GLUT in our case. You
can use OpenGL with GTK+, wxWindows, etc., too.

 From the documentation of reshapeCallback:

    When a top-level window is reshaped, subwindows are not reshaped.
    It is up to the GLUT program to manage the size and positions of
    subwindows within a top-level window. Still, reshape callbacks will
    be triggered for subwindows when their size is changed using
    Graphics.UI.GLUT.Window.windowSize.

This is not a deficiency of HOpenGL, but it is the way how GLUT works.
So you have to reposition and resize the subwindows manually in the
reshape callback of the toplevel window, like:

    currentWindow $= uniW
    windowPosition $= Position 12 34
    windowSize $= Size 56 78

You could have a look at Nate Robin's OpenGL tutorials, which use
subwindows:

    http://www.xmission.com/~nate/tutors.html

Cheers,
    S.




More information about the HOpenGL mailing list