View Full Version : OpenGl in Dialog

07-23-2003, 08:47 AM
I use OpenGL in MFC.
Here I want to draw second OpenGL window in a opened dialog. How to do it?
Anyone has examples?

07-23-2003, 09:16 AM
It's quite easy. Instead of using the dialog window itself as your DC, create a Picture Control and use it's DC (which you can find using GetDlgItem). This way you only render to a portion of the screen. Create a second Picture Control and do the same thing...call wglMakeCurrent to switch to the current context before doing any rendering.

07-23-2003, 09:53 AM
Is there any example code?

07-23-2003, 10:32 AM
and now I setup the dialog for drawing.
However, the openGL setting in the dialog will effect opengl in the main window.
How to totally seperate them?

07-24-2003, 12:03 AM
each rendering context has its own state

07-24-2003, 08:33 AM
There are a code: www.7forever.com/code.zip (http://www.7forever.com/code.zip)

http://www.opengl.org/discussion_boards/ubb/frown.gif ,I write it for asking how the share texture in defferent opengl context.But i have a bad new:This is can not!