RenderContext

Description

abstract class Tinman.Engine.API.RenderContext

Derived from

Disposable abstract
INativeHandle
IVideoMemoryContainer

Extended by

WGLContext sealed

Abstract base for classes that represent a render context for a specific API.

This render context will be current for the calling thread as long as Begin has been called more often than End. Use Prepare and Select to choose the output window for rendering, while this render context is current.

Public / Constructors

Create


[OwnerReturn]
public static method Create → (3)

api in : GLApi

The acceptable render context APIs.

flags opt : RenderContextFlags = RenderContextFlags.None

The render context creation flags.

types opt : NativeHandleFlags = NativeHandleFlags.Type

The native handle types that are acceptable to the caller.

returns → RenderContext

The RenderContext object or null if not available.

Creates a new RenderContext object for the given API by delegating to IApplicationWindowFactory.CreateRenderContext of a suitable registered IApplicationWindowFactory instance.

The returned RenderContext will not be active, i.e. IsActive will return false.

Current


[OwnerReturn]
public static method Current → (2)

api in : GLApi

The acceptable render context APIs.

types opt : NativeHandleFlags = NativeHandleFlags.Type

The native handle types that are acceptable to the caller.

returns → RenderContext

The RenderContext object or null if not available.

Creates a RenderContext object that wraps the current render context of the calling thread by delegating to IApplicationWindowFactory.CurrentRenderContext of a suitable registered IApplicationWindowFactory instance.

The returned RenderContext will be active, in the same way as if Begin had been called once.

Public / Methods

Assert​Active


[Assertion]
public method AssertActive → (1)

source in : string @ Tag

The error source tag.

Asserts that this render context is active, i.e. IsActive returns true.

Begin


public abstract method Begin → (1)

source opt : string = null

The error source tag to use for logging an error message before returning false or null to never log any message.

returns → bool

The resulting active state of this render context (see IsActive):
true if this render context is the current one,
false if this render context cannot be made the current one.

Begins to use this render context as the current one of the calling thread.

Each call to Begin that returns true must have a paired call to End. Calls to Begin and End may be nested. This render context will be made current upon the first call to Begin.

Begin​Throw


public method BeginThrow → (1)

source in : string @ Tag

The error source to use when throwing an exception.

Calls Begin and throws an exception if it returns false.

RenderException

If Begin has returned false.

End


public abstract method End → ()

Ends using this render context as the current one of the calling thread.

This render context will be made not current upon the last call to End or when the RenderContext object is disposed. If End is called without a matching call to Begin, it will return silently.

Is


[Pure]
public method Is → (1)

api in : GLApi

The acceptable GL APIs.

returns → bool

true if this GL context supports one of the given APIs,
false if it supports none of them.

Checks if this GL context supports at least one of the given APIs.

Prepare


[BeginEnd]
public abstract method Prepare → (1)

window in : INativeWindow

[not-null]
The native window to prepare.

returns → bool

true if window in may be passed to Select,
false if window in cannot be used with this context.

Prepares the given native window for being used with this render context.

Present


[BeginEnd]
public abstract method Present → ()

returns → bool

true if presentation has finished
false if presentation has failed.

Presents the current renderings using the window that has been specified with the last call toSelect, using the presentation mode of this render context.

Select


[BeginEnd]
public abstract method Select → (2)

window in : INativeWindow

The native window to use (must have been prepared with Prepare) or null.

source opt : string = null

The error source tag to use for logging an error message before returning false or null to never log any message.

returns → bool

true if window in has been selected for this render context,
false if not.

Selects the given native window for being used with this render context.

Public / Attributes

Gl


public abstract attribute Gl → (get)

value : GLBase

[not-null]
The API wrapper object.

The GLBase object that wraps the API of this GL context.

Is​Active


public abstract attribute IsActive → (get)

value : bool

true if the render context is active,
false if the render context is not active.

Checks if this render context is active.

The methods of the Gl object may only be called while the render context is active. Otherwise, the behaviour will be undefined. During the render cycle of a graphics context (see IBeginEnd.Begin and IBeginEnd.End of IGraphicsContext, the underlying render context will always be active).

Name


[Constant]
public abstract attribute Name → (get)

value : string

[not-empty]
The render context name.

Returns the machine-readable and human-friendly name of this render context.

Protected / Methods

Build​Version​Profile​Api​List


[Pure]
protected static method BuildVersionProfileApiList → (3)

api in : GLApi

The acceptable GL apis.

profileCore opt : int32 = 0

The identifier for OpenGL Core Profile.

profileEs opt : int32 = 0

The identifier for OpenGLES.

returns → Vec4I [ ]

The list of combinations to use for probing:
Vec4I.X : major GL version
Vec4I.Y : minor GL version
Vec4I.Z : the profile identifier, either profileCore opt or profileEs opt
Vec4I.W : the GLApi flag

Builds a list for probing supported GL contexts.