Vixen
02b45cc4
csharp
public interface IGlContext

An OpenGL context, and the two calls a renderer needs from the window it belongs to.

Read the guide page for this →

Remarks

Deliberately four members and no GL entry points. Loading those is Vixen.Graphics.OpenGL's job and it does it from GetProcAddress; what a windowing layer uniquely knows is how to make a context current and how to put the back buffer on the screen. Keeping the two apart is what lets this interface be named by Core/ without Core/ learning what a texture is.

⚠ The context belongs to the window that made it and dies with it. Disposing it early is allowed and releases the driver's context; not disposing it is also fine, because a window cannot outlive its context on any platform that has both. That is the one ownership rule, and it is this way round because it is the one the underlying APIs already enforce.

⚠ Current on one thread at a time, and on the thread that called MakeCurrent. This is GL's oldest and least forgiving rule: every entry point loaded from a context is only valid while that context is current, so a renderer that records on a job thread has to make it current there and nowhere else. It is also the reason Vixen.Graphics.OpenGL reports no async queues.

Fields and properties (4)

  • int SwapInterval

    How many display refreshes a swap waits for: 0 for none, 1 for vsync.

  • bool IsEmbedded

    Whether the context that was actually created is OpenGL ES.

  • int MajorVersion

    The major version the driver gave, which may exceed the one requested.

  • int MinorVersion

    The minor version the driver gave.

Methods (3)

  • nint GetProcAddress(string name)

    Looks up a GL entry point by name.

  • void MakeCurrent()

    Makes this context current on the calling thread.

  • void SwapBuffers()

    Presents the default framebuffer.

Used by (5)

  • DesktopGlContextVixen.Platform.Desktop
  • DesktopGlContextTestsVixen.Platform.Desktop.Tests
  • DesktopWindowVixen.Platform.Desktop
  • IGlContextSourceVixen.Platform
  • GraphicsHostVixen.App