glfw3native.h
Go to the documentation of this file.
1 /*************************************************************************
2  * GLFW 3.1 - www.glfw.org
3  * A library for OpenGL, window and input
4  *------------------------------------------------------------------------
5  * Copyright (c) 2002-2006 Marcus Geelnard
6  * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
7  *
8  * This software is provided 'as-is', without any express or implied
9  * warranty. In no event will the authors be held liable for any damages
10  * arising from the use of this software.
11  *
12  * Permission is granted to anyone to use this software for any purpose,
13  * including commercial applications, and to alter it and redistribute it
14  * freely, subject to the following restrictions:
15  *
16  * 1. The origin of this software must not be misrepresented; you must not
17  * claim that you wrote the original software. If you use this software
18  * in a product, an acknowledgment in the product documentation would
19  * be appreciated but is not required.
20  *
21  * 2. Altered source versions must be plainly marked as such, and must not
22  * be misrepresented as being the original software.
23  *
24  * 3. This notice may not be removed or altered from any source
25  * distribution.
26  *
27  *************************************************************************/
28 
29 #ifndef _glfw3_native_h_
30 #define _glfw3_native_h_
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*************************************************************************
38  * Doxygen documentation
39  *************************************************************************/
40 
69 /*************************************************************************
70  * System headers and types
71  *************************************************************************/
72 
73 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
74  // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
75  // example to allow applications to correctly declare a GL_ARB_debug_output
76  // callback) but windows.h assumes no one will define APIENTRY before it does
77  #undef APIENTRY
78  #include <windows.h>
79 #elif defined(GLFW_EXPOSE_NATIVE_COCOA)
80  #include <ApplicationServices/ApplicationServices.h>
81  #if defined(__OBJC__)
82  #import <Cocoa/Cocoa.h>
83  #else
84  typedef void* id;
85  #endif
86 #elif defined(GLFW_EXPOSE_NATIVE_X11)
87  #include <X11/Xlib.h>
88  #include <X11/extensions/Xrandr.h>
89 #else
90  #error "No window API selected"
91 #endif
92 
93 #if defined(GLFW_EXPOSE_NATIVE_WGL)
94  /* WGL is declared by windows.h */
95 #elif defined(GLFW_EXPOSE_NATIVE_NSGL)
96  /* NSGL is declared by Cocoa.h */
97 #elif defined(GLFW_EXPOSE_NATIVE_GLX)
98  #include <GL/glx.h>
99 #elif defined(GLFW_EXPOSE_NATIVE_EGL)
100  #include <EGL/egl.h>
101 #else
102  #error "No context API selected"
103 #endif
104 
105 
106 /*************************************************************************
107  * Functions
108  *************************************************************************/
109 
110 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
111 
125 GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
126 
141 GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
142 
156 GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
157 #endif
158 
159 #if defined(GLFW_EXPOSE_NATIVE_WGL)
160 
173 GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
174 #endif
175 
176 #if defined(GLFW_EXPOSE_NATIVE_COCOA)
177 
190 GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
191 
205 GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
206 #endif
207 
208 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
209 
222 GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
223 #endif
224 
225 #if defined(GLFW_EXPOSE_NATIVE_X11)
226 
239 GLFWAPI Display* glfwGetX11Display(void);
240 
254 GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
255 
269 GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
270 
284 GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
285 #endif
286 
287 #if defined(GLFW_EXPOSE_NATIVE_GLX)
288 
301 GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
302 #endif
303 
304 #if defined(GLFW_EXPOSE_NATIVE_EGL)
305 
318 GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
319 
333 GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
334 
348 GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
349 #endif
350 
351 #ifdef __cplusplus
352 }
353 #endif
354 
355 #endif /* _glfw3_native_h_ */
356 
HGLRC glfwGetWGLContext(GLFWwindow *window)
Returns the HGLRC of the specified window.
id glfwGetCocoaWindow(GLFWwindow *window)
Returns the NSWindow of the specified window.
EGLSurface glfwGetEGLSurface(GLFWwindow *window)
Returns the EGLSurface of the specified window.
const char * glfwGetWin32Monitor(GLFWmonitor *monitor)
Returns the display device name of the specified monitor.
CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor *monitor)
Returns the CGDirectDisplayID of the specified monitor.
RRCrtc glfwGetX11Adapter(GLFWmonitor *monitor)
Returns the RRCrtc of the specified monitor.
HWND glfwGetWin32Window(GLFWwindow *window)
Returns the HWND of the specified window.
id glfwGetNSGLContext(GLFWwindow *window)
Returns the NSOpenGLContext of the specified window.
EGLDisplay glfwGetEGLDisplay(void)
Returns the EGLDisplay used by GLFW.
Window glfwGetX11Window(GLFWwindow *window)
Returns the Window of the specified window.
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
Definition: glfw3.h:714
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:722
Display * glfwGetX11Display(void)
Returns the Display used by GLFW.
GLXContext glfwGetGLXContext(GLFWwindow *window)
Returns the GLXContext of the specified window.
EGLContext glfwGetEGLContext(GLFWwindow *window)
Returns the EGLContext of the specified window.
const char * glfwGetWin32Adapter(GLFWmonitor *monitor)
Returns the adapter device name of the specified monitor.
RROutput glfwGetX11Monitor(GLFWmonitor *monitor)
Returns the RROutput of the specified monitor.