Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

OpenGL PrtScn is black in full screen?

This topic is 2560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I try to capture a screen shot of my program in full screen all I get is a black image. I set the pixel format on my window like this:



int pixelFormat;
UINT numFormats;
float fAttributes[] = {0,0};

int iAttributes[] =
{
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_COLOR_BITS_ARB, 24,
WGL_ALPHA_BITS_ARB, 0,
WGL_DEPTH_BITS_ARB, 0,
WGL_STENCIL_BITS_ARB, 0,
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
0, 0
};
wglChoosePixelFormatARB( instance->hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
SetPixelFormat( instance->hDC, pixelFormat, NULL );



I go to full screen like this:



SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
RECT Rect;
GetWindowRect(hWnd, &Rect);
DEVMODE dmScreenSettings = {0};
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = Rect.right;
dmScreenSettings.dmPelsHeight = Rect.bottom;
dmScreenSettings.dmBitsPerPel = 24;
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
ChangeDisplaySettings( &dmScreenSettings, CDS_FULLSCREEN );
ShowWindow( hWnd, SW_SHOW );
SetFocus(hWnd);



Any idea why capturing the screen with PrtScn would not work on my program?

Share this post


Link to post
Share on other sites
Advertisement
Not really sure but alot of games give me a black screen when trying to use print screen in full screen. You could perhaps handle the print screen key press yourself, render a frame and copy it to the clipboard.

Share this post


Link to post
Share on other sites

Not really sure but alot of games give me a black screen when trying to use print screen in full screen. You could perhaps handle the print screen key press yourself, render a frame and copy it to the clipboard.


Not an awful idea though I would like to make that my last resort in case it's just some random setting I can change to get it to work.

Share this post


Link to post
Share on other sites
Hey Steve, I have this problem too and i use glutEnterGameMode to get there. I'd like to leave it up to the host OS too, if possible. I encounter this in all display modes (actually i only tried 16, 24 and 32 bit, various refresh rates and resolutions). This might not be of much help, sorry for getting your hopes up. :-/

Share this post


Link to post
Share on other sites
I had even weirder problems with fullscreen print screen. Occasionally it was okay, but sometimes it copied a screen that was overwritten long ago... (a noob loadscreen). Maybe some triple-buffering is going on.

You could also try Alt+PrintScreen (interestingly, a lot of people don't know this. This prints only the active window.)

Share this post


Link to post
Share on other sites
I always wondered since when PrintScreen gives a black screen in games, Vista/7 only maybe? Using fraps works great, and some games have their own "print screen" button which generate a bitmap/jpg in the game folder. Guess you have to do custom code for it now, when it was working great in the XP days.Back then, only movies (in windows media player and such) gave black screens.

Share this post


Link to post
Share on other sites
I also have this problem (win7). To solve it I either go to windowed mode and use print screen or use my own screen capture and save the context to the HDD. Freeimage is pretty good image library if you are in need of one, can save PNGs.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!