Multple ViewPorts

Started by
3 comments, last by BladeWise 18 years, 10 months ago
I have wnat to create multiple view ports. I am doing this by using gluViewPort() to set coordinates of each view port. and draw e.g. Psudocode gluViewPort() draw() glutSwapBuffers() gluViewPort() draw() glutSwapBuffers() ... What happens is when the redraw function is called I only see whats drawn for a fraction of a second, then nothing until next redraw command. How can I have multiple view ports? Thanks in advance!
Advertisement
I don't exactly know how glut does it but you don't want to swap the back buffer after you draw only part of the frame. Draw into the area you need and then when you are done drawing them all flip the back buffer with the front buffer.
Don't shoot! I'm with the science team.....
You should swap the buffers only AFTER everything has been drawn in your scene... to create multiple viewports you are using the right way (it's the same way I do that! :D ), simply, swap buffer after every viewport has been drawn! :P
I agree with you BladeWise..

And Four, I have a nice interactive program that would help you learn more about viewports...

But I'm still not sure where I should be posting the series of those tutorials...
I have made a C# implementation to support multiple viewports... it's a testing part fopr my simple 3D engine... I create a viewport class, and for each viewport object I associated a Camera object, everytime I render all the stuff, I simply set the viewport, the Camera view/projection, and then render the scene... Since I supposed every viewport could have a different backcolor, could use or not backface culling, textures and lights, I set these informations every time I render it... obviusly you could avoid the context refresh, if it's not needed! :D

This topic is closed to new replies.

Advertisement