C# Class OpenTK.Graphics.GraphicsContext

Mostrar archivo Open project: prepare/HTML-Renderer Class Usage Examples

Private Properties

Property Type Description
CreateContext void
Dispose void
FindSharedContext IGraphicsContext
GraphicsContext System
GraphicsContext System
IGraphicsContextInternal System.IntPtr

Public Methods

Method Description
Assert ( ) : void

Checks if a GraphicsContext exists in the calling thread and throws a GraphicsContextMissingException if it doesn't.

CreateDummyContext ( ) : GraphicsContext

Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries.

Instances created by this method will not be functional. Instance methods will have no effect.

This method requires that a context is current on the calling thread.

CreateDummyContext ( ContextHandle handle ) : GraphicsContext

Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries.

Instances created by this method will not be functional. Instance methods will have no effect.

CreateExternalContext ( System.Platform externalGfxContext ) : GraphicsContext

TODO: for used with glfw context

Dispose ( ) : void

Disposes of the GraphicsContext.

GraphicsContext ( ContextHandle handle, IWindowInfo window ) : System

Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK.

GraphicsContext ( ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, int major, int minor, GraphicsContextFlags flags ) : System

Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK.

GraphicsContext ( OpenTK.Graphics.GraphicsMode mode, IWindowInfo window ) : System

Constructs a new GraphicsContext with the specified GraphicsMode and attaches it to the specified window.

GraphicsContext ( OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags ) : System

Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window.

Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.

LoadAll ( ) : void

Loads all OpenGL entry points.

MakeCurrent ( IWindowInfo window ) : void

Makes the GraphicsContext the current rendering target.

You can use this method to bind the GraphicsContext to a different window than the one it was created from.

SwapBuffers ( ) : void

Swaps buffers on a context. This presents the rendered scene to the user.

Update ( IWindowInfo window ) : void

Updates the graphics context. This must be called when the render target is resized for proper behavior on Mac OS X.

Private Methods

Method Description
CreateContext ( bool direct, IGraphicsContext source ) : void

Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the specified IGraphicsContext.

Direct rendering is the default rendering mode for OpenTK, since it can provide higher performance in some circumastances.

The 'direct' parameter is a hint, and will ignored if the specified mode is not supported (e.g. setting indirect rendering on Windows platforms).

Dispose ( bool manual ) : void
FindSharedContext ( ) : IGraphicsContext
GraphicsContext ( ContextHandle handle ) : System
GraphicsContext ( OpenTK externalGraphicsContext ) : System
IGraphicsContextInternal ( string function ) : IntPtr

Gets the address of an OpenGL extension function.

Method Details

Assert() public static method

Checks if a GraphicsContext exists in the calling thread and throws a GraphicsContextMissingException if it doesn't.
Generated when no GraphicsContext is current in the calling thread.
public static Assert ( ) : void
return void

CreateDummyContext() public static method

Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries.

Instances created by this method will not be functional. Instance methods will have no effect.

This method requires that a context is current on the calling thread.

public static CreateDummyContext ( ) : GraphicsContext
return GraphicsContext

CreateDummyContext() public static method

Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries.

Instances created by this method will not be functional. Instance methods will have no effect.

public static CreateDummyContext ( ContextHandle handle ) : GraphicsContext
handle ContextHandle The handle of a context.
return GraphicsContext

CreateExternalContext() public static method

TODO: for used with glfw context
public static CreateExternalContext ( System.Platform externalGfxContext ) : GraphicsContext
externalGfxContext System.Platform
return GraphicsContext

Dispose() public method

Disposes of the GraphicsContext.
public Dispose ( ) : void
return void

GraphicsContext() public method

Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK.
Occurs if handle is identical to a context already registered with OpenTK.
public GraphicsContext ( ContextHandle handle, IWindowInfo window ) : System
handle ContextHandle The handle of the existing context. This must be a valid, unique handle that is not known to OpenTK.
window IWindowInfo The window this context is bound to. This must be a valid window obtained through Utilities.CreateWindowInfo.
return System

GraphicsContext() public method

Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK.
Occurs if handle is identical to a context already registered with OpenTK.
public GraphicsContext ( ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, int major, int minor, GraphicsContextFlags flags ) : System
handle ContextHandle The handle of the existing context. This must be a valid, unique handle that is not known to OpenTK.
window IWindowInfo The window this context is bound to. This must be a valid window obtained through Utilities.CreateWindowInfo.
shareContext IGraphicsContext A different context that shares resources with this instance, if any. /// Pass null if the context is not shared or if this is the first GraphicsContext instruct you construct.
major int The major version of the context (e.g. "2" for "2.1").
minor int The minor version of the context (e.g. "1" for "2.1").
flags GraphicsContextFlags A bitwise combination of that describe this context.
return System

GraphicsContext() public method

Constructs a new GraphicsContext with the specified GraphicsMode and attaches it to the specified window.
public GraphicsContext ( OpenTK.Graphics.GraphicsMode mode, IWindowInfo window ) : System
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GraphicsContext.
window IWindowInfo The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.
return System

GraphicsContext() public method

Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window.
Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
public GraphicsContext ( OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags ) : System
mode OpenTK.Graphics.GraphicsMode The OpenTK.Graphics.GraphicsMode of the GraphicsContext.
window IWindowInfo The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.
major int The major version of the new GraphicsContext.
minor int The minor version of the new GraphicsContext.
flags GraphicsContextFlags The GraphicsContextFlags for the GraphicsContext.
return System

LoadAll() public method

Loads all OpenGL entry points.
/// Occurs when this instance is not current on the calling thread. ///
public LoadAll ( ) : void
return void

MakeCurrent() public method

Makes the GraphicsContext the current rendering target.
You can use this method to bind the GraphicsContext to a different window than the one it was created from.
public MakeCurrent ( IWindowInfo window ) : void
window IWindowInfo A valid structure.
return void

SwapBuffers() public method

Swaps buffers on a context. This presents the rendered scene to the user.
public SwapBuffers ( ) : void
return void

Update() public method

Updates the graphics context. This must be called when the render target is resized for proper behavior on Mac OS X.
public Update ( IWindowInfo window ) : void
window IWindowInfo
return void