glfw3native.h
Go to the documentation of this file.
1/*************************************************************************
2 * GLFW 3.4 - www.glfw.org
3 * A library for OpenGL, window and input
4 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
6 * Copyright (c) 2006-2018 Camilla Löwy <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
33extern "C" {
34#endif
35
36
37/*************************************************************************
38 * Doxygen documentation
39 *************************************************************************/
40
80/*************************************************************************
81 * System headers and types
82 *************************************************************************/
83
84#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
85 // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
86 // example to allow applications to correctly declare a GL_KHR_debug callback)
87 // but windows.h assumes no one will define APIENTRY before it does
88 #if defined(GLFW_APIENTRY_DEFINED)
89 #undef APIENTRY
90 #undef GLFW_APIENTRY_DEFINED
91 #endif
92 #include <windows.h>
93#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
94 #if defined(__OBJC__)
95 #import <Cocoa/Cocoa.h>
96 #else
97 #include <ApplicationServices/ApplicationServices.h>
98 typedef void* id;
99 #endif
100#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
101 #include <X11/Xlib.h>
102 #include <X11/extensions/Xrandr.h>
103#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
104 #include <wayland-client.h>
105#endif
106
107#if defined(GLFW_EXPOSE_NATIVE_WGL)
108 /* WGL is declared by windows.h */
109#endif
110#if defined(GLFW_EXPOSE_NATIVE_NSGL)
111 /* NSGL is declared by Cocoa.h */
112#endif
113#if defined(GLFW_EXPOSE_NATIVE_GLX)
114 #include <GL/glx.h>
115#endif
116#if defined(GLFW_EXPOSE_NATIVE_EGL)
117 #include <EGL/egl.h>
118#endif
119#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
120 #include <GL/osmesa.h>
121#endif
122
123
124/*************************************************************************
125 * Functions
126 *************************************************************************/
127
128#if defined(GLFW_EXPOSE_NATIVE_WIN32)
144GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
145
161GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
162
185GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
186#endif
187
188#if defined(GLFW_EXPOSE_NATIVE_WGL)
212GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
213#endif
214
215#if defined(GLFW_EXPOSE_NATIVE_COCOA)
230GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
231
246GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
247#endif
248
249#if defined(GLFW_EXPOSE_NATIVE_NSGL)
265GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
266#endif
267
268#if defined(GLFW_EXPOSE_NATIVE_X11)
283GLFWAPI Display* glfwGetX11Display(void);
284
299GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
300
315GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
316
331GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
332
353GLFWAPI void glfwSetX11SelectionString(const char* string);
354
381GLFWAPI const char* glfwGetX11SelectionString(void);
382#endif
383
384#if defined(GLFW_EXPOSE_NATIVE_GLX)
400GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
401
417GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
418#endif
419
420#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
435GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
436
451GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
452
467GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
468#endif
469
470#if defined(GLFW_EXPOSE_NATIVE_EGL)
485GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
486
502GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
503
519GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
520#endif
521
522#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
545GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
546
569GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
570
586GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
587#endif
588
589#ifdef __cplusplus
590}
591#endif
592
593#endif /* _glfw3_native_h_ */
594
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
Definition: glfw3.h:1351
RRCrtc glfwGetX11Adapter(GLFWmonitor *monitor)
Returns the RRCrtc of the specified monitor.
EGLDisplay glfwGetEGLDisplay(void)
Returns the EGLDisplay used by GLFW.
GLXWindow glfwGetGLXWindow(GLFWwindow *window)
Returns the GLXWindow of the specified window.
EGLSurface glfwGetEGLSurface(GLFWwindow *window)
Returns the EGLSurface of the specified window.
int glfwGetOSMesaColorBuffer(GLFWwindow *window, int *width, int *height, int *format, void **buffer)
Retrieves the color buffer associated with the specified window.
struct wl_output * glfwGetWaylandMonitor(GLFWmonitor *monitor)
Returns the struct wl_output* of the specified monitor.
id glfwGetNSGLContext(GLFWwindow *window)
Returns the NSOpenGLContext of the specified window.
void glfwSetX11SelectionString(const char *string)
Sets the current primary selection to the specified string.
struct wl_surface * glfwGetWaylandWindow(GLFWwindow *window)
Returns the main struct wl_surface* of the specified window.
GLXContext glfwGetGLXContext(GLFWwindow *window)
Returns the GLXContext of the specified window.
EGLContext glfwGetEGLContext(GLFWwindow *window)
Returns the EGLContext of the specified window.
int glfwGetOSMesaDepthBuffer(GLFWwindow *window, int *width, int *height, int *bytesPerValue, void **buffer)
Retrieves the depth buffer associated with the specified window.
Display * glfwGetX11Display(void)
Returns the Display used by GLFW.
Window glfwGetX11Window(GLFWwindow *window)
Returns the Window of the specified window.
OSMesaContext glfwGetOSMesaContext(GLFWwindow *window)
Returns the OSMesaContext of the specified window.
RROutput glfwGetX11Monitor(GLFWmonitor *monitor)
Returns the RROutput of the specified monitor.
id glfwGetCocoaWindow(GLFWwindow *window)
Returns the NSWindow of the specified window.
const char * glfwGetWin32Monitor(GLFWmonitor *monitor)
Returns the display device name of the specified monitor.
struct wl_display * glfwGetWaylandDisplay(void)
Returns the struct wl_display* used by GLFW.
const char * glfwGetWin32Adapter(GLFWmonitor *monitor)
Returns the adapter device name of the specified monitor.
HGLRC glfwGetWGLContext(GLFWwindow *window)
Returns the HGLRC of the specified window.
const char * glfwGetX11SelectionString(void)
Returns the contents of the current primary selection as a string.
CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor *monitor)
Returns the CGDirectDisplayID of the specified monitor.
HWND glfwGetWin32Window(GLFWwindow *window)
Returns the HWND of the specified window.
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1363