anathema's picture

GL.GetString(StringName.Version) returning wrong value

Project:The Open Toolkit library
Version:all versions
Category:support request

Raising this as a support request rather than a bug, as I suspect it's me doing something wrong :-)

Running the above code returns a string of "2.1.2" on my system, and getting ShadingLanguageVersion returns "1.20 NVIDIA via Cg compiler". The thing is, my card supports OpenGL 3.2.0 and GLSL 1.50...

I've confirmed that glview returns the correct values. Anyone know what's going on here? :-)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
c2woody's picture


What context did you request?

anathema's picture


I just created a GLControl with the parameter-less constructor:

GLControl glc = new GLControl();
string version = GL.GetString(StringName.Version);

the Fiddler's picture


Since 3.1+ is not backwards compatible with 2.1, drivers will give you a 2.1 context unless you request a higher one (otherwise existing applications would break). For instance, GL.GetString(StringName.Version) is not even valid in 3.1. You need to use:

int major, minor;
GL.GetInteger(GetPName.Major, out major);
GL.GetInteger(GetPName.Minor, out minor);

OpenTK provides constructors that allow you to specify the desired OpenGL version.

anathema's picture


Status:open» closed

Ah :-) I thought it might be something like that. Many thanks!

c2woody's picture



For instance, GL.GetString(StringName.Version) is not even valid in 3.1.

Can't find any source for that, it is fully supported in forward compatible contexts (except the EXTENSIONS checking) and works fine.

The returned string depends on the requested context though, as The Fiddler wrote the default context is 1.x/2.x compatible and thus the returned version is limited.

the Fiddler's picture


Ah, you are right. GL.GetString(StringName.Extensions) is the deprecated one, not Version.