rendering on multiple wxwidget windows

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
diegoribas
Posts: 8
Joined: Fri Nov 13, 2009 2:08 pm

rendering on multiple wxwidget windows

Post 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?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
diegoribas
Posts: 8
Joined: Fri Nov 13, 2009 2:08 pm

Post 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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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?
diegoribas
Posts: 8
Joined: Fri Nov 13, 2009 2:08 pm

Post 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?
diegoribas
Posts: 8
Joined: Fri Nov 13, 2009 2:08 pm

Post by diegoribas »

Maybe the problem depends on the fact that I'm trying to render in both windows using the same SceneManager->drawAll()
diegoribas
Posts: 8
Joined: Fri Nov 13, 2009 2:08 pm

Post by diegoribas »

Problem solved using the same HRC for both windows.
Post Reply