The Open Toolkit library  1.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Properties | List of all members
OpenTK.BindingsBase Class Referenceabstract

Provides a common foundation for all flat API bindings and implements the extension loading interface. More...

Inheritance diagram for OpenTK.BindingsBase:
OpenTK.Graphics.GraphicsBindingsBase OpenTK.Graphics.ES10.GL OpenTK.Graphics.ES11.GL OpenTK.Graphics.ES20.GL OpenTK.Graphics.ES30.GL OpenTK.Graphics.OpenGL4.GL OpenTK.Graphics.OpenGL.GL

Public Member Functions

 BindingsBase ()
 Constructs a new BindingsBase instance. More...
 

Protected Member Functions

abstract IntPtr GetAddress (string funcname)
 Retrieves an unmanaged function pointer to the specified function. More...
 

Static Protected Member Functions

static void MarshalPtrToStringBuilder (IntPtr ptr, StringBuilder sb)
 Marshals a pointer to a null-terminated byte array to the specified StringBuilder. This method supports OpenTK and is not intended to be called by user code. More...
 
static IntPtr MarshalStringToPtr (string str)
 Marshal a System.String to unmanaged memory. The resulting string is encoded in ASCII and must be freed with FreeStringPtr. More...
 
static void FreeStringPtr (IntPtr ptr)
 Frees a marshalled string that allocated by MarshalStringToPtr. More...
 
static IntPtr MarshalStringArrayToPtr (string[] str_array)
 Marshals a System.String array to unmanaged memory by calling Marshal.AllocHGlobal for each element. More...
 
static void FreeStringArrayPtr (IntPtr ptr, int length)
 Frees a marshalled string that allocated by MarshalStringArrayToPtr. More...
 

Protected Attributes

readonly Type DelegatesClass
 A reflection handle to the nested type that contains the function delegates. More...
 
readonly Type CoreClass
 A refection handle to the nested type that contains core functions (i.e. not extensions). More...
 
readonly SortedList< string,
MethodInfo > 
CoreFunctionMap = new SortedList<string, MethodInfo>()
 A mapping of core function names to MethodInfo handles. More...
 

Properties

bool RebuildExtensionList [get, set]
 Gets or sets a System.Boolean that indicates whether the list of supported extensions may have changed. More...
 
abstract object SyncRoot [get]
 Gets an object that can be used to synchronize access to the bindings implementation. More...
 

Detailed Description

Provides a common foundation for all flat API bindings and implements the extension loading interface.

Constructor & Destructor Documentation

OpenTK.BindingsBase.BindingsBase ( )

Constructs a new BindingsBase instance.

Member Function Documentation

static void OpenTK.BindingsBase.FreeStringArrayPtr ( IntPtr  ptr,
int  length 
)
staticprotected

Frees a marshalled string that allocated by MarshalStringArrayToPtr.

Parameters
ptrAn unmanaged pointer allocated with MarshalStringArrayToPtr
lengthThe length of the string array.
static void OpenTK.BindingsBase.FreeStringPtr ( IntPtr  ptr)
staticprotected

Frees a marshalled string that allocated by MarshalStringToPtr.

Parameters
ptrAn unmanaged pointer allocated with MarshalStringToPtr
abstract IntPtr OpenTK.BindingsBase.GetAddress ( string  funcname)
protectedpure virtual

Retrieves an unmanaged function pointer to the specified function.

Parameters
funcnameA System.String that defines the name of the function.
Returns
A IntPtr that contains the address of funcname or IntPtr.Zero, if the function is not supported by the drivers.

Note: some drivers are known to return non-zero values for unsupported functions. Typical values include 1 and 2 - inheritors are advised to check for and ignore these values.

Implemented in OpenTK.Graphics.GraphicsBindingsBase.

static void OpenTK.BindingsBase.MarshalPtrToStringBuilder ( IntPtr  ptr,
StringBuilder  sb 
)
staticprotected

Marshals a pointer to a null-terminated byte array to the specified StringBuilder. This method supports OpenTK and is not intended to be called by user code.

Parameters
ptrA pointer to a null-terminated byte array.
sbThe StringBuilder to receive the contents of the pointer.
static IntPtr OpenTK.BindingsBase.MarshalStringArrayToPtr ( string[]  str_array)
staticprotected

Marshals a System.String array to unmanaged memory by calling Marshal.AllocHGlobal for each element.

Returns
An unmanaged pointer to an array of null-terminated strings
Parameters
str_arrayThe string array to marshal.
static IntPtr OpenTK.BindingsBase.MarshalStringToPtr ( string  str)
staticprotected

Marshal a System.String to unmanaged memory. The resulting string is encoded in ASCII and must be freed with FreeStringPtr.

Parameters
strThe System.String to marshal.
Returns
An unmanaged pointer containing the marshalled string. This pointer must be freed with FreeStringPtr

Member Data Documentation

readonly Type OpenTK.BindingsBase.CoreClass
protected

A refection handle to the nested type that contains core functions (i.e. not extensions).

readonly SortedList<string, MethodInfo> OpenTK.BindingsBase.CoreFunctionMap = new SortedList<string, MethodInfo>()
protected

A mapping of core function names to MethodInfo handles.

readonly Type OpenTK.BindingsBase.DelegatesClass
protected

A reflection handle to the nested type that contains the function delegates.

Property Documentation

bool OpenTK.BindingsBase.RebuildExtensionList
getsetprotected

Gets or sets a System.Boolean that indicates whether the list of supported extensions may have changed.

abstract object OpenTK.BindingsBase.SyncRoot
getprotected

Gets an object that can be used to synchronize access to the bindings implementation.

This object should be unique across bindings but consistent between bindings of the same type. For example, ES10.GL, OpenGL.GL and CL10.CL should all return unique objects, but all instances of ES10.GL should return the same object.