Multiple viewports?

I want my application to display multi viewports simultaneously in one window side by side. The literature I have read suggests that I call the viewport command twice, but to change the section of the window to render. This doesn’t work. The second viewport command overrides the first. Can someone help me with this? I am calling the viewport commands at the wrong time? Is there something else that has to happen? Thanks!

try calling the first viewport, then rendering what you want in the viewport, then call glFlush or glFinish, i’m not sure which so try both, then call viewport a second time and repeat
That should work,but I havn’t had a chance to test it

What i have been doing when using multiple viewports is to just draw as meny veiw ports as i need to get the job done.

within my game loop i have make a veiwport draw the geometry that is needed for that view port. make a second veiwport draw geometry. once this is done it will loop and go to a nex increment.

I have been doing this for a while an have had no slowdown in performance or memory problems. so i think that once u call a view port the old one is lost and all information about it is lost. the only lag in this is that u have to keep re making the viewports. But u get the job done.

Perhaps there are bettwer ways any sugestions ppl.

AFAIK you must follow that steps :

makecurrent(viewport1)
renderstuffforviewport1();
glFlush();
SwapBuffer(viewport1);

makecurrent(viewport2);
renderstuffforviewport2();
glFlush();
swapbuffers(viewport2);

remember that OGl doesn’t care about the viewport… it draws and nothing more… where it draws depends on the wieport (or bettere context) u enabled last.

and remember that U will see stuff on screen only after swapping front and back buffers.

another way could be (maybe u get better visuals)

makecurrentviewport1();
renderviewport1();
glFlush();

makecurrentviewport2();
renderviewport2();
glFlush();

swapbuffers(vp1);
swapbuffers(vp2);

hope it helps…

rIO.sK

not necessary most apps that use multiple viewports eg 3d modelling programs do this.

glViewport(…)
set up camera
render scene

glViewport(…)
set up camera
render scene

swap buffers // only called once a frame ie NOT for each viewport