GUI - Seperate/Split window

I’m trying to have a GUI with an opengl window as part of it.
I was wondering if there was a way to split the screen into 2 views of different scenes.
eg…

±---------------------------+
|
|
|
| OPEN GL SCENE
|
|
|
±---------------------------+
| GUI BUTTONS + TEXT
±---------------------------+

so that when the user rotates the scene moves but
the GUI stays static.

If anyone could help me that would be great
If possible I don’t want to have to use a Windows
based dialog box.

Thanks

[This message has been edited by miguel (edited 11-29-2000).]

Look into the following site. You can find lot of interesting examples
http://codeguru.earthweb.com/opengl/index.shtml

If you’re using MFC, the CSplitterWnd object will accomplish this for you - I’m using it for the same purpose in a project I’m working on right now.

In your CMainFrame::OnCreateClient() method, call the CreateStatic() method of your CSplitterWnd, and then call CreateView() to create the views you need. You’ll want to have a separate view class for each view to accomplish the functionality for each.

You could split your rendering context into two viewports.
E.g.:
glViewport(0,0,x,y-20);
// Do 3D rendering
glViewport(0,y-20,x,20);
// Do the gui rendering

Or you make a panel. That means you render your 3D scene and then switch to glOrtho() view with viewpoint located on the z-axis. Then you can render like 2D on the x-y plane. The pro here is, that you can move this panel over your 3D scene (swich of back buffer before rendering the panel).

I’ve tried this, Kilam, but it seems that the bottom left of my screen is clipping everything too soon, and the whole screen is translated down (-y ), proportionally to how big the window is (around 40 pixels in fullscreen)

any ideas?

i call glOrtho w/ -1,1 for all 3 axes, and then glViewport w/ the window size… should work, and accomplish what ya said, right?

hrmmm.

This is e.g. what I use to draw a zoom window rectangle. It’s the same as the panel suggestion before:

if (mouseMoveMode == MOUSE_ZOOM_WINDOW)
{
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho (-drawSizeX/2.0, drawSizeX/2.0, -drawSizeY/2.0, drawSizeY/2.0, -500, 500);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-100.0f);

ChooseForeColor();
glBegin(GL_LINE_STRIP);
glVertex3f(wz1.x()-drawSizeX/2.0,wz1.y()+drawSizeY/2.0,0.0);
glVertex3f(wz2.x()-drawSizeX/2.0,wz1.y()+drawSizeY/2.0,0.0);
glVertex3f(wz2.x()-drawSizeX/2.0,wz2.y()+drawSizeY/2.0,0.0);
glVertex3f(wz1.x()-drawSizeX/2.0,wz2.y()+drawSizeY/2.0,0.0);
glVertex3f(wz1.x()-drawSizeX/2.0,wz1.y()+drawSizeY/2.0,0.0);
glEnd();
glEnable(GL_DEPTH_TEST);
}

wz1 and wz2 are corner points of the rectangle in screen coordinates.

You can use this without the glViewport, to draw on top of your already drawn 3D things. But you can of course use the glViewport too to divide the screen.

Kilam.

[This message has been edited by Kilam Malik (edited 12-04-2000).]