[SDL] SDL2, OpenGL 3.2 Core and Steam-Overlay: Black Screenshots

moe m.ski at web.de
Sun Sep 4 10:24:45 PDT 2016


Hi,

I am a hobbyist game developer and new to this forum.

I recently upgraded my work-in-progress game engine to SDL 2 and OpenGL 3.2 Core Profile. Also, I imported my game to my Steam library as a non-steam game, mainly for taking screenshots.

The upgrade took place in several steps and I checked that my engine was still working after ever step.

Before upgrading to OpenGL 3.2 Core Profile, taking screenshots in Steam worked as expected. But after the upgrade all screenshots turned out black. I could verify that this has something to do with choosing Core Profile while setting up my rendering context. As long as I explicitly request a compatible OpenGL 3.2 context, screenshots are working fine. Since Steam ships its own version of SDL2.dll I also tried to put the version I downloaded from libsdl.org in the same directory as my game, but that didn't make any difference. I verified that the correct library was loaded by launching my game from steam and attaching to the process with my debugger afterwards. The path VisualStudio listed for the library was my local path, not the Steam one, but the screenshots were still black.

I don't know if it is of any use, but taking screenshots in Steam seems to happen somewhere down in SDL_GL_SwapWindow(), which makes sense, since only at this point it can be sure the frame is complete.

The way I set up OpenGL in SDL2 basically is:


Code:

m_win = SDL_CreateWindow( caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_OPENGL );

const int glmajor = 3, glminor = 2;

SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, glmajor );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, glminor );
[color=green]// to allow steam screenshots, use compatibility mode[/color]
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY );
// SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

m_glctx = SDL_GL_CreateContext( m_win );

// begin main loop
// ... do stuff
SDL_GL_SwapWindow( m_win );
// end main loop



I also checked if any of my OpenGL commands fails in Core, but all return with GL_NO_ERROR. 

I am aware that this might not be the right place to ask a questions that might be specific to OpenGL and Steam, but maybe someone else has encountered this problem and can suggest a solution to get a pure OpenGL 3.2 Core Profile or other things to check or try.

Of course, since I already found a workaround myself by not requesting Core Profile this is more a question out of curiosity.

The SDL version I am using is 2.0.4, but the problem was the same with 2.0.3. My compiler is VisualStudio Express 2013 (native C++, tested on Windows 7 and 10). My video card is an AMD R9 270 with the latest drivers.

    Marc




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20160904/ec00df17/attachment-0001.htm>


More information about the SDL mailing list