Game Development Community

dev|Pro Game Development Curriculum

TorqueScript for Checking for OpenGL Support in TGE

by Pisal Setthawong · 08/13/2008 (6:16 am) · 2 comments

In deploying TGE games, one of the problems that I've faced over time is that some of the client machines do not support OpenGL, that is mainly caused by obselete display card drivers that use the Microsoft OpenGL drivers which is outdated and will not work properly with many OpenGL applications. With TGE, it has a D3D fallback for game rendering if OpenGL is not supported.

However the D3D support of the stock TGE is not that consistent, that causes rendering differences between the two drivers, and a few of them can cause issues that are critical. For example Transparency and Translucency in D3D in TGE is not supported well and can potentially crash the game or simply causes the game control not to render. This is one error that alot of users in a test group I've worked in complained about (they were running outdated display card drivers).

One issue that is cropped up is that when most users see the start page, they assume the game will work. This also means people who have problems with Video Display Drivers or using the Outdated Microsoft Version of OpenGL, would be expecting to play the game. One thing that would be useful is to stop the game if the client cannot support adequate OpenGL. This is a cheaper approach than to fix the D3D implementation, and could inform your client of potential problems.

I've included a simple script that could be called anywhere below:

function testOpenGLDriver()
{
   //get the display driver
   %buffer = getDisplayDeviceList();   
   %count = getFieldCount( %buffer );
   
   //find if the OpenGL Driver is present
   for(%i = 0; %i < %count; %i++)
   {
      if (getField(%buffer, %i) $= "OpenGL")
      {
         echo("Has OpenGL Drivers!");
         return;  //exit when OpenGL is found
      }
   }
   
   
   //if it isn't found quit the application and inform the user about display driver problems!
   MessageBoxOK("OpenGL Driver is not Found!", "Please update your video display driver!", "quit();"); 
}

If OpenGL is not found, then the quit function is called as a callback to quit the application after finding there is no OpenGL support.

To use this script, you could call this script anywhere, potentially during startup is the best time.

If you are adventurous you may want to try a more detailed check of which company did the display card come from and redirect the user to the client page. That is an overkill, but it never hurts to do things a little overboard :P

About the author

An Educator moonlighting as the Technical Lead at the indie game development studio called Flying Pig Game Studio


#1
08/13/2008 (6:46 am)
Nice code man...
#2
04/19/2009 (3:21 pm)
Thanks, my target audience is from old cards to newest...