Partitioned display window, all looking at origin from different angle

I’m trying to partition a display window into four parts, that show a different side of an object, front, side, top… ( like 3d studio max ), anyway I cannot figure out how to have 4 cameras in one window, but in different regions, all looking at the origin, but from different angles

if this was the window:

-------------------- one would be top view, one would be side, one would be
| | | front…
| | |

| | |
| | |

any help would be greatly appreciated

Supposing, you have a Draw() function, doing all your drawing. With glViewPort you define the region, where openGL should draw:

int x, y; // Screen width and height.

// Set projection:
glOrtho or gluPerspective or glFrustum()…
glViewPort(0, 0, x/2, y/2);
Draw();

glOrtho or gluPerspective or glFrustum()…
glViewPort(0, y/2, x/2, y/2);
Draw();

glOrtho or gluPerspective or glFrustum()…
glViewPort(x/2, 0, x/2, y/2);
Draw();

glOrtho or gluPerspective or glFrustum()…
glViewPort(x/2, y/2, x/2, y/2);
Draw();

Actually, your best solution is probably to actually partition the window itself (not the drawing area) into the panes that you want. Then, create four drawing areas. That way, most expose events will only hit one or two of the drawing areas, not all of them. Then, the problem is easy.

Chris

Chennes,

as I remember, you can specify which part of the screen is redrawn. Sure, in your solution it works automatically. But you have to switch the render contexts, which would be an extra effort.

Kilam.

Two things:
-You can render to diferent windows (diferent HDCs) using a single context. It’s in the specs, I didn’t invent this.
-Multiple rendering contexts and sharing display lists and textures is a something I have nt been able to put to work in some cards.

I choose one big window using various glViewport calls, or various windows with a single rendering context. It has worked very well for me, in multiple video cards, consumer and pro.

How do you use the same rendering context in various windows? In my code, I think I’ve ended up with four different rendering contexts, but if I can avoid the overhead of switching contexts that’d be great. Primarily I use a partitioned window because it allows easy automatic resizing of the partitions, so I need to keep it that way.

Chris

simply use wglMakeCurrent( MyGlobalRenderContext, MyWindow1) to render in window1, and so on. When you create the rendering context, use the hdc of any of the windows. The wglMakeCurrent documentation says:
"It need not be the same hdc that was passed to wglCreateContext when hglrc was created, but it must be on the same device and have the same pixel format. "

That’s it.

How much overhead does this actually avoid. I have to call glXMakeCurrent to switch contexts anyway - how is it faster to use it with the same context and a different drawable?

Chris

[This message has been edited by chennes (edited 01-27-2001).]