The Open Toolkit library
1.0
|
Represents and provides methods to manipulate an OpenGL render context. More...
Public Member Functions | |
GraphicsContext (GraphicsMode mode, IWindowInfo window) | |
Constructs a new GraphicsContext with the specified GraphicsMode and attaches it to the specified window. More... | |
GraphicsContext (GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags) | |
Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window. More... | |
GraphicsContext (ContextHandle handle, IWindowInfo window) | |
Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK. More... | |
GraphicsContext (ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, int major, int minor, GraphicsContextFlags flags) | |
Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK. More... | |
override string | ToString () |
Returns a System.String representing this instance. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
override bool | Equals (object obj) |
Compares two instances. More... | |
void | SwapBuffers () |
Swaps buffers on a context. This presents the rendered scene to the user. More... | |
void | MakeCurrent (IWindowInfo window) |
Makes the GraphicsContext the current rendering target. More... | |
void | Update (IWindowInfo window) |
Updates the graphics context. This must be called when the render target is resized for proper behavior on Mac OS X. More... | |
void | LoadAll () |
Loads all OpenGL entry points. More... | |
void | Dispose () |
Disposes of the GraphicsContext. More... | |
Static Public Member Functions | |
static GraphicsContext | CreateDummyContext () |
Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries. More... | |
static GraphicsContext | CreateDummyContext (ContextHandle handle) |
Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries. More... | |
static void | Assert () |
Checks if a GraphicsContext exists in the calling thread and throws a GraphicsContextMissingException if it doesn't. More... | |
Properties | |
static IGraphicsContext | CurrentContext [get] |
Gets the GraphicsContext that is current in the calling thread. More... | |
static bool | ShareContexts [get, set] |
Gets or sets a System.Boolean, indicating whether GraphicsContext resources are shared More... | |
static bool | DirectRendering [get, set] |
Gets or sets a System.Boolean, indicating whether GraphicsContexts will perform direct rendering. More... | |
bool | ErrorChecking [get, set] |
Gets or sets a System.Boolean, indicating whether automatic error checking should be performed. Influences the debug version of OpenTK.dll, only. More... | |
bool | IsCurrent [get] |
Gets a System.Boolean indicating whether this instance is current in the calling thread. More... | |
bool | IsDisposed [get, set] |
Gets a System.Boolean indicating whether this instance has been disposed. It is an error to access any instance methods if this property returns true. More... | |
bool | VSync [get, set] |
[obsolete] Use SwapInterval property instead. Gets or sets a value indicating whether VSync is enabled. When VSync is enabled, SwapBuffers() calls will be synced to the refresh rate of the DisplayDevice that contains improving visual quality and reducing CPU usage. However, systems that cannot maintain the requested rendering rate will suffer from large jumps in performance. This can be counteracted by increasing the SwapInterval value. More... | |
int | SwapInterval [get, set] |
Gets or sets a positive integer in the range [1, n), indicating the number of DisplayDevice refreshes between consecutive SwapBuffers() calls. The maximum value for n is implementation-dependent. The default value is 1. This value will only affect instances where VSync is enabled. Invalid values will be clamped to the valid range. More... | |
GraphicsMode | GraphicsMode [get] |
Gets the GraphicsMode of the context. More... | |
Properties inherited from OpenTK.Graphics.IGraphicsContext | |
bool | IsCurrent [get] |
Gets a System.Boolean indicating whether this instance is current in the calling thread. More... | |
bool | IsDisposed [get] |
Gets a System.Boolean indicating whether this instance has been disposed. It is an error to access any instance methods if this property returns true. More... | |
bool | VSync [get, set] |
Gets or sets a value indicating whether VSync is enabled. When VSync is enabled, SwapBuffers() calls will be synced to the refresh rate of the DisplayDevice that contains improving visual quality and reducing CPU usage. However, systems that cannot maintain the requested rendering rate will suffer from large jumps in performance. This can be counteracted by increasing the SwapInterval value. More... | |
int | SwapInterval [get, set] |
Gets or sets a positive integer in the range [1, n), indicating the number of DisplayDevice refreshes between consecutive SwapBuffers() calls. The maximum value for n is implementation-dependent. The default value is 1. This value will only affect instances where VSync is enabled. Invalid values will be clamped to the valid range. More... | |
GraphicsMode | GraphicsMode [get] |
Gets the GraphicsMode of this instance. More... | |
bool | ErrorChecking [get, set] |
Gets or sets a System.Boolean, indicating whether automatic error checking should be performed. More... | |
Properties inherited from OpenTK.Graphics.IGraphicsContextInternal | |
IGraphicsContext | Implementation [get] |
Gets the internal implementation of the current instance. More... | |
ContextHandle | Context [get] |
Gets a handle to the OpenGL rendering context. More... | |
Represents and provides methods to manipulate an OpenGL render context.
OpenTK.Graphics.GraphicsContext.GraphicsContext | ( | GraphicsMode | mode, |
IWindowInfo | window | ||
) |
Constructs a new GraphicsContext with the specified GraphicsMode and attaches it to the specified window.
mode | The OpenTK.Graphics.GraphicsMode of the GraphicsContext. |
window | The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to. |
OpenTK.Graphics.GraphicsContext.GraphicsContext | ( | GraphicsMode | mode, |
IWindowInfo | window, | ||
int | major, | ||
int | minor, | ||
GraphicsContextFlags | flags | ||
) |
Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window.
mode | The OpenTK.Graphics.GraphicsMode of the GraphicsContext. |
window | The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to. |
major | The major version of the new GraphicsContext. |
minor | The minor version of the new GraphicsContext. |
flags | The GraphicsContextFlags for the GraphicsContext. |
Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
OpenTK.Graphics.GraphicsContext.GraphicsContext | ( | ContextHandle | handle, |
IWindowInfo | window | ||
) |
Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK.
handle | The handle of the existing context. This must be a valid, unique handle that is not known to OpenTK. |
window | The window this context is bound to. This must be a valid window obtained through Utilities.CreateWindowInfo. |
GraphicsContextException | Occurs if handle is identical to a context already registered with OpenTK. |
OpenTK.Graphics.GraphicsContext.GraphicsContext | ( | ContextHandle | handle, |
IWindowInfo | window, | ||
IGraphicsContext | shareContext, | ||
int | major, | ||
int | minor, | ||
GraphicsContextFlags | flags | ||
) |
Constructs a new GraphicsContext from a pre-existing context created outside of OpenTK.
handle | The handle of the existing context. This must be a valid, unique handle that is not known to OpenTK. |
window | The window this context is bound to. This must be a valid window obtained through Utilities.CreateWindowInfo. |
shareContext | 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 | The major version of the context (e.g. "2" for "2.1"). |
minor | The minor version of the context (e.g. "1" for "2.1"). |
flags | A bitwise combination of GraphicsContextFlags that describe this context. |
GraphicsContextException | Occurs if handle is identical to a context already registered with OpenTK. |
|
static |
Checks if a GraphicsContext exists in the calling thread and throws a GraphicsContextMissingException if it doesn't.
GraphicsContextMissingException | Generated when no GraphicsContext is current in the calling thread. |
|
static |
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.
|
static |
Creates a dummy GraphicsContext to allow OpenTK to work with contexts created by external libraries.
handle | The handle of a context. |
Instances created by this method will not be functional. Instance methods will have no effect.
void OpenTK.Graphics.GraphicsContext.Dispose | ( | ) |
Disposes of the GraphicsContext.
override bool OpenTK.Graphics.GraphicsContext.Equals | ( | object | obj | ) |
Compares two instances.
obj | The instance to compare to. |
override int OpenTK.Graphics.GraphicsContext.GetHashCode | ( | ) |
Returns the hash code for this instance.
void OpenTK.Graphics.GraphicsContext.LoadAll | ( | ) |
Loads all OpenGL entry points.
OpenTK.Graphics.GraphicsContextException | Occurs when this instance is not current on the calling thread. |
Implements OpenTK.Graphics.IGraphicsContext.
void OpenTK.Graphics.GraphicsContext.MakeCurrent | ( | IWindowInfo | window | ) |
Makes the GraphicsContext the current rendering target.
window | A valid OpenTK.Platform.IWindowInfo structure. |
You can use this method to bind the GraphicsContext to a different window than the one it was created from.
Implements OpenTK.Graphics.IGraphicsContext.
void OpenTK.Graphics.GraphicsContext.SwapBuffers | ( | ) |
Swaps buffers on a context. This presents the rendered scene to the user.
Implements OpenTK.Graphics.IGraphicsContext.
override string OpenTK.Graphics.GraphicsContext.ToString | ( | ) |
Returns a System.String representing this instance.
void OpenTK.Graphics.GraphicsContext.Update | ( | IWindowInfo | window | ) |
Updates the graphics context. This must be called when the render target is resized for proper behavior on Mac OS X.
window |
Implements OpenTK.Graphics.IGraphicsContext.
|
staticget |
Gets the GraphicsContext that is current in the calling thread.
Note: this property will not function correctly when both desktop and EGL contexts are available in the same process. This scenario is very unlikely to appear in practice.
|
staticgetset |
Gets or sets a System.Boolean, indicating whether GraphicsContexts will perform direct rendering.
If DirectRendering is true, new contexts will be constructed with direct rendering capabilities, if possible. If DirectRendering is false, new contexts will be constructed with indirect rendering capabilities.
This property does not affect existing GraphicsContexts, unless they are recreated.
This property is ignored on Operating Systems without support for indirect rendering, like Windows and OS X.
|
getset |
Gets or sets a System.Boolean, indicating whether automatic error checking should be performed. Influences the debug version of OpenTK.dll, only.
Automatic error checking will clear the OpenGL error state. Set CheckErrors to false if you use the OpenGL error state in your code flow (e.g. for checking supported texture formats).
|
get |
Gets the GraphicsMode of the context.
|
get |
Gets a System.Boolean indicating whether this instance is current in the calling thread.
|
getset |
Gets a System.Boolean indicating whether this instance has been disposed. It is an error to access any instance methods if this property returns true.
|
staticgetset |
Gets or sets a System.Boolean, indicating whether GraphicsContext resources are shared
If ShareContexts is true, new GLContexts will share resources. If this value is false, new GLContexts will not share resources.
Changing this value will not affect already created GLContexts.
|
getset |
Gets or sets a positive integer in the range [1, n), indicating the number of DisplayDevice refreshes between consecutive SwapBuffers() calls. The maximum value for n is implementation-dependent. The default value is 1. This value will only affect instances where VSync is enabled. Invalid values will be clamped to the valid range.
|
getset |
[obsolete] Use SwapInterval property instead. Gets or sets a value indicating whether VSync is enabled. When VSync is enabled, SwapBuffers() calls will be synced to the refresh rate of the DisplayDevice that contains improving visual quality and reducing CPU usage. However, systems that cannot maintain the requested rendering rate will suffer from large jumps in performance. This can be counteracted by increasing the SwapInterval value.