开发者

how to divide a window in openGL?

I want to divide the window into 2 parts. Each part I can draw a different thing. How can I do tha开发者_StackOverflowt 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.


See the documentation of glViewport: man glViewport


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜