mirror of
https://github.com/glfw/glfw.git
synced 2025-06-15 12:12:16 +00:00
Added support for CGL context access in glfw3native.h
This allows access to the underlying context on OSX without dropping into ObjC as CGL is an entirely C-based API
This commit is contained in:
parent
f71a6c4cae
commit
2d1a98136e
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,6 +25,7 @@ src/glfw_config.h
|
||||
src/glfw3.pc
|
||||
src/glfwConfig.cmake
|
||||
src/glfwConfigVersion.cmake
|
||||
install_manifest.txt
|
||||
|
||||
# Compiled binaries
|
||||
src/libglfw.so
|
||||
|
@ -55,7 +55,8 @@ extern "C" {
|
||||
*
|
||||
* The available context API macros are:
|
||||
* * `GLFW_EXPOSE_NATIVE_WGL`
|
||||
* * `GLFW_EXPOSE_NATIVE_NSGL`
|
||||
* * `GLFW_EXPOSE_NATIVE_NSGL` (OSX, ObjC required to do anything useful)
|
||||
* * `GLFW_EXPOSE_NATIVE_CGL`
|
||||
* * `GLFW_EXPOSE_NATIVE_GLX`
|
||||
* * `GLFW_EXPOSE_NATIVE_EGL`
|
||||
*
|
||||
@ -88,6 +89,8 @@ extern "C" {
|
||||
/* WGL is declared by windows.h */
|
||||
#elif defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||
/* NSGL is declared by Cocoa.h */
|
||||
#elif defined(GLFW_EXPOSE_NATIVE_CGL)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#elif defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||
#include <GL/glx.h>
|
||||
#elif defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||
@ -133,6 +136,14 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_CGL)
|
||||
/*! @brief Returns the `CGLContextObj` of the specified window.
|
||||
* @return The `CGLContextObj` of the specified window.
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI CGLContextObj glfwGetCGLContext(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_X11)
|
||||
/*! @brief Returns the `Display` used by GLFW.
|
||||
* @return The `Display` used by GLFW.
|
||||
|
@ -289,3 +289,9 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
||||
return window->nsgl.context;
|
||||
}
|
||||
|
||||
GLFWAPI CGLContextObj glfwGetCGLContext(GLFWwindow* handle)
|
||||
{
|
||||
NSOpenGLContext* ctx = glfwGetNSGLContext(handle);
|
||||
return [ctx CGLContextObj];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user