-
Notifications
You must be signed in to change notification settings - Fork 107
GL \ Initialization
OpenGL.Net initializes itself when Gl
is accessed for the first time. The initialization process consists of creating a native window and an OpenGL context for introspecting versions, extensions and limits. This information can be accessed via Gl.CurrentVersion
, Gl.CurrentExtensions
and Gl.CurrentLimits
properties, and they are relative to the compatible context created at initialization time.
To initialize OpenGL.Net explicitly, you can execute the static method Gl.Initialize()
, forcing the static constructor execution. This is particularly useful when you manually manage the OpenGL context creation, instead of using the DeviceContext
abstraction. Indeed, the static initialization of Gl
will screw the OpenGL context current on the thread, and can be avoided by calling Gl.Initialize()
.
By setting certain environment variables, OpenGL.Net can be configured to skip sub-systems initialization. This is useful in case some initialization procedure cause problems in a specific environment.
-
OPENGL_NET_GL_STATIC_INIT
: set this environment variable to 'NO' (case sensitive) in order to skip GL static constructor initialization. You can execute GL initialization by calling explicitlyGl.Initialize()
. This is useful in some debugger environment that has difficulties to debug static constructor code. -
OPENGL_NET_INIT
: set this environment variable to 'NO' (case sensitive) in order to skip GL initialization. The methodGl.Initialize()
will do nothing, skipping the entire GL initialization procedure described above. This is useful to speed up initialization time, but you have to care about it explicitly in you application. -
OPENGL_NET_EGL_STATIC_INIT
: set this environment variable to 'NO' (case sensitive) in order to skip EGL static constructor initialization. You can execute EGL initialization by calling explicitlyEgl.Initialize()
.