Jump to content
  • Advertisement
Sign in to follow this  
Jan2go

OpenGL [GLEW] Check available OpenGL version

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

The GLEW documentation states that you can check the available OpenGL version like this:

if (GLEW_VERSION_1_3)
{
  /* Yay! OpenGL 1.3 is supported! */
}

So, as my code is using OpenGL 3.0 i used GLEW_VERSION_3_0 to see if the computer can run the program. However, when I tested it on an Thinkpad which uses an integrated Intel graphics card with support only up to OpenGL 2.1. GLEW_VERSION_3_0 was for some reason evaluated as true. Querying GL_MAJOR_VERSION and GL_MINOR_VERSION as well as GL_VERSION show the correct result (OpenGL 2.1).

I tested other GLEW_VERSION_X_X macros on this computer, you can see the results in the attached file.

 

Has anybody else experienced this before? It's not a big deal to create a workaround for it but I wonder what might cause it and if it happens on other graphic cards as well.

Share this post


Link to post
Share on other sites
Advertisement

Try using

glewIsSupported("GL_VERSION_3_0");

etc, instead of checking the version macros directly.

 

Querying GL_MAJOR_VERSION, GL_MINOR_VERSION, GL_VERSION will not give you available OpenGL versions in the driver but the version of the context you already created. Also GL_MAJOR_VERSION and GL_MINOR_VERSION were introduced in OpenGL 3.0 as far as I know, so they might not be a good way of checking the version on contexts created with earlier GL versions.

 

You could also try to run another OpenGL capabilities viewer like http://www.realtech-vr.com/glview/ to compare results.

Share this post


Link to post
Share on other sites

Using glewIsSupported gives the same results als GLEW_VERSION_X_X. However, if GL_MAJOR_VERSION and GL_MINOR_VERSION return the OpenGL version of the created context, i could use that information the exit the program, if the created context is not at least of version 3.0.

 

I will try the Extension Viewer later, the download is via FTP and for some reason FTP is blocked here.

Share this post


Link to post
Share on other sites

There seem to be two sets of defines for GL versions in GLEW, a bit confusing really:

"GLEW_VERSION_x_x" vs. "GL_VERSION_x_x"

 

In my code I am using the "GL_VERSION_x_x" ones with "glewIsSupported" and so far haven't had any problems on multiple test machines.

 

At least according to this post on Stackoverflow the "GL_VERSION_x_x" ones seem to work better indeed (for whatever reason)

http://stackoverflow.com/questions/21644230/what-is-the-difference-between-glew-version-x-x-and-gl-version-x-x

 

I guess your idea to just try to create contexts of a certain version and see if it succeeds or fails seems like a good way to check as well. Just on intel (and maybe other vendors) I've seen situations where it would create the context just fine but then not actually support the full GL spec for that particular version. Good times :)

Share this post


Link to post
Share on other sites

Ok, I downloaded and installed the extension viewer. Not very usefull on this computer though, it crashes during the "Loading extensions..." part. :D

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!