简体   繁体   中英

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 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.

请参阅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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM