GLBase

Description

abstract class Tinman.AddOns.API.GLBase

Derived from

NativeLibrary abstract

Extended by

EGL sealed
GL sealed
GLES sealed
GLX sealed
WGL sealed

Full source code is included in the Tinman 3D SDK download.

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 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 API enumeration items and commands that are used by the API extension. The full list of available extensions may be queried via Extensions.
For example:
Public attribute GL_NV_mesh_shader.

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 FetchLastError method. Use the ResetErrors and ThrowOnError methods to perform error handling.

Public / Constructors

Create


[OwnerReturn]
public static method Create → (2)

api in : GLApi

The API.

context in : GLBase own

[not-null]
The context.

returns → GLBase

The GLBase object or null if not available on this machine or platform.

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

Reset​Errors


public method ResetErrors → ()

returns → bool

true if at least one GL error has been reported,
false if no GL errors were present.

Resets all GL errors that have been recorded so far.

This method calls FetchLastError repeatedly until it returns 0.

Throw​On​Error


public method ThrowOnError → (2)

source in : string

The error source tag.

functionName in : string

The GL function name to report on failure.

Throws an exception if the GL has recorded an error.

This method calls FetchLastError repeatedly until it returns 0. 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.

Wrap

12 overloads


public method Wrap1 → (1)

in : float32

The value to wrap.

returns → float32 [ ]

The wrapping array.

Wraps the given value in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapFloat


public method Wrap2 → (2)

in : float32

The value to wrap.

in : float32

The value to wrap.

returns → float32 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapFloat


public method Wrap3 → (3)

in : float32

The value to wrap.

in : float32

The value to wrap.

in : float32

The value to wrap.

returns → float32 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapFloat


public method Wrap4 → (4)

in : float32

The value to wrap.

in : float32

The value to wrap.

in : float32

The value to wrap.

in : float32

The value to wrap.

returns → float32 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapFloat


public method Wrap5 → (1)

in : int32

The value to wrap.

returns → int32 [ ]

The wrapping array.

Wraps the given value in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapInt


public method Wrap6 → (2)

in : int32

The value to wrap.

in : int32

The value to wrap.

returns → int32 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapInt


public method Wrap7 → (3)

in : int32

The value to wrap.

in : int32

The value to wrap.

in : int32

The value to wrap.

returns → int32 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapInt


public method Wrap8 → (4)

in : int32

The value to wrap.

in : int32

The value to wrap.

in : int32

The value to wrap.

in : int32

The value to wrap.

returns → int32 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapInt


public method Wrap9 → (1)

in : int64

The value to wrap.

returns → int64 [ ]

The wrapping array.

Wraps the given value in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapLong


public method Wrap10 → (2)

in : int64

The value to wrap.

in : int64

The value to wrap.

returns → int64 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapLong


public method Wrap11 → (3)

in : int64

The value to wrap.

in : int64

The value to wrap.

in : int64

The value to wrap.

returns → int64 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapLong


public method Wrap12 → (4)

in : int64

The value to wrap.

in : int64

The value to wrap.

in : int64

The value to wrap.

in : int64

The value to wrap.

returns → int64 [ ]

The wrapping array.

Wraps the given values in an array.

The returned array will remain valid until a Wrap* method is called again.

See also

GLBase.WrapLong

Wrap​Float


public method WrapFloat → (1)

length opt : int32 = 1

[>=1]
The wrapper array length.

returns → float32 [ ]

The wrapper array with undefined contents.

Returns a wrapper array.

The returned array will remain valid until a Wrap* method is called again.

Wrap​Int


public method WrapInt → (1)

length opt : int32 = 1

[>=1]
The wrapper array length.

returns → int32 [ ]

The wrapper array with undefined contents.

Returns a wrapper array.

The returned array will remain valid until a Wrap* method is called again.

Wrap​Long


public method WrapLong → (1)

length opt : int32 = 1

[>=1]
The wrapper array length.

returns → int64 [ ]

The wrapper array with undefined contents.

Returns a wrapper array.

The returned array will remain valid until a Wrap* method is called again.

Public / Attributes

Context


public attribute Context → (get)

value : GLBase

The GLBase object or null.

The GLBase object that represents the native API for managing GL contexts.

Extensions


public attribute Extensions → (get)

value : ISortedSetConst<string>

[not-null]
The extension names.

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.

Protected / Constructors

GLBase


protected constructor GLBase → (2)

name in : string

[not-empty]
Human-readable name for this native library.

context in : GLBase own

Optional GLBase object to use for retrieving function pointers.

Creates a new instance of GLBase.

Protected / Methods

Fetch​Last​Error


protected abstract method FetchLastError → ()

returns → int32

The error code or 0 if there are no more errors.

Polls the next error.

Has


protected method Has → (1)

extension in : string

The extension name.

returns → bool

true if the given extension in is available,
false if it is not available.

Checks if the given extension is present.

This is a convenience method intended for use by implementations of NativeLibrary.InitializeFunctionPointers.

Lookup​Extensions


[EmptyBody]
protected virtual method LookupExtensions → (1)

index in : int32

Zero-based index of this method call.

returns → string

The index in-th extension string or null to stop calling this method. Each extension string may contain zero or more extensions names, separated by whitespaces.

Returns the supported API extensions.

This method is called repeatedly during the first time the Extensions property is accessed or the Has method is called, until it returns null.