View Full Version : Muliple OpenGL Contexts in Windows
12-19-2002, 08:49 AM
My program works fine when all of my drawing
is to the client area of the main window.
But when I create a STATIC control and
try to send OpenGL commands to it, the
commands appear to go nowhere. Does
anyone have sample code showing how to draw
to multiple windows (PC Windows)?
12-19-2002, 11:01 PM
Each window you want to render into needs it's own context, you use wglCreateContext to do that, one for each window you need to render to.
When you want to render to a specific window you call wglMakeCurrent to make that context the one to use at the moment.
That's all, be careful if you are using multithreading though.
The msdn docs on the wgl functions should give you the information you need.
12-23-2002, 06:53 AM
Thanks. Just after I posted my question, I
saw in the OpenGL overview for Windows a
statement that OpenGL can write ONLY to the
client area of a non-child Window, not to a
Control, which perhaps explains why what I
tried did not work. Have you actually been
able to use OpenGL to draw into a Control,
for example, a "STATIC"?
12-23-2002, 11:34 AM
That could be tricky, but you can always create your own control to do it, you also do the rendering into the dialogbox itself:
12-23-2002, 12:48 PM
Thanks for the reference to codeguru.
I see I will need to create a sub-class
of Dialog to make this work.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.