Page 1 of 1

rendering on multiple wxwidget windows

Posted: Fri Nov 13, 2009 2:22 pm
by diegoribas
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?

Posted: Fri Nov 13, 2009 3:58 pm
by hybrid
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.

Posted: Wed Nov 18, 2009 10:04 am
by diegoribas
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.

Posted: Wed Nov 18, 2009 12:25 pm
by hybrid
Hmm, that would have been my way as well. Are you sure that the window is properly set up and all matrices etc. initialised?

Posted: Wed Nov 18, 2009 1:31 pm
by diegoribas
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?

Posted: Wed Nov 18, 2009 1:50 pm
by diegoribas
Maybe the problem depends on the fact that I'm trying to render in both windows using the same SceneManager->drawAll()

Posted: Wed Nov 18, 2009 2:58 pm
by diegoribas
Problem solved using the same HRC for both windows.