glfw3native.h
Go to the documentation of this file.
1 /*************************************************************************
2  * GLFW 3.2 - 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 
71 /*************************************************************************
72  * System headers and types
73  *************************************************************************/
74 
75 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
76  // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
77  // example to allow applications to correctly declare a GL_ARB_debug_output
78  // callback) but windows.h assumes no one will define APIENTRY before it does
79  #undef APIENTRY
80  #include <windows.h>
81 #elif defined(GLFW_EXPOSE_NATIVE_COCOA)
82  #include <ApplicationServices/ApplicationServices.h>
83  #if defined(__OBJC__)
84  #import <Cocoa/Cocoa.h>
85  #else
86  typedef void* id;
87  #endif
88 #elif defined(GLFW_EXPOSE_NATIVE_X11)
89  #include <X11/Xlib.h>
90  #include <X11/extensions/Xrandr.h>
91 #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
92  #include <wayland-client.h>
93 #elif defined(GLFW_EXPOSE_NATIVE_MIR)
94  #include <mir_toolkit/mir_client_library.h>
95 #else
96  #error "No window API selected"
97 #endif
98 
99 #if defined(GLFW_EXPOSE_NATIVE_WGL)
100  /* WGL is declared by windows.h */
101 #elif defined(GLFW_EXPOSE_NATIVE_NSGL)
102  /* NSGL is declared by Cocoa.h */
103 #elif defined(GLFW_EXPOSE_NATIVE_GLX)
104  #include <GL/glx.h>
105 #elif defined(GLFW_EXPOSE_NATIVE_EGL)
106  #include <EGL/egl.h>
107 #else
108  #error "No context API selected"
109 #endif
110 
111 
112 /*************************************************************************
113  * Functions
114  *************************************************************************/
115 
116 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
117 
131 GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
132 
147 GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
148 
162 GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
163 #endif
164 
165 #if defined(GLFW_EXPOSE_NATIVE_WGL)
166 
179 GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
180 #endif
181 
182 #if defined(GLFW_EXPOSE_NATIVE_COCOA)
183 
196 GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
197 
211 GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
212 #endif
213 
214 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
215 
228 GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
229 #endif
230 
231 #if defined(GLFW_EXPOSE_NATIVE_X11)
232 
245 GLFWAPI Display* glfwGetX11Display(void);
246 
260 GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
261 
275 GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
276 
290 GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
291 #endif
292 
293 #if defined(GLFW_EXPOSE_NATIVE_GLX)
294 
307 GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
308 #endif
309 
310 #if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
311 
324 GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
325 
339 GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
340 
354 GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
355 #endif
356 
357 #if defined(GLFW_EXPOSE_NATIVE_MIR)
358 
371 GLFWAPI MirConnection* glfwGetMirDisplay(void);
372 
386 GLFWAPI int glfwGetMirMonitor(GLFWmonitor* monitor);
387 
401 GLFWAPI MirSurface* glfwGetMirWindow(GLFWwindow* window);
402 #endif
403 
404 #if defined(GLFW_EXPOSE_NATIVE_EGL)
405 
418 GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
419 
433 GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
434 
448 GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
449 #endif
450 
451 #ifdef __cplusplus
452 }
453 #endif
454 
455 #endif /* _glfw3_native_h_ */
456 
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:732
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:740
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.