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 specified"
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 specified"
103 #endif
104 
105 
106 /*************************************************************************
107  * Functions
108  *************************************************************************/
109 
110 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
111 
125 GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
126 
140 GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
141 #endif
142 
143 #if defined(GLFW_EXPOSE_NATIVE_WGL)
144 
157 GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
158 #endif
159 
160 #if defined(GLFW_EXPOSE_NATIVE_COCOA)
161 
174 GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
175 
189 GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
190 #endif
191 
192 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
193 
206 GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
207 #endif
208 
209 #if defined(GLFW_EXPOSE_NATIVE_X11)
210 
223 GLFWAPI Display* glfwGetX11Display(void);
224 
238 GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
239 
253 GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
254 #endif
255 
256 #if defined(GLFW_EXPOSE_NATIVE_GLX)
257 
270 GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
271 #endif
272 
273 #if defined(GLFW_EXPOSE_NATIVE_EGL)
274 
287 GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
288 
302 GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
303 
317 GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
318 #endif
319 
320 #ifdef __cplusplus
321 }
322 #endif
323 
324 #endif /* _glfw3_native_h_ */
325 
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.
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:700
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:708
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.
RROutput glfwGetX11Monitor(GLFWmonitor *monitor)
Returns the RROutput of the specified monitor.