Hi,
I successfully succeeded having Irrlicht running in multiple windows (Win32 windows) where I render a different camera to each window.
I just tried out different settings.
In the scene I load a skybox and after this an scenario from an irr file.
- Using DirectX for rendering: All windows show the same correct scenario
- Using OpenGL for rendering:
-> the main window contains the correct rendering while the secondary windows render the scene correctly but the skybox is missing and the lights are not correctly rendered.
Actually also without the skybox the lights are not correctly rendered.
Did anyone experience a similar problem?
Irrlicht - OpenGL - Multiple Windows - irr file
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Irrlicht - OpenGL - Multiple Windows - irr file
I guess your OpenGL renderstate setup for your windows is simply wrong. Irrlicht does quite a lot with internal OpenGL settings, and requires a certain, though not fully specified set of settings to properly work. It seems that yours simply does not fit perfectly.
Re: Irrlicht - OpenGL - Multiple Windows - irr file
Hi hybrid,
Actually I based my code on Win32 tutorial but instead of just one window I implemented 3 (leftWindow - mainWindow - rightWindow).
Here is the code for the creation of the left window (the one for the right window is the same)
The drawing in the main is done then as follows (the camera is setup as a FPS camera for all three windows):
Btw. when loading a pk3 (Quake) file it works fine.
The irr file I use was created with IrrEdit
Actually I based my code on Win32 tutorial but instead of just one window I implemented 3 (leftWindow - mainWindow - rightWindow).
Here is the code for the creation of the left window (the one for the right window is the same)
Code: Select all
hWndLeft = CreateWindow( Win32ClassName, conf->leftWindow.title.c_str(),
style, conf->leftWindow.x, conf->leftWindow.y, conf->leftWindow.w, conf->leftWindow.h,
winhandle, NULL, hInstance, NULL);
//SetWindowPos(hWndLeft, HWND_TOP,0,0,0,0,SWP_NOSIZE);
// create view to put the irrlicht views in
hIrrlichtWindowLeft = CreateWindow("BUTTON", "", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, 0, 0, conf->leftWindow.w, conf->leftWindow.h, hWndLeft, NULL, hInstance, NULL);
videodataLeft = video::SExposedVideoData (hIrrlichtWindowLeft);
//for opengl do some settings ...
if (driverType==video::EDT_OPENGL)
{
HDc=GetDC(hIrrlichtWindowLeft);
pfd.nSize=sizeof(PIXELFORMATDESCRIPTOR);
int pf = GetPixelFormat(HDc);
DescribePixelFormat(HDc, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
pfd.cDepthBits=16;
pf = ChoosePixelFormat(HDc, &pfd);
SetPixelFormat(HDc, pf, &pfd);
videodataLeft.OpenGLWin32.HDc = HDc;
videodataLeft.OpenGLWin32.HRc=wglCreateContext(HDc);
wglShareLists((HGLRC)device->getVideoDriver()->getExposedVideoData().OpenGLWin32.HRc, (HGLRC)videodataLeft.OpenGLWin32.HRc);
}
ShowWindow(hWndLeft , SW_SHOW);
UpdateWindow(hWndLeft);
Code: Select all
driver->beginScene(true, true, 0,videodataLeft);
smgr->setActiveCamera(camera[1]);
smgr->drawAll();
driver->endScene();
The irr file I use was created with IrrEdit
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Irrlicht - OpenGL - Multiple Windows - irr file
Yeah, certain things are not set up this way. They are missing in the beginning and will do so throughout the rendering. I guess we should expose the init method in order to call this on arbitrary window handles. For now, you probably have to go through the opengl setup code and try to issue those opengl calls until you meet the proper settings. I guess that some zbuffer is broken, not sure what the light stuff is up for.
Re: Irrlicht - OpenGL - Multiple Windows - irr file
Thanks for your answer. I will try to fix it. Anyway, any concrete hints would be appreciated.
Re: Irrlicht - OpenGL - Multiple Windows - irr file
Hi thgrill,
Have you resolve this issue?
Reasonly I switch to OpenGL and having the exact same problem.
The first created window looses textures on the skybox.
Also the addHillPlaneMesh only show the backface. That is render is on the bottom.
All the other windows renders find.
Regards,
vu
Have you resolve this issue?
Reasonly I switch to OpenGL and having the exact same problem.
The first created window looses textures on the skybox.
Also the addHillPlaneMesh only show the backface. That is render is on the bottom.
All the other windows renders find.
Regards,
vu