// Context reference // https://www.glfw.org/docs/latest/group__context.html // Hand-written members of the Context library. GetCurrentContext and GetProcAddress are in the // generator's ManualMethods set (no P/Invoke is generated for them - see Manual/Glfw.PInvoke.cs), // so they cannot be generated and live here. The rest of the Context library is generated into // Generated/Libraries/Glfw.Context.gen.cs and merges into this same partial class. namespace Brutal.GlfwApi; public static unsafe partial class Glfw { /// Returns the window whose context is current on the calling thread. /// /// This function returns the window whose OpenGL or OpenGL ES context is current on the calling thread. /// /// The window whose context is current, or null if no window's context is current. /// /// /// /// This function may be called from any thread. /// Current context public static nint GetCurrentContext() { return (nint)PInvoke.GetCurrentContext(); } /// Returns the address of the specified function for the current context. /// /// This function returns the address of the specified OpenGL or OpenGL ES core or extension function, if it is /// supported by the current context. /// /// A context must be current on the calling thread. Calling this function without a current context will cause a /// error. /// /// This function does not apply to Vulkan. If you are rendering with Vulkan, see /// GetInstanceProcAddress, /// InstanceLibrary.GetProcAddr and /// DeviceLibrary.GetProcAddr instead. /// /// The address of a given function is not guaranteed to be the same between contexts. /// /// This function may return a non-null address despite the associated version or extension not being available. /// Always check the context version or extension string first. /// /// The address of the function, or null if an error occurred. /// /// , /// , /// /// /// The returned function pointer is valid until the context is destroyed or the library is terminated. /// This function may be called from any thread. /// OpenGL and OpenGL ES extensions public static nint GetProcAddress(ReadOnlySpan procName) { fixed (byte* pProcName = procName) return PInvoke.GetProcAddress(pProcName); } }