To main page | 3dengine.org
Multiple Views
To draw
multiple views in OpenGL you can use what I call
"glViewport & glScissor" technique. Draw windows one-by-one.
Drawing window 1
Window 1. If you want to draw a window at bottom left of (x = 100 pixels, y = 80 pixels) with width = 200 pixels, height = 150 pixels.
glEnable(GL_SCISSOR_TEST);
glScissor(100,80,200,150);
glMatrixMode(GL_VIEWPORT);
glViewport(100,80,200,150);
glMatrixMode(GL_MODELVIEW);
As you see - you need to supply SAME coordinates to both viewport and scissor calls.
You might also need to call
gluPerspective to update the
aspect ratio.
Drawing window 2
Then do the same for Window 2 (with different coordinates)
glEnable(GL_SCISSOR_TEST);
glScissor(320,90,120,150);
glMatrixMode(GL_VIEWPORT);
glViewport(320,90,120,150);
glMatrixMode(GL_MODELVIEW);
Finishing
Then after you are done, you can disable scissoring:
glDisable(GL_SCISSOR_TEST);