GLBase
Description
- Derived from
-
NativeLibrary abstract
IVideoMemoryContainer - Extended by
-
EGL sealed
GLBaseWithDebug abstract
GLX sealed
WGL sealed
Abstract base class for NativeLibrary implementations that access a native GL-style API.
Public constants define enumeration items that may be passed to or returned from API commands. The documentation links to the API version and/or API extension that has introduced the enumeration item.
For example:
Public constant BLEND_SRC_ALPHA
for API enumeration item GL_BLEND_SRC_ALPHA
(32971), introduced by API version GL_VERSION_1_4
(i.e. OpenGL 1.4).
Public attributes of type bool
are used to indicate the availability of those API extensions that can be accessed directly through the wrapper. The documentation links to the enumeration items and commands that are used by the API extension. The full list of available extensions may be queried via Extensions, individual extensions may be queried with Extension. API extensions that have no enumeration items and no commands are omitted from the wrapper.
For example:
Public attribute GL_NV_mesh_shader
.
A GLBase subclass implements a specific minimum version of a GL-style API (for example OpenGL 4.1), which features are always available. Features of higher versions are treated like extensions via Version, using the special extension name {PREFIX}_VERSION_{X}_{Y}
, where {PREFIX}
is an implementation-specific name prefix (for example GL_ES
) and {X}
/ {Y}
are the major and minor API version. API extensions that have become obsolete by the minimum API version are omitted from the wrapper.
For example:
Public attribute GL_VERSION_4_6
, indicating the availability of the OpenGL 4.6 API.
To avoid unnecessary clutter in the wrapper, identical enumeration items and commands are propagated through API extensions towards API versions, if possible. For enumeration items, the first possible action is performed: (1) the vendor tag (e.g. ARB
, NV
) is dropped, (2) the vendor tag is replaced with KHR
, (3) the vendor tag is replaced with ARB
, (4) the vendor tag is replaced with EXT
. Commands may have an alias (defined by the Khronos XML API Registry): the wrapper then drops these commands and uses the alias instead.
For example:
Public attribute ALPHA8
for API enumeration item GL_ALPHA8
which has been propagated from GL_ALPHA8_EXT
.
Public method ActiveTexture
for API command glActiveTexture
which is an alias of glActiveTextureARB
.
Public methods represent the API commands, where method signatures closely model the command parameters, without imposing convenience layers dealing with marshalling or abstraction. Use the Wrap
methods to pass per-reference arguments.
Calling an API command may generate zero or more errors, which must be reported by subclasses by implementing the ErrorFetch method. Use the ErrorReset1, ErrorReset2 and ErrorThrow methods to perform error handling.
The NativeLibrary.InitializeFunctionPointers method of subclasses must call the base method as the final statement, before returning.
Public / Constructors
Create
Creates a GLBase object for the given api in, using the specified context in for function pointer retrieval.
This method requires that there is a current render context for the calling thread.
Public / Methods
ErrorReset
2 overloads
Resets all GL errors that have been recorded so far.
This method calls ErrorFetch repeatedly until it returns 0
and treats GL errors as expected (no error logging). When this method returns false
, it might have called a Wrap*
method.
- See also
Resets all GL errors that have been recorded so far.
This method calls ErrorFetch repeatedly until it returns 0
and treats GL errors as unexpected (with error logging) by the application. When this method returns false
, it might have called a Wrap*
method.
- See also
ErrorThrow
Throws an exception if the GL has recorded an error.
This method calls ErrorFetch repeatedly until it returns 0
and treats GL errors as unexpected by the application. If at least one call has returned a non-zero error value, an exception is thrown. Otherwise, it returns normally. When this method throws, it might have called a Wrap*
method.
- RenderException
-
If a non-zero error value has been recorded.
- See also
Extension
Checks if the given extension is supported.
This method may be called when there is no current GL context.
Plain
Puts this GL-wrapper in plain mode.
In plain mode, a GL-wrapper will only load the base API version. It will not load any extensions. This method may only be called before calling NativeLibrary.Initialize.
Version
Checks if the given API version is supported.
This method may be called when there is no current GL context.
- See also
Wrap
12 overloads
Wraps the given value in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given value in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given value in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
Wraps the given values in an array.
The returned array will remain valid until a Wrap*
method is called again.
- See also
WrapFloat
Returns a wrapper array.
The returned array will remain valid until a Wrap*
method is called again.
Public / Attributes
Extensions
The supported API extensions.
This set represents the extension names as they have been reported from the underlying GL. It may contain extensions for which the corresponding public attribute is false
. This may happen if one or more extension function pointers have not been found.
This property may be accessed when there is no current GL context.
- See also
Protected / Methods
Has
2 overloads
Checks if the given extension is present, i.e. whether it is contained in Extensions.
This is a convenience method intended for use by implementations of NativeLibrary.InitializeFunctionPointers.
- See also
Checks if the given API version is supported.
This is a convenience method intended for use by implementations of NativeLibrary.InitializeFunctionPointers.
- See also
LookupExtensions
Returns the supported API extensions.
This method is called repeatedly during the first time the Extensions property is accessed or the Has1 method is called, until it returns null
.
LookupVersion
Returns the supported API version.
This method is called once during the first time the Has2 method is called.