Does anybody knows, is it possible to get OpenGL version before Application.Run.
There is a requirement - check OpenGL version before application run. Who knows any tricks for that?
Posted Wednesday, 23 September, 2009 - 13:34 by the Fiddler
To check the OpenGL version you need to create an OpenGL context. To create an OpenGL context, you need to create a window.
Possible solutions (both should work but I have tested neither):
Create a GLControl, query the version and destroy the control before you call Application.Run.
Create a NativeWindow, create a GraphicsContext using its WindowInfo, query the version and destroy both the context and the window prior to calling Application.Run.
Posted Wednesday, 23 September, 2009 - 15:25 by eugene.chepurnykh
To Fiddler:
Thank you. The answer was so simple.... I've tried to make WinGLControl, created context and windowInfo, executed MakeCurrent - but nothing good at the end.
This is fully working code.
string version = string.Empty;
try{GLControl control = newGLControl();
version = GL.GetString(StringName.Version);
}catch(Exception ex){returnfalse;
}
Posted Wednesday, 23 September, 2009 - 15:29 by the Fiddler
Don't forget to dispose the GLControl and reclaim the resources it uses:
string version = string.Empty;
try{using(GLControl control = newGLControl()){
version = GL.GetString(StringName.Version);
}}catch(Exception ex){returnfalse;
}
Comments
Re: Get OpenGL version before Application.Run.
To check the OpenGL version you need to create an OpenGL context. To create an OpenGL context, you need to create a window.
Possible solutions (both should work but I have tested neither):
GLControl, query the version and destroy the control before you callApplication.Run.NativeWindow, create aGraphicsContextusing itsWindowInfo, query the version and destroy both the context and the window prior to callingApplication.Run.Re: Get OpenGL version before Application.Run.
To Fiddler:
Thank you. The answer was so simple.... I've tried to make WinGLControl, created context and windowInfo, executed MakeCurrent - but nothing good at the end.
This is fully working code.
Re: Get OpenGL version before Application.Run.
Don't forget to dispose the GLControl and reclaim the resources it uses:
Re: Get OpenGL version before Application.Run.
Thank you again. Another part of rexeg mystery.
If somebody wants to parse Version of OpenGL I suggest next pattern: