Interface IOpenGLComponent
Interface for creating and interacting with OpenGL contexts.
Inherited Members
Namespace: OpenTK.Platform
Assembly: OpenTK.Platform.dll
Syntax
public interface IOpenGLComponent : IPalComponent
Properties
CanCreateFromSurface
True if the component driver can create a context from surfaces using CreateFromSurface().
Declaration
bool CanCreateFromSurface { get; }
Property Value
| Type | Description |
|---|---|
| bool |
CanCreateFromWindow
True if the component driver can create a context from windows using CreateFromWindow(WindowHandle).
Declaration
bool CanCreateFromWindow { get; }
Property Value
| Type | Description |
|---|---|
| bool |
See Also
CanShareContexts
True if the component driver has the capability to share display lists between OpenGL contexts.
Declaration
bool CanShareContexts { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
CreateFromSurface()
Create and OpenGL context for a surface.
Declaration
OpenGLContextHandle CreateFromSurface()
Returns
| Type | Description |
|---|---|
| OpenGLContextHandle | An OpenGL context handle. |
CreateFromWindow(WindowHandle)
Create an OpenGL context for a window.
Declaration
OpenGLContextHandle CreateFromWindow(WindowHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| WindowHandle | handle | The window for which the OpenGL context should be created. |
Returns
| Type | Description |
|---|---|
| OpenGLContextHandle | An OpenGL context handle. |
See Also
DestroyContext(OpenGLContextHandle)
Destroy an OpenGL context.
Declaration
void DestroyContext(OpenGLContextHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | Handle to the OpenGL context to destroy. |
See Also
GetBindingsContext(OpenGLContextHandle)
Gets a IBindingsContext from an OpenGLContextHandle. Pass this to LoadBindings(IBindingsContext) to load the OpenGL bindings.
Declaration
IBindingsContext GetBindingsContext(OpenGLContextHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | The handle to get a bindings context for. |
Returns
| Type | Description |
|---|---|
| IBindingsContext | The created bindings context. |
See Also
GetContextValues(OpenGLContextHandle)
Gets the context values of the OpenGL context. This can be used to query the actually selected context values initially requested in OpenGLGraphicsApiHints.
Declaration
ContextValues GetContextValues(OpenGLContextHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | The OpenGL context to get the context values from. |
Returns
| Type | Description |
|---|---|
| ContextValues | The context values for the OpenGL context. |
Remarks
During context creation all possible context values are enumerated and sent to Selector (by default set to DefaultValuesSelector(IReadOnlyList<ContextValues>, ContextValues, ILogger?)) which can choose the an appropriate format. This function returns these selected values.
See Also
GetCurrentContext()
Get the current OpenGL context for this thread.
Declaration
OpenGLContextHandle? GetCurrentContext()
Returns
| Type | Description |
|---|---|
| OpenGLContextHandle | Handle to the current OpenGL context, null if no context is current. |
See Also
GetProcedureAddress(OpenGLContextHandle, string)
Get the procedure address for an OpenGL command.
Declaration
nint GetProcedureAddress(OpenGLContextHandle handle, string procedureName)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | Handle to an OpenGL context. |
| string | procedureName | Name of the OpenGL command. |
Returns
| Type | Description |
|---|---|
| nint | The procedure address to the OpenGL command. |
GetSharedContext(OpenGLContextHandle)
Gets the context which the given context shares display lists with.
Declaration
OpenGLContextHandle? GetSharedContext(OpenGLContextHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | Handle to the OpenGL context. |
Returns
| Type | Description |
|---|---|
| OpenGLContextHandle | Handle to the OpenGL context the given context shares display lists with. |
See Also
GetSwapInterval()
Gets the swap interval of the current OpenGL context, or -1 if no context is current.
Declaration
int GetSwapInterval()
Returns
| Type | Description |
|---|---|
| int | The current swap interval, or |
SetCurrentContext(OpenGLContextHandle?)
Set the current OpenGL context for this thread.
Declaration
bool SetCurrentContext(OpenGLContextHandle? handle)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | Handle to the OpenGL context to make current, or null to make no context current. |
Returns
| Type | Description |
|---|---|
| bool | true when the OpenGL context is successfully made current. |
See Also
SetSwapInterval(int)
Sets the swap interval of the current OpenGL context.
Declaration
void SetSwapInterval(int interval)
Parameters
| Type | Name | Description |
|---|---|---|
| int | interval | The new swap interval. |
SwapBuffers(OpenGLContextHandle)
Swaps the buffer of the specified context.
Declaration
void SwapBuffers(OpenGLContextHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenGLContextHandle | handle | Handle to the context. |