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 → (2)

api in : GLApi

The render context API.

flags opt : RenderContextFlags = RenderContextFlags.None

The render context creation flags.

returns → RenderContext

The RenderContext object or null if not available.

Creates a new RenderContext object for the given API.

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

Current


[OwnerReturn]
public static method Current → (1)

api in : GLApi

The render context API.

returns → RenderContext

The RenderContext object or null if not available.

Creates a RenderContext object that wraps the current render context of the calling thread.

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

Public / Methods

Assert​Active


public method AssertActive → (1)

source in : string

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

true to log an error message before returning false,
false 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

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.

Can​Create


public static method CanCreate → (1)

api in : GLApi

The render context API.

returns → bool

true if Create will return a non-null value,
false if not.

Checks if Create will return a non-null value for the given api in.

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.

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 Prepare, using the presentation mode of this render context.

Select


[BeginEnd]
public abstract method Select → (1)

window in : INativeWindow

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

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

Api


public abstract attribute Api → (get)

value : GLApi

The API.

The API of this GL context.

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).

Protected / Methods

Compute​Video​Memory


[Pure]
protected method ComputeVideoMemory → (1)

memory in : int32

The video memory size that has been provided externally (in megabytes) or 0 to try to determine the amount of video memory automatically.

returns → int32

The amount of video memory, in megabytes.

Computes the amount of available video memory.