pragma's picture

[Solved] GameWindow Constructor testing for OpenGL 3 compatibility


i'm trying to create an OpenGL 3.0 context.

 public Game()
            : base(800, 600, GraphicsMode.Default, "OpenTK Quick Start Sample", 0, DisplayDevice.Default, 3, 0, GraphicsContextFlags.ForwardCompatible)

How can I tell if the above code succesfully created an OpenGL 3.0 context on the target mashine or wheter it fell back to an OpenGL 2.1 context.



Comment viewing options

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

Check whether GL.SupportsExtension("Version30") returns true. Alternatively, check the return value of GL.GetString(StringName.Version) or GL.GetInteger(GetPName.MajorVersion) (the later only works on 3.0-capable drivers).

pragma's picture

Thank you :)

kvark's picture

The easiest way is to use some of pre-GL function like GL.MatrixMode()
If you have a true forward compatible 3.0 context this call will rise an exception