Irrlicht - OpenGL - Multiple Windows - irr file

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
thgrill
Posts: 3
Joined: Fri Jun 28, 2013 10:22 am

Irrlicht - OpenGL - Multiple Windows - irr file

Post by thgrill »

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

Re: Irrlicht - OpenGL - Multiple Windows - irr file

Post by hybrid »

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.
thgrill
Posts: 3
Joined: Fri Jun 28, 2013 10:22 am

Re: Irrlicht - OpenGL - Multiple Windows - irr file

Post by thgrill »

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)

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);
 
The drawing in the main is done then as follows (the camera is setup as a FPS camera for all three windows):

Code: Select all

 
    driver->beginScene(true, true, 0,videodataLeft);
    smgr->setActiveCamera(camera[1]);
    smgr->drawAll();
    driver->endScene();
 
Btw. when loading a pk3 (Quake) file it works fine.

The irr file I use was created with IrrEdit
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Irrlicht - OpenGL - Multiple Windows - irr file

Post by hybrid »

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.
thgrill
Posts: 3
Joined: Fri Jun 28, 2013 10:22 am

Re: Irrlicht - OpenGL - Multiple Windows - irr file

Post by thgrill »

Thanks for your answer. I will try to fix it. Anyway, any concrete hints would be appreciated.
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: Irrlicht - OpenGL - Multiple Windows - irr file

Post by thanhle »

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
Post Reply