Size and position of subwindows

Hi there. I'm modifying an old API-Style program and want to compile it with the new OpenGL-Haskell-API. 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. You define a normal window by setting the statevars and create one. initialWindowSize $= Size 100 100 initialWindowPosition $= Position 100 100 createWindow progName Whats about subwindows? What have to be done if you want to create a subwindow at position 50,50 relatively to mainwindow with a specific size? 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? Greetings Patrick

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.
participants (2)
-
Patrick Scheibe
-
Sven Panne