Advertisement

My prog does not switch to full screen

Started by January 24, 2003 01:38 AM
2 comments, last by davidsporn 22 years, 1 month ago
Hi there, Recently I am rewriting my code from scratch (better design, better style, better code, it''s a new year, etc...) My main problem until now was having a black screen, but now I have a wonderful triangle I updated my driver and checked the order in wich I make the initialisation against previous code that actually work (it includes Nehe base code and tutorials) Now the only problem is that my app don''t switch to full screen, and I cannot see why. Apparently my call to ChangeDisplaySettings() is succesfull but in fact nothings happen. I''m quite sure that I checked carefully my code, but as I said all previous code work, so there must be some crap somewhere Here I recap the process of switching to fullscreen I did : - I Fill the DEVMODE structure :
  
VideoMode_.dmPelsWidth
	= i->dmPelsWidth ;
VideoMode_.dmPelsHeight		  
	= i->dmPelsHeight ;
VideoMode_.dmBitsPerPel		  
	= i->dmBitsPerPel ;
VideoMode_.dmDisplayFrequency 
	= i->dmDisplayFrequency ;
VideoMode_.dmFields 
	= (DM_PELSWIDTH|DM_PELSHEIGHT|DM_BITSPERPEL|DM_DISPLAYFREQUENCY) ;
  
Note that I also tried with just 640*480*32bpp@60hz - Then I call a function that use ChangeDisplaySettings()
  
bool SwitchToFullScreen(DEVMODE* mode)
{
    if (0 != mode)
    {
	std::cout << "Switch to full screen : " ;
        if (DISP_CHANGE_SUCCESSFUL !=
            ChangeDisplaySettings(mode, CDS_TEST))
        {
			std::cout << "Test of ChangeDisplaySettings() failed." << std::endl ;
            return false ;
        }
        if (DISP_CHANGE_SUCCESSFUL !=
            ChangeDisplaySettings(mode, CDS_FULLSCREEN))
        {
			std::cout << "ChangeDisplaySettings() failed." << std::endl ;
            return false ;
        }
		std::cout 
			<< mode->dmPelsWidth << "x"
			<< mode->dmPelsHeight << "x"
			<< mode->dmBitsPerPel << "@"
			<< mode->dmDisplayFrequency << "Hz"
			<< std::endl ;
        return true ;
    } // if (true == fsFlag)

    else
    {
		std::cout << "Switch back to full screen." << std::endl ;
        return (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettings(0, 0)) ;
    } // if (true == fsFlag)

}

  
finally, here is the log file I get :
  
____________________ Start of Log ____________________
Creating fullScreen window...
39 full screen modes.
Switch to full screen : 1280x960x32@120Hz
SwitchToFullScreen() succeeded.
CreateWindowEx() succedeed.
Initialize OpenGL.
OpenGL initialized.
Resizes window : 1280 x 960...
Resizes viewport : 1280 x 960...
Resizes completed
Sporniket OpenGL Framework - 16.7984 FPS
Sporniket OpenGL Framework - 15.6709 FPS
Sporniket OpenGL Framework - 15.8259 FPS
Uninitialize OpenGL.
ReleaseDC() failed.
OpenGL uninitialized.
Switch back from full screen.
^^^^^^^^^^^^^^^^^^^^^ End of Log ^^^^^^^^^^^^^^^^^^^^^
  
I will go to the office now, so I will have to wait this evening before trying your ideas. Many thanks in advance. ---- David Sporn AKA Sporniket
Aaaaaah !!!

I guess I forgot to fill the dmSize field of the DEVMODE structure !!!

I''ll try that this evening...


----
David Sporn AKA Sporniket
Advertisement
quote:
Original post by davidsporn
David Sporn AKA Sporniket


Forgive me my ignorance, but I always thought it was David''s Porn - damn me and my lack of education...

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Yes, it was this damn dmSize field !!!

quote:
Original post by Crispy
Forgive me my ignorance, but I always thought it was David''s Porn - damn me and my lack of education...


Don''t worry, you are not the only one.



----
David Sporn AKA Sporniket

This topic is closed to new replies.

Advertisement