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-2016 Camilla Berglund <elmindreda@glfw.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 
79 /*************************************************************************
80  * System headers and types
81  *************************************************************************/
82 
83 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
84  // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
85  // example to allow applications to correctly declare a GL_ARB_debug_output
86  // callback) but windows.h assumes no one will define APIENTRY before it does
87  #undef APIENTRY
88  #include <windows.h>
89 #elif defined(GLFW_EXPOSE_NATIVE_COCOA)
90  #include <ApplicationServices/ApplicationServices.h>
91  #if defined(__OBJC__)
92  #import <Cocoa/Cocoa.h>
93  #else
94  typedef void* id;
95  #endif
96 #elif defined(GLFW_EXPOSE_NATIVE_X11)
97  #include <X11/Xlib.h>
98  #include <X11/extensions/Xrandr.h>
99 #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
100  #include <wayland-client.h>
101 #elif defined(GLFW_EXPOSE_NATIVE_MIR)
102  #include <mir_toolkit/mir_client_library.h>
103 #endif
104 
105 #if defined(GLFW_EXPOSE_NATIVE_WGL)
106  /* WGL is declared by windows.h */
107 #endif
108 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
109  /* NSGL is declared by Cocoa.h */
110 #endif
111 #if defined(GLFW_EXPOSE_NATIVE_GLX)
112  #include <GL/glx.h>
113 #endif
114 #if defined(GLFW_EXPOSE_NATIVE_EGL)
115  #include <EGL/egl.h>
116 #endif
117 
118 
119 /*************************************************************************
120  * Functions
121  *************************************************************************/
122 
123 #if defined(GLFW_EXPOSE_NATIVE_WIN32)
124 
137 GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
138 
152 GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
153 
166 GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
167 #endif
168 
169 #if defined(GLFW_EXPOSE_NATIVE_WGL)
170 
182 GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
183 #endif
184 
185 #if defined(GLFW_EXPOSE_NATIVE_COCOA)
186 
198 GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
199 
212 GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
213 #endif
214 
215 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
216 
228 GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
229 #endif
230 
231 #if defined(GLFW_EXPOSE_NATIVE_X11)
232 
244 GLFWAPI Display* glfwGetX11Display(void);
245 
258 GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
259 
272 GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
273 
286 GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
287 #endif
288 
289 #if defined(GLFW_EXPOSE_NATIVE_GLX)
290 
302 GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
303 
316 GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
317 #endif
318 
319 #if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
320 
332 GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
333 
346 GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
347 
360 GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
361 #endif
362 
363 #if defined(GLFW_EXPOSE_NATIVE_MIR)
364 
376 GLFWAPI MirConnection* glfwGetMirDisplay(void);
377 
390 GLFWAPI int glfwGetMirMonitor(GLFWmonitor* monitor);
391 
404 GLFWAPI MirSurface* glfwGetMirWindow(GLFWwindow* window);
405 #endif
406 
407 #if defined(GLFW_EXPOSE_NATIVE_EGL)
408 
420 GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
421 
434 GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
435 
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.
MirSurface * glfwGetMirWindow(GLFWwindow *window)
Returns the MirSurface* 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.
MirConnection * glfwGetMirDisplay(void)
Returns the MirConnection* used by GLFW.
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:787
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:799
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.
GLXWindow glfwGetGLXWindow(GLFWwindow *window)
Returns the GLXWindow of the specified window.
struct wl_output * glfwGetWaylandMonitor(GLFWmonitor *monitor)
Returns the struct wl_output* of the specified monitor.
struct wl_display * glfwGetWaylandDisplay(void)
Returns the struct wl_display* used by GLFW.
RROutput glfwGetX11Monitor(GLFWmonitor *monitor)
Returns the RROutput of the specified monitor.
int glfwGetMirMonitor(GLFWmonitor *monitor)
Returns the Mir output ID of the specified monitor.
struct wl_surface * glfwGetWaylandWindow(GLFWwindow *window)
Returns the main struct wl_surface* of the specified window.