Screenshots don't capture fullsceren window in OpenGL mode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Screenshots don't capture fullsceren window in OpenGL mode

Post by Cube_ »

the title explains the problem, however I'm not going to call this a bug report until I have confirmation of such.

Essentially what I do is:
I create a fullscreen window and draw to it, so far so good - if I try to screenshot it I get the windows below when in OpenGL mode but in software I get the fullscreen window.

GPU: AMD Radeon HD 8350

I doubt it's a bug in AMD's OpenGL implementation however because it works fine in virtually (actually, exactly) every other OpenGL application I've tried.
I also doubt it's a bug in my code because I lifted the rendering loop from the tutorials and just loaded my own mesh data in.

IrrlichtDevice* iDevice = createDevice(EDT_OPENGL, res, 32, fullscreen, vsync, &eReceiver);
And I doubt there's a problem there (res is the screen resolution of the current screen, fullscreen is a boolean currently set to true, vsync is a boolean set to false, and you can probably figure out the rest)


full main function for reference:

Code: Select all

int main()
{
    IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
 
    core::dimension2d<u32> res = nulldevice->getVideoModeList()->getDesktopResolution();
 
    nulldevice -> drop();
    MyEventReceiver eReceiver;
    IrrlichtDevice* iDevice = createDevice(EDT_OPENGL, res, 32, fullscreen, vsync, &eReceiver);
    video::IVideoDriver* driver = iDevice->getVideoDriver();
    scene::ISceneManager* smgr = iDevice->getSceneManager();
    IGUIFont* font = iDevice->getGUIEnvironment()->getFont("data/fonts/bigfont.png");
    IGUIFont* font2 = iDevice->getGUIEnvironment()->getFont("data/worstFontEver.png");
 
    smgr->loadScene("data/maps/a_levelTest1.irr");
 
    int lastFPS = -1;
 
    while(iDevice->run())
        if (iDevice->isWindowActive())
        {
            driver->beginScene(true, true, video::SColor(0,200,200,200));
            smgr->drawAll();
            driver->endScene();
 
            int fps = driver->getFPS();
 
            if (lastFPS != fps)
            {
                core::stringw str = L"MWAS [";
                str += driver->getName();
                str += "] FPS:";
                str += fps;
 
                iDevice->setWindowCaption(str.c_str());
                lastFPS = fps;
            }
 
        }
 
    iDevice->drop();
 
    return 0;
}
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Screenshots don't capture fullsceren window in OpenGL mo

Post by CuteAlien »

You mean the windows-style screenshots by pressing the print button? Those should never work in fullscreen games, no idea why it works for you for other apps. I always need special tools which support fullscreen recording when making screenshots for games. Meaning - I have no clue why this even works for you in other cases...
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Screenshots don't capture fullsceren window in OpenGL mo

Post by Cube_ »

yes, that's exactly what I mean and it works fine with the software renderer (it just can't render scenes properly with tons of missing triangles).
it also works fine on the intel gpu with my other laptop under opengl mode in irrlicht.

but since it's not supposed to work (presumably in irrlicht - unless this is a bug), is there by chance any reliable way to hook print screen to call some built in screenshot function then? (and to not take a screenshot of the background while at it - this probably involves winapi now that I think about it)

if not I guess I'll just have to map it to something else but that's supposed to work fine

here's a screenshot of blender running in fullscreen: http://i.imgur.com/cMLjMsu.png
and here's a screenshot of the burningsvideo renderer in fullscreen (so slow T_T): http://i.imgur.com/RCCUQMv.png

I can't test the d3d renders because I'm not compiling with msvc - but I'd wager it works in those too, so it's the OpenGL renderer and only the OpenGL renderer.
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Screenshots don't capture fullsceren window in OpenGL mo

Post by CuteAlien »

Yeah, blender is not using another screen-mode. Firefox etc also work fullscreen, but games are using another mode (which is faster because it kinda is exclusive for a single application). No idea how to work around that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Screenshots don't capture fullsceren window in OpenGL mo

Post by Cube_ »

okay, after some digging it seems that it's due to how windows handles desktop compositing.

does irrlicht by chance support borderless windows (for emulating fullscreen by having a borderless window the size of the screen)? That would allow me to work around this.

In worst case I'll just have to not support prtscr screenshots (works fine under linux (in my experience, YMMV) but x11 handles compositing differently from windows - probably works under mac too but can't test that).
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Screenshots don't capture fullsceren window in OpenGL mo

Post by CuteAlien »

Unfortunately not yet supported. The only way to ge that is to create such a window yourself and then pass your window handle to Irrlicht (Win32 windows example).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Screenshots don't capture fullsceren window in OpenGL mo

Post by Cube_ »

right, that either means platform specific code or sdl2 and I really don't feel like writing platform specifics or building sdl2 just for that, I'll just map screenshots to F2 or something and use irrlicht's built in support for generating screenshots (which shouldn't cause more than momentary microstutter)
"this is not the bottleneck you are looking for"
Post Reply