PDA

View Full Version : Rendering in two different windows



DaEvOsH
05-16-2001, 05:04 AM
Based on Nehe tutorials, I am rendering OpenGL in a a child of one window in my Win32 API app. Now I need to render on a child of -another- window in my app. Currently, in WM_CREATE for each child window I do something like:

case WM_CREATE:
....
openGLOk=CreateGLWindow(hwnd);
....
break;

....

case WM_PAINT:
wglMakeCurrent(hDC,hRC);
GLDrawScene();
SwapBuffers(hDC);
wglMakeCurrent(NULL,NULL);
....
break;

I do the same for both windows. Of course, different hRC and the hDC of each corresponding windows. hRC, hDC for each different child has a different name and is in a different file which contains the different window procedure.

Only one of the OpenGL window is shown rendering. If I comment out the call to CreateGLWindow of the one showing, it will then show the other one.

Note that each child window is calling different versions of CreateGLWindow and the other initializing functions. I did this while experimenting. Will create a single function for both child windows when I get this working, which passed the RC and DC as arguments.

CreateGLWindow is based on nehe.gamedev.net tutorials, and is working well (at least for one window). Just the normal GL under win32 API creation stuff... pixel format, getting a RC based on the DC, etc.

Later, thanks for any help!!

05-16-2001, 06:03 AM
http://www.opengl.org/discussion_boards/ubb/tongue.gif

DaEvOsH
05-16-2001, 09:04 AM
Hey, I know you! http://www.opengl.org/discussion_boards/ubb/smile.gif Got me all excited when I saw a reply...