OpenGL binding for .NET, implementing OpenGL 2.1, plus extensions.
For a list of all members of this type, see Gl Members.
System.Object
Tao.OpenGl.Gl
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Tao.OpenGl.Gl contains all OpenGL enums and functions defined in the 2.1 specification. The official .spec files can be found at: http://opengl.org/registry/.
Tao.OpenGl.Gl relies on static initialization to obtain the entry points for OpenGL functions. Please ensure that a valid OpenGL context has been made current in the pertinent thread before any OpenGL functions are called (toolkits like GLUT, SDL or GLFW will automatically take care of the context initialization process). Without a valid OpenGL context, Tao.OpenGl.Gl will only be able to retrieve statically exported entry points (typically corresponding to OpenGL version 1.1 under Windows, 1.3 under Linux and 1.4 under Windows Vista), and extension methods will need to be loaded manually.
If you prefer not to rely on static initialisation for the Gl class, you can use the ReloadFunctions or ReloadFunction methods to manually force the initialisation of OpenGL entry points. The ReloadFunctions method should be called whenever you change an existing visual or pixelformat. This generally happens when you change the color/stencil/depth buffer associated with a window (but probably not the resolution). This may or may not be necessary under Linux/MacOS, but is generally required for Windows.
You can use the Gl.IsExtensionSupported method to check whether any given category of extension functions exists in the current OpenGL context. The results can be cached to speed up future searches. Keep in mind that different OpenGL contexts may support different extensions, and under different entry points. Always check if all required extensions are still supported when changing visuals or pixel formats.
You may retrieve the entry point for an OpenGL extension using the Gl.GetDelegateForExtensionMethod and Gl.GetFunctionPointerForExtensionMethod methods. You may retrieve the entry point for an OpenGL function using the Gl.GetDelegateForMethod method. All three methods are cross-platform.
Namespace: Tao.OpenGl
Assembly: Tao.OpenGl (in Tao.OpenGl.dll)
Gl Members | Tao.OpenGl Namespace | IsExtensionSupported | GetDelegateForExtensionMethod | GetFunctionPointerForExtensionMethod | GetDelegateForMethod | ReloadFunctions | ReloadFunction