View Full Version : Switching to fullscreen
I use the code from nehe.gamedev.net and dis section always fails...
if ( m_bFullscreen )
memset( &dmScreenSettings, 0, sizeof(dmScreenSettings) );
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = m_nxWidth;
dmScreenSettings.dmPelsHeight = m_nyHeight;
dmScreenSettings.dmBitsPerPel = m_nBitsPerPixel;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; if ( ChangeDisplaySettings( &dmScreenSettings, CDS_FULLSCREEN )
!= DISP_CHANGE_SUCCESSFUL )
// it alwasy gets here
m_bFullscreen = false;
07-28-2001, 12:28 AM
Why don't you use glut ? You just have to call glutFullScreen () !
What errorcode does ChangeDisplaySettings return? It would help us alot to know. But to make a guess, it can be that you are trying to change to a displaymode your card can't handle.
07-30-2001, 02:16 PM
glut stinks, tell us the return code you get.
07-30-2001, 02:55 PM
the return code i get is DISP_CHANGE_BADMODE but its supported because i took the code from nehe and copy pasted.. it was working before.. and den suddenly it stopped working.. so i tried nehe's exe and it worked...
Ps. its me zaku .. i registered..
Did you change the colour depth on your desktop?
If it was 16-bit before and 32-bit now, it could cause a problem because some graphics cards can't change colour depth without restarting the computer.
07-31-2001, 09:18 AM
i changed the color depth to match the one i am requesting and this time ChangeDisplaySettings returned DISP_CHANGE_NOTUPDATED ( "Windows NT/2000: Unable to write settings to the registry" ). but nehe's code works fine... could this be happening because i am using a class to encapsulate the opengl code?
07-31-2001, 10:35 AM
Using a class should have no bearing at all on ChangeDisplaySettings. The API functions have no knowledge at all of whether they are called inside a class method, or inside a global function.
When is this function called? If you are doing it in the constructor and not setting your member variables first, it is very likely you are trying to request a video mode with garbage.
(i.e. until initialized m_nxWidth, m_nyHeight, and m_nBitsPerPixel will contain garbage, so the chance of you having that video mode is pretty slim.)
08-01-2001, 02:21 AM
Originally posted by Deiussum:
... (i.e. until initialized m_nxWidth, m_nyHeight, and m_nBitsPerPixel will contain garbage, so the chance of you having that video mode is pretty slim.)
THX A LOT. I finaly found the problem. Since you told me that those variables will have garbage untill they are initialized; I checked what was i initializing them to. So I had this class CGL whcih was derived from CWindow and CWindow by default uses 300 x 300 so i was requesting a fullscreen with a screen resolution of 300 x 300. So just had to set a size to at least to 640 x 480. And now it works fine.. thx a lot guys
08-01-2001, 03:04 AM
Wild guess :
Could it be that your rendering loop is still
enabled while switching to fullscreen.
I always disable all rendering before switching to fullscreen.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.