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 Has1. 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, 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 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 ErrorReset and ErrorThrow methods to perform error handling.
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
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 (source opt is null
, no error logging) or unexpected (source opt is not null
, error logging) by the application.
- 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.
- RenderException
-
If a non-zero error value has been recorded.
- See also
Plain
Puts this GL-wrapper in plain mode.
In plain mode, a GL-wrapper will only use the base API version and it will not use any extensions. This method may only be called before calling NativeLibrary.Initialize.
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.
Protected / Methods
Has
2 overloads
Checks if the given extension is present.
This is a convenience method intended for use by implementations of NativeLibrary.InitializeFunctionPointers.
Checks if the given API version is supported.
This is a convenience method intended for use by implementations of NativeLibrary.InitializeFunctionPointers.
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.