I need to render into multiple windows with variable sizes. I'm using opengl and wxwidgets on windows.
In this blog http://www.irrlicht3d.org/pivot/entry.php?id=347
I've read that:
There is a second way which is a bit more difficult, and I am using it in irrEdit. It only works in Windows and only with the Software and Direct3D devices, and not with OpenGL, currently. The advantage of this method is that you can render into multiple windows with variable sizes, but only need one IrrlichtDevice.
What does this mean? Does It mean that it is absolutely NOT possible to render into multiple windows with variable sizes using opengl or does it mean that you CAN do that if you use more than one IrrlichtDevice?
If is it possible can you suggest me how to do that?
rendering on multiple wxwidget windows
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
You cannot have more than one device in your app, because you'd need several processes to handle the separate instances. The way Niko described is the parameter which is now given to beginScene. The thing is, that OpenGL currently does not change the context to this new window, hence rendering won't work. But ti should be possible to make this in the app, after that you can use the hwnd with OpenGL jsut as with the other systems.
-
- Posts: 8
- Joined: Fri Nov 13, 2009 2:08 pm
I'm trying to render in multiple windows in this way:
getDriver()->beginScene( true, true, 0 );
//draw in the first window
getDriver()->endScene();
HGLRC temp_hRC = wglGetCurrentContext();
HDC temp_hDC = wglGetCurrentDC();
wglMakeCurrent( secondWin->hDC, secondWin->hRC );
glClearColor(0,0,0,0);
//rendering in the second window
glFlush();
SwapBuffers(secondWin->hDC);
wglMakeCurrent( temp_hDC, temp_hRC );
But it doesn't work, in the second window it draws a crappy version of what is drawn in the first.
getDriver()->beginScene( true, true, 0 );
//draw in the first window
getDriver()->endScene();
HGLRC temp_hRC = wglGetCurrentContext();
HDC temp_hDC = wglGetCurrentDC();
wglMakeCurrent( secondWin->hDC, secondWin->hRC );
glClearColor(0,0,0,0);
//rendering in the second window
glFlush();
SwapBuffers(secondWin->hDC);
wglMakeCurrent( temp_hDC, temp_hRC );
But it doesn't work, in the second window it draws a crappy version of what is drawn in the first.
-
- Posts: 8
- Joined: Fri Nov 13, 2009 2:08 pm
I've done some modifications.
In the second window I'm trying to render the same scene with a different camera. It works but the rendering is crappy. I can't see textures or fonts but only lines or simple primitives.
Here is the code...........
//creating the device (the only one that I use)
device = createDeviceEx(param);
HGLRC temp_hRC = wglGetCurrentContext();
HDC temp_hDC = wglGetCurrentDC();
//I do not use this device, I'm creating it only for initialization of second_hrc
dummyDevice = createDeviceEx(secondParam);
second_hRC = wglGetCurrentContext();
second_hDC = wglGetCurrentDC();
wglMakeCurrent( temp_hDC, temp_hRC );
Where am I wrong?
In the second window I'm trying to render the same scene with a different camera. It works but the rendering is crappy. I can't see textures or fonts but only lines or simple primitives.
Here is the code...........
//creating the device (the only one that I use)
device = createDeviceEx(param);
HGLRC temp_hRC = wglGetCurrentContext();
HDC temp_hDC = wglGetCurrentDC();
//I do not use this device, I'm creating it only for initialization of second_hrc
dummyDevice = createDeviceEx(secondParam);
second_hRC = wglGetCurrentContext();
second_hDC = wglGetCurrentDC();
wglMakeCurrent( temp_hDC, temp_hRC );
Where am I wrong?
-
- Posts: 8
- Joined: Fri Nov 13, 2009 2:08 pm
-
- Posts: 8
- Joined: Fri Nov 13, 2009 2:08 pm