tags:

views:

96

answers:

3

I want to divide the window into 2 parts. Each part I can draw a different thing. How can I do that in openGL ?

(Actually, my problem is I already drawn a picture on the window. Now I want to get some "space" out of it so I can draw something else. The original picture already took the whole window).

I appreciate if anybody could help.

Thanks.

+3  A: 

See the documentation of glViewport: man glViewport

Nikolai Ruhe
+2  A: 

You can use the glScissor command to do that. With glScissor, you'd split the screen in window coordinates and render to sub-parts of the screen. scissors protect parts of the already rendered output from being overwritten.

glScissor is made for the case where you know the dimension of your respective sub-images beforehand. If that is not the case, you'd have to go for a different solution.

Depending on your specific scenario, you might instead want to render to different windows (although that could be troublesome with GLUT) or use a different approach, such as image-based rendering.

mnemosyn
Thank you, glScissor did great!
tsubasa
+2  A: 

There's a tutorial about drawing with multiple viewports on the NeHe site:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=42

Hopefully it's somewhat useful.

talldan