Jump to content
  • Advertisement
Sign in to follow this  
SharkBait

OpenGL Best approach to detecting OpenGL?

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

Background: I am implementing a 2D graphics rendering engine over OpenGL with a software fallback mode implemented via SDL. I am stuck however trying to figure out the best way for detecting OpenGL and using the software fallback otherwise. I've been researching the issue for quite a while now, but I couldn't find any convincing solution. So what is the best approach for detecting OpenGL, short of attempting to open an OpenGL-enabled window and failing while doing so? My target platform is Windows, but if you can point out a cross-platform solution, even better :) Thanks

Share this post


Link to post
Share on other sites
Advertisement

SDL_SetVideoMode(width,height,bpp,flags) should returns NULL if it fails. I see no other solutions to detect an OpenGL failure under SDL

Share this post


Link to post
Share on other sites
Through sheer luck I was going through Bob Pendleton's hardware surface article at

http://www.linuxdevcenter.com/pub/a/linux/2003/08/07/sdl_anim.html?page=1

and I realised you can simply call SDL_VideoModeOK(width,height,bpp,flags) to check if a video mode with the given size, bits per pixel and flags are supported. It was simply a matter of ORing SDL_HWSURFACE to the flags parameter to check for an accelerated video mode.

The last bit of the puzzle will be finding a PC that has no hardware acceleration whatsoever - I tried disabling my OGL and ATI drivers but all I got was OpenGL running on slow software mode. :)

Thanks for the help.. your post sort of inspired me to look for a solution from an SDL perspective!

Share this post


Link to post
Share on other sites
Well, on windows if there is no hardware acceleration you'll probably get the MS driver and on linux probably mesa, so checking the vendor string should do it

Share this post


Link to post
Share on other sites
As an extreme solution you can 'fire' 5000 quads without swapping and see the time elapsed! Finished the test you can write a simple text file that will remind you the OpenGL disabled setting.
Or simply let the user to decide.

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!