Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

thuned

what does ChangeDisplaySettings(NULL,0); do?

This topic is 6386 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

i''m new to opengl, still learning. started just last week. and one of the 1st things i learned is that my gfx card''s win2k drivers sux (viper2). windowed is fine. but when i exit the fullscreen, it gives me the blue screen. i think i narrowed the error down to ChangeDisplaySettings(NULL,0); cuz when i commenteed that out it doesn''t crash anymore. i think it just changes back to the resolution u had b4 u start the opengl window(which is weird cuz if i had the same res/color it still crashes). anyways, i''m just wondering, what happens when i leave it out? i commented it and the only thing i notice is that it doesn''t crash. it even changes back to my old res... so now i''m confused as to what it does. or maybe win2k auto changes back if the app doesn''t? how about leaving it out on 98 machines? thuned life is unfair, take advantage of it. UNMB2 - if the link doesn''t work, try clicking it

Share this post


Link to post
Share on other sites
Advertisement
The purpose of that is to restore your original display settings. Depending on what other APIs you are using, you may be trying to restore it after it has already been restored.



"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick

"It is far easier for a camel to pass through the eye of a needle if it first passes through a blender" -- Damocles

Share this post


Link to post
Share on other sites
every single nehe tutorial does it(fullscreen). in fact, all fullscreen opengl crashes. the only ones that doesn''t crash that i''ve ran is the opengl screensavers that''s included w/ windows

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it

Share this post


Link to post
Share on other sites
I have noticed that Win2K sometimes (not all the time though?) changes your resolution and color depth back if your app. crashes before restoring it. Though, all the OpenGL programs I base of NeHe''s code run just fine.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/

Share this post


Link to post
Share on other sites
i''m not saying nehe''s code has faults. in fact, his code works perfectly fine on my other machine and even my current machine w/ my current vid card in 98. it''s just my vid card has crappy win2k drivers.

so if win2k changes the res back. i have no problems commenting out that line, rite?

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it

Share this post


Link to post
Share on other sites
Sure, unless you want to distribute the program. In which case, you should just check the windows version and run it if it isn''t Win2K.



"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick

"It is far easier for a camel to pass through the eye of a needle if it first passes through a blender" -- Damocles

Share this post


Link to post
Share on other sites

// special lines so my crappy viper2 win2k drivers doesn''t crash
// fullscreen opengl apps.
char* renderer = (char *)glGetString(GL_RENDERER); // gets name of renderer(card name)
char* savage = "Savage2000"; // viper2 uses the savage2000 chip
for (int i=0;i<10;i++) // checks if string is the same
if (renderer != savage[i])
ChangeDisplaySettings(NULL,0); // if diff, Switch Back To The Desktop



yeah, i was just worrying about that. cuz i do want to distribute. how would i go about finding what os the user is using?


life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it

Share this post


Link to post
Share on other sites
According to that code, your program will call ChangeDisplaySettings 10 times in most cases, so it will crash on everyone''s computer unless they have a Savage2000 =)

Do this:

char* Renderer = (char *)glGetString( GL_RENDERER );
if( strcmp( Renderer, "Savage2000" ) ) // if Renderer != Savage2000
ChangeDisplaySettings( NULL, NULL );

That way should work. Remember, strcmp returns 0 if the strings are equal, -1 if the first string is alphabetically less than the second, and 1 if it comes after it alphabetically.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
thanks for the GetVersion or GetVersionEx, null and void, it works.

and CGameProgrammer, i didn''t notice that, thanks
for noticing that little bug i had there.


life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it

Share this post


Link to post
Share on other sites

  • 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!