Skip to main content
Version: 0.9.0 (next)

OpenGlContextCallbacks struct

Raw C function pointers overriding how the library binds an OpenGL context; see QarOpenGlContextCallbacks in types.h. Every one is optional and called on the library's internal graphics thread; zero uses the library's own platform implementation for that step.

Namespace: Quaternar.Qaros · Assembly: Quaternar.Qaros.dll

public readonly struct OpenGlContextCallbacks

Remarks​

A pointer obtained with Marshal.GetFunctionPointerForDelegate is valid only while its delegate is reachable: keep the delegates alive for as long as the sender exists.

Constructors​

OpenGlContextCallbacks(nint, nint, nint, nint, nint)​

public OpenGlContextCallbacks(nint userState, nint getProcAddress, nint makeCurrent, nint captureCurrent, nint restoreCurrent)

Parameters

NameTypeDescription
userStatenint
getProcAddressnint
makeCurrentnint
captureCurrentnint
restoreCurrentnint

Properties​

MemberDescription
UserStatePassed unchanged to every callback; may be zero.
GetProcAddressvoid* (void* userState, const char* name): resolves a GL entry point, as eglGetProcAddress, wglGetProcAddress or glXGetProcAddressARB do. Zero uses the platform loader.
MakeCurrentbool (void* userState): binds the extension's context to the calling thread with the handles passed in the extension.
CaptureCurrentQarOpenGlContextThreadState (void* userState): reads the thread's current binding before OpenGlContextCallbacks.MakeCurrent replaces it.
RestoreCurrentbool (void* userState, const QarOpenGlContextThreadState* state): re-binds what OpenGlContextCallbacks.CaptureCurrent read once the library is done. When the state's has_context is false the thread had nothing bound, so bind nothing.

UserState​

Passed unchanged to every callback; may be zero.

public nint UserState { get; }

Value: nint

GetProcAddress​

void* (void* userState, const char* name): resolves a GL entry point, as eglGetProcAddress, wglGetProcAddress or glXGetProcAddressARB do. Zero uses the platform loader.

public nint GetProcAddress { get; }

Value: nint

MakeCurrent​

bool (void* userState): binds the extension's context to the calling thread with the handles passed in the extension.

public nint MakeCurrent { get; }

Value: nint

CaptureCurrent​

QarOpenGlContextThreadState (void* userState): reads the thread's current binding before OpenGlContextCallbacks.MakeCurrent replaces it.

public nint CaptureCurrent { get; }

Value: nint

RestoreCurrent​

bool (void* userState, const QarOpenGlContextThreadState* state): re-binds what OpenGlContextCallbacks.CaptureCurrent read once the library is done. When the state's has_context is false the thread had nothing bound, so bind nothing.

public nint RestoreCurrent { get; }

Value: nint