GLUT question


I am trying to display two windows using GLUT. I seem to be unable to keep both windows active at the same time. I am currently doing this with 2 display routines but am open to changing it to one w/set window, etc. - whichever way works best. I would like the same lighting and textures for each. Right now one is using the lighting correctly and the other isn’t. I was wondering if someone could offer some suggestions? Maybe a framework I could use?

One criteria is I need to maintain different gluLookAt arguments for each window.

Sorry about the basic questions, am short on time to study in as much detail as I would like.

Very appreciated. Thanks.

Why don’t you use just one Window, but two Viewports ? All your Problems should be gone then.


Since each GLUT window has its own OpenGL rendering context, you need to do every operation twice (e.g. lighting setup).

I agree with Tom78. You should look at glViewport and glScissor. Viewport tells where your projection ends up in your window, and Scissor tells how to clip the rendering buffers. By combining the two, you can get several virtual windows in a single “physical” window, where all virtual windows share the same OpenGL rendering context.

Here is an example of four viewports in the same window: splitview.jpg .

[This message has been edited by marcus256 (edited 11-11-2003).]

Thanks for help. Appreciate it along w/all the help I have got on here - will not be wking on OpenGL/GLUT from now on.

Best regards to all.

use a main glut window, containing multiple subwindows, thats easier than maintaining 2 viewports.

  • Chetan