how to divide a window in openGL?

opengl

Solution

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.

Problem

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.

Original source