View Full Version : 2 windows

03-22-2004, 01:47 PM
i have a scene that i want displayed in 2 different windows. they r the same scene but at different angles. do i need to create a new DC/RC? could someone plz help. some sample code will be of great help.Thank u

03-22-2004, 02:24 PM
As far as I know: Yes. You need a two contextes (?) for two windows.

03-22-2004, 03:51 PM
You can render two (or more) different views to two parts of the same window with the glViewport command, but if you definitely want two separate windows, eror is right... each one will have its own OpenGL Render Context.

If you do use more than one context and you want to render the same scene between the two, use wglShareLists (assuming you are using MS Windows platform) to make sure the display lists, and texture objects are shared between the two (or more) contexts.

Hope that helps.

03-23-2004, 07:36 AM
thanx guyz. i have another question. will i need to have a separate display routine now for the new RC? is it possible to use the same display routine so that i can check to see if atleast the 2 contexts are alive. some sample code will be helpful.

thank u

03-27-2004, 03:09 PM
You can use the same display routine as long as you make the RC for the specific window current before calling (or at the beginning of) your display routine.

wglMakeCurrent( HDC hWindowDC, HGLRC hWindowRC )

The rest of the OpenGL commands in your display routine should then apply to whichever window you wanted the rendering to be displayed in.