Initial commit

This commit is contained in:
Ben Cottrell 2015-11-11 01:55:09 +13:00
parent 27462c1078
commit a388f6e6bc
95 changed files with 16363 additions and 5939 deletions

View File

@ -9,8 +9,8 @@ if (NOT CMAKE_VERSION VERSION_LESS "3.0")
endif()
set(GLFW_VERSION_MAJOR "3")
set(GLFW_VERSION_MINOR "2")
set(GLFW_VERSION_PATCH "0")
set(GLFW_VERSION_MINOR "1")
set(GLFW_VERSION_PATCH "2")
set(GLFW_VERSION_EXTRA "")
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
@ -30,6 +30,7 @@ if (WIN32)
endif()
if (APPLE)
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
option(GLFW_USE_CHDIR "Make glfwInit chdir to Contents/Resources" ON)
option(GLFW_USE_MENUBAR "Populate the menu bar on first window creation" ON)
option(GLFW_USE_RETINA "Use the full resolution of Retina displays" ON)
@ -58,6 +59,39 @@ endif()
set(CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
if (GLFW_USE_EGL)
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
"The client library to use; one of opengl, glesv1 or glesv2")
if (${GLFW_CLIENT_LIBRARY} STREQUAL "opengl")
set(_GLFW_USE_OPENGL 1)
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv1")
set(_GLFW_USE_GLESV1 1)
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv2")
set(_GLFW_USE_GLESV2 1)
else()
message(FATAL_ERROR "Unsupported client library")
endif()
find_package(EGL REQUIRED)
if (NOT _GLFW_USE_OPENGL)
set(GLFW_BUILD_EXAMPLES OFF)
set(GLFW_BUILD_TESTS OFF)
message(STATUS "NOTE: Examples and tests require OpenGL")
endif()
else()
set(_GLFW_USE_OPENGL 1)
endif()
if (_GLFW_USE_OPENGL)
find_package(OpenGL REQUIRED)
elseif (_GLFW_USE_GLESV1)
find_package(GLESv1 REQUIRED)
elseif (_GLFW_USE_GLESV2)
find_package(GLESv2 REQUIRED)
endif()
find_package(Threads REQUIRED)
if (GLFW_BUILD_DOCS)
@ -85,10 +119,10 @@ if (MSVC)
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
foreach (flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO)
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO)
if (${flag} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
@ -192,11 +226,6 @@ if (UNIX AND NOT APPLE)
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lm")
endif()
if (CMAKE_DL_LIBS)
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
endif()
endif()
#--------------------------------------------------------------------
@ -211,6 +240,17 @@ if (_GLFW_WIN32)
endif()
endif()
#--------------------------------------------------------------------
# Use WGL for context creation
#--------------------------------------------------------------------
if (_GLFW_WGL)
list(APPEND glfw_PKG_LIBS "-lopengl32")
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
endif()
#--------------------------------------------------------------------
# Use X11 for window creation
#--------------------------------------------------------------------
@ -322,6 +362,53 @@ if (_GLFW_MIR)
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
endif()
#--------------------------------------------------------------------
# Use GLX for context creation
#--------------------------------------------------------------------
if (_GLFW_GLX)
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
list(APPEND glfw_PKG_DEPS "gl")
if (CMAKE_DL_LIBS)
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
endif()
endif()
#--------------------------------------------------------------------
# Use EGL for context creation
#--------------------------------------------------------------------
if (_GLFW_EGL)
list(APPEND glfw_INCLUDE_DIRS "${EGL_INCLUDE_DIR}")
list(APPEND glfw_LIBRARIES "${EGL_LIBRARY}")
list(APPEND glfw_PKG_DEPS "egl")
if (_GLFW_USE_OPENGL)
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}")
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}")
list(APPEND glfw_PKG_DEPS "gl")
elseif (_GLFW_USE_GLESV1)
list(APPEND glfw_LIBRARIES "${GLESv1_LIBRARY}")
list(APPEND glfw_INCLUDE_DIRS "${GLESv1_INCLUDE_DIR}")
list(APPEND glfw_PKG_DEPS "glesv1_cm")
elseif (_GLFW_USE_GLESV2)
list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}")
list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}")
list(APPEND glfw_PKG_DEPS "glesv2")
endif()
if (CMAKE_DL_LIBS)
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
endif()
endif()
#--------------------------------------------------------------------
# Use Cocoa for window creation and NSOpenGL for context creation
#--------------------------------------------------------------------
@ -339,25 +426,30 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
set(_GLFW_USE_RETINA 1)
endif()
if (GLFW_BUILD_UNIVERSAL)
message(STATUS "Building GLFW as Universal Binaries")
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
else()
message(STATUS "Building GLFW only for the native architecture")
endif()
# Set up library and include paths
find_library(COCOA_FRAMEWORK Cocoa)
find_library(IOKIT_FRAMEWORK IOKit)
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
find_library(CORE_VIDEO_FRAMEWORK CoreVideo)
find_library(CARBON_FRAMEWORK Carbon)
mark_as_advanced(COCOA_FRAMEWORK
IOKIT_FRAMEWORK
CORE_FOUNDATION_FRAMEWORK
CORE_VIDEO_FRAMEWORK
CARBON_FRAMEWORK)
CORE_VIDEO_FRAMEWORK)
list(APPEND glfw_LIBRARIES "${COCOA_FRAMEWORK}"
"${OPENGL_gl_LIBRARY}"
"${IOKIT_FRAMEWORK}"
"${CORE_FOUNDATION_FRAMEWORK}"
"${CORE_VIDEO_FRAMEWORK}"
"${CARBON_FRAMEWORK}")
"${CORE_VIDEO_FRAMEWORK}")
set(glfw_PKG_DEPS "")
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo -framework Carbon")
set(glfw_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo")
endif()
#--------------------------------------------------------------------

View File

@ -1,12 +1,20 @@
# GLFW
## Author Note
I have implemented the WM_COMMAND message in the WindowProc function within
win32window.c and added a user defined callback function. The WM_COMMAND message
is usually triggered by Menu items in a window.
## Introduction
GLFW is a free, Open Source, multi-platform library for OpenGL and OpenGL ES
application development. It provides a simple, platform-independent API for
creating windows and contexts, reading input, handling events, etc.
Version 3.2 is _not yet described_.
Version 3.1.2 adds fixes for a large number of bugs that together affect all
supported platforms, as well as dynamic loading work that simplifies compilation
and linking.
If you are new to GLFW, you may find the
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
@ -14,6 +22,9 @@ If you are new to GLFW, you may find the
[transition guide](http://www.glfw.org/docs/latest/moving.html) for moving to
the GLFW 3 API.
Note that a number of source files have been added or renamed in 3.1, which may
require you to update any custom build files you have.
## Compiling GLFW
@ -45,13 +56,10 @@ This will help both us and other people experiencing the same bug.
## Dependencies
GLFW itself needs only the headers and libraries for your window system. It
does not need the headers for any context creation API (WGL, GLX, EGL, NSGL) or
client API (OpenGL, OpenGL ES) to enable support for them.
GLFW bundles a number of dependencies in the `deps/` directory. These are only
used by the tests and examples and are not required to build the library.
GLFW bundles a number of dependencies in the `deps/` directory.
- [Khronos extension headers](https://www.opengl.org/registry/) for API
extension symbols used by GLFW
- [getopt\_port](https://github.com/kimgr/getopt_port/) for examples
with command-line options
- [TinyCThread](https://github.com/tinycthread/tinycthread) for threaded
@ -64,24 +72,63 @@ used by the tests and examples and are not required to build the library.
## Changelog
- Added `glfwSetWindowSizeLimits` and `glfwSetWindowAspectRatio` for setting
absolute and relative window size limits
- Added `glfwGetKeyName` for querying the layout-specific name of printable
keys
- Added `GLFW_NO_API` for creating window without contexts
- Added `GLFW_CONTEXT_NO_ERROR` context hint for `GL_KHR_no_error` support
- Added `GLFW_TRUE` and `GLFW_FALSE` as client API independent boolean values
- Added `glfwGetGLXWindow` to query the `GLXWindow` of a window
- Removed dependency on external OpenGL or OpenGL ES headers
- [Win32] Added support for Windows 8.1 per-monitor DPI
- [Cocoa] Removed support for OS X 10.6
- [X11] Bugfix: Monitor connection and disconnection events were not reported
- [X11] Bugfix: Decoding of UTF-8 text from XIM could continue past the end
- [POSIX] Bugfix: An unrelated TLS key could be deleted by `glfwTerminate`
- [WGL] Removed dependency on external WGL headers
- [GLX] Replaced legacy renderable with `GLXWindow`
- [GLX] Removed dependency on external GLX headers
- [EGL] Removed dependency on external EGL headers
- Made all client API functions dynamically loaded
- Changed minimum required CMake version to 2.8.12
- Replaced GLU with [linmath.h](https://github.com/datenwolf/linmath.h) in
example programs
- Merged all cursor test programs into the `cursor` program
- Removed all mention of GLU in examples, build files and package dependencies
- Bugfix: Initialization failed on headless systems
- Bugfix: The cached current context could get out of sync
- Bugfix: `glfwIconifyWindow` did not restore the original video mode for full
screen windows created with `GLFW_AUTO_ICONIFY`
- [Win32] Renamed hybrid GPU override compile-time option to
`_GLFW_USE_HYBRID_HPG` and added support for AMD PowerXpress systems
- [Win32] Bugfix: `glfwGetVideoModes` included unusable modes on some systems
- [Win32] Bugfix: `glfwWaitEvents` would return directly for focused windows in
disabled cursor mode
- [Cocoa] Bugfix: The cached `NSScreen` for a monitor could get out of sync
- [Cocoa] Bugfix: The `GLFW_AUTO_ICONIFY` window hint was ignored
- [Cocoa] Bugfix: Resizing a window to its minimum size would segfault
- [Cocoa] Bugfix: Creating or showing a window would make its context current
- [Cocoa] Bugfix: Joysticks connected after `glfwInit` were not detected
- [Cocoa] Bugfix: Cursor creation failed unless a window had been created.
- [Cocoa] Bugfix: Window refresh events were not generated by iconification or
restoration
- [Cocoa] Bugfix: The primary monitor would get reported as disconnected when
entering full screen on a dual-GPU machine with automatic
graphics switching
- [Cocoa] Bugfix: The original video modes were not restored when the
application was hidden
- [X11] Bugfix: `glfwInit` would segfault on systems without RandR
- [X11] Bugfix: The response to `_NET_WM_PING` was sent to the wrong window
- [X11] Bugfix: Character input via XIM did not work in many cases
- [X11] Bugfix: No fallback existed for missing `_NET_ACTIVE_WINDOW` support
- [X11] Bugfix: Some significant window focus events were ignored
- [X11] Bugfix: The `GLFW_AUTO_ICONIFY` window hint was ignored
- [X11] Bugfix: The original video mode was not restored on iconification of
full screen windows
- [X11] Bugfix: `GLFW_ARROW_CURSOR` selected the wrong cursor image
- [X11] Bugfix: The `GLFW_DECORATED` hint was not ignored for full screen
- [X11] Bugfix: `glfwWaitEvents` did not handle `EINTR` for `select`
- [X11] Bugfix: `glfwWaitEvents` could return when no events were available
- [X11] Bugfix: `XkbGetKeyboard` fails on XWayland
- [X11] Bugfix: Character input did not work correctly for non-UTF-8 locales
- [X11] Bugfix: Long input sequences generated by IMEs were discarded
- [WGL] Made all WGL functions dynamically loaded
- [WGL] Removed `GLFW_USE_DWM_SWAP_INTERVAL` compile-time option
- [WGL] Bugfix: Swap interval was ignored when DWM was enabled
- [WGL] Bugfix: Failure to find a pixel format was reported incorrectly
- [GLX] Added dependency on `libdl` on systems where it provides `dlopen`
- [GLX] Made all GLX functions dynamically loaded
- [GLX] Removed `_GLFW_HAS_GLXGETPROCADDRESS*` and `_GLFW_HAS_DLOPEN`
compile-time options
- [GLX] Bugfix: Failure to find a `GLXFBConfig` was reported incorrectly
- [EGL] Made all EGL functions dynamically loaded
- [EGL] Bugfix: `glfwGetProcAddress` did not return the addresses of core
functions
- [EGL] Bugfix: Failure to find an `EGLConfig` was reported incorrectly
- [NSGL] Bugfix: Failure to find a pixel format was reported incorrectly
## Contact
@ -126,7 +173,6 @@ skills.
- Olivier Delannoy
- Paul R. Deppe
- Michael Dickens
- Роман Донченко
- Jonathan Dummer
- Ralph Eastwood
- Siavash Eliasi
@ -215,3 +261,4 @@ skills.
- All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement
=======

565
deps/EGL/eglext.h vendored Normal file
View File

@ -0,0 +1,565 @@
#ifndef __eglext_h_
#define __eglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2013 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
#include <EGL/eglplatform.h>
/*************************************************************/
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
/* $Revision: 20690 $ on $Date: 2013-02-22 17:15:05 -0800 (Fri, 22 Feb 2013) $ */
#define EGL_EGLEXT_VERSION 15
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
#endif
#ifndef EGL_KHR_lock_surface
#define EGL_KHR_lock_surface 1
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
#endif
#ifndef EGL_KHR_image
#define EGL_KHR_image 1
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
typedef void *EGLImageKHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
#endif
#ifndef EGL_KHR_vg_parent_image
#define EGL_KHR_vg_parent_image 1
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_2D_image
#define EGL_KHR_gl_texture_2D_image 1
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_texture_cubemap_image
#define EGL_KHR_gl_texture_cubemap_image 1
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_3D_image
#define EGL_KHR_gl_texture_3D_image 1
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_renderbuffer_image
#define EGL_KHR_gl_renderbuffer_image 1
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
#ifndef EGL_KHR_reusable_sync
#define EGL_KHR_reusable_sync 1
typedef void* EGLSyncKHR;
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
#define EGL_SYNC_STATUS_KHR 0x30F1
#define EGL_SIGNALED_KHR 0x30F2
#define EGL_UNSIGNALED_KHR 0x30F3
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
#define EGL_SYNC_TYPE_KHR 0x30F7
#define EGL_SYNC_REUSABLE_KHR 0x30FA
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif
#endif
#ifndef EGL_KHR_image_base
#define EGL_KHR_image_base 1
/* Most interfaces defined by EGL_KHR_image_pixmap above */
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_image_pixmap
#define EGL_KHR_image_pixmap 1
/* Interfaces defined by EGL_KHR_image above */
#endif
#ifndef EGL_IMG_context_priority
#define EGL_IMG_context_priority 1
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
#endif
#ifndef EGL_KHR_lock_surface2
#define EGL_KHR_lock_surface2 1
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
#endif
#ifndef EGL_NV_coverage_sample
#define EGL_NV_coverage_sample 1
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
#endif
#ifndef EGL_NV_depth_nonlinear
#define EGL_NV_depth_nonlinear 1
#define EGL_DEPTH_ENCODING_NV 0x30E2
#define EGL_DEPTH_ENCODING_NONE_NV 0
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
#ifndef EGL_NV_sync
#define EGL_NV_sync 1
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
#define EGL_SYNC_STATUS_NV 0x30E7
#define EGL_SIGNALED_NV 0x30E8
#define EGL_UNSIGNALED_NV 0x30E9
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
#define EGL_ALREADY_SIGNALED_NV 0x30EA
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
#define EGL_CONDITION_SATISFIED_NV 0x30EC
#define EGL_SYNC_TYPE_NV 0x30ED
#define EGL_SYNC_CONDITION_NV 0x30EE
#define EGL_SYNC_FENCE_NV 0x30EF
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
typedef void* EGLSyncNV;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
#ifndef EGL_KHR_fence_sync
#define EGL_KHR_fence_sync 1
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
#define EGL_SYNC_CONDITION_KHR 0x30F8
#define EGL_SYNC_FENCE_KHR 0x30F9
#endif
#endif
#ifndef EGL_HI_clientpixmap
#define EGL_HI_clientpixmap 1
/* Surface Attribute */
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
/*
* Structure representing a client pixmap
* (pixmap's data is in client-space memory).
*/
struct EGLClientPixmapHI
{
void* pData;
EGLint iWidth;
EGLint iHeight;
EGLint iStride;
};
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_HI_clientpixmap */
#ifndef EGL_HI_colorformats
#define EGL_HI_colorformats 1
/* Config Attribute */
#define EGL_COLOR_FORMAT_HI 0x8F70
/* Color Formats */
#define EGL_COLOR_RGB_HI 0x8F71
#define EGL_COLOR_RGBA_HI 0x8F72
#define EGL_COLOR_ARGB_HI 0x8F73
#endif /* EGL_HI_colorformats */
#ifndef EGL_MESA_drm_image
#define EGL_MESA_drm_image 1
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#endif
#ifndef EGL_NV_post_sub_buffer
#define EGL_NV_post_sub_buffer 1
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
#endif
#ifndef EGL_ANGLE_query_surface_pointer
#define EGL_ANGLE_query_surface_pointer 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
#endif
#ifndef EGL_NV_coverage_sample_resolve
#define EGL_NV_coverage_sample_resolve 1
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
typedef khronos_utime_nanoseconds_t EGLuint64NV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
#ifndef EGL_KHR_stream
#define EGL_KHR_stream 1
typedef void* EGLStreamKHR;
typedef khronos_uint64_t EGLuint64KHR;
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
#define EGL_PRODUCER_FRAME_KHR 0x3212
#define EGL_CONSUMER_FRAME_KHR 0x3213
#define EGL_STREAM_STATE_KHR 0x3214
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
#define EGL_BAD_STREAM_KHR 0x321B
#define EGL_BAD_STATE_KHR 0x321C
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_consumer_gltexture
#define EGL_KHR_stream_consumer_gltexture 1
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_eglsurface
#define EGL_KHR_stream_producer_eglsurface 1
#define EGL_STREAM_BIT_KHR 0x0800
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_aldatalocator
#define EGL_KHR_stream_producer_aldatalocator 1
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_fifo
#define EGL_KHR_stream_fifo 1
/* reuse EGLTimeKHR */
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif
#endif
#ifndef EGL_EXT_create_context_robustness
#define EGL_EXT_create_context_robustness 1
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
#endif
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
#endif
#ifndef EGL_KHR_create_context
#define EGL_KHR_create_context 1
#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
#endif
#ifndef EGL_KHR_surfaceless_context
#define EGL_KHR_surfaceless_context 1
/* No tokens/entry points, just relaxes an error condition */
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_cross_process_fd
#define EGL_KHR_stream_cross_process_fd 1
typedef int EGLNativeFileDescriptorKHR;
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#endif
#endif
#ifndef EGL_EXT_multiview_window
#define EGL_EXT_multiview_window 1
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
#endif
#ifndef EGL_KHR_wait_sync
#define EGL_KHR_wait_sync 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
#endif
#ifndef EGL_NV_post_convert_rounding
#define EGL_NV_post_convert_rounding 1
/* No tokens or entry points, just relaxes behavior of SwapBuffers */
#endif
#ifndef EGL_NV_native_query
#define EGL_NV_native_query 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
#endif
#ifndef EGL_NV_3dvision_surface
#define EGL_NV_3dvision_surface 1
#define EGL_AUTO_STEREO_NV 0x3136
#endif
#ifndef EGL_ANDROID_framebuffer_target
#define EGL_ANDROID_framebuffer_target 1
#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
#endif
#ifndef EGL_ANDROID_blob_cache
#define EGL_ANDROID_blob_cache 1
typedef khronos_ssize_t EGLsizeiANDROID;
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#endif
#ifndef EGL_ANDROID_image_native_buffer
#define EGL_ANDROID_image_native_buffer 1
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
#endif
#ifndef EGL_ANDROID_native_fence_sync
#define EGL_ANDROID_native_fence_sync 1
#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
#endif
#ifndef EGL_ANDROID_recordable
#define EGL_ANDROID_recordable 1
#define EGL_RECORDABLE_ANDROID 0x3142
#endif
#ifndef EGL_EXT_buffer_age
#define EGL_EXT_buffer_age 1
#define EGL_BUFFER_AGE_EXT 0x313D
#endif
#ifndef EGL_EXT_image_dma_buf_import
#define EGL_EXT_image_dma_buf_import 1
#define EGL_LINUX_DMA_BUF_EXT 0x3270
#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
#define EGL_ITU_REC601_EXT 0x327F
#define EGL_ITU_REC709_EXT 0x3280
#define EGL_ITU_REC2020_EXT 0x3281
#define EGL_YUV_FULL_RANGE_EXT 0x3282
#define EGL_YUV_NARROW_RANGE_EXT 0x3283
#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
#endif
#ifdef __cplusplus
}
#endif
#endif /* __eglext_h_ */

11626
deps/GL/glext.h vendored Normal file

File diff suppressed because it is too large Load Diff

906
deps/GL/glxext.h vendored Normal file
View File

@ -0,0 +1,906 @@
#ifndef __glxext_h_
#define __glxext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/*
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 27684 $ on $Date: 2014-08-11 01:21:35 -0700 (Mon, 11 Aug 2014) $
*/
#define GLX_GLXEXT_VERSION 20140810
/* Generated C header for:
* API: glx
* Versions considered: .*
* Versions emitted: 1\.[3-9]
* Default extensions included: glx
* Additional extensions included: _nomatch_^
* Extensions removed: _nomatch_^
*/
#ifndef GLX_VERSION_1_3
#define GLX_VERSION_1_3 1
typedef XID GLXContextID;
typedef struct __GLXFBConfigRec *GLXFBConfig;
typedef XID GLXWindow;
typedef XID GLXPbuffer;
#define GLX_WINDOW_BIT 0x00000001
#define GLX_PIXMAP_BIT 0x00000002
#define GLX_PBUFFER_BIT 0x00000004
#define GLX_RGBA_BIT 0x00000001
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
#define GLX_AUX_BUFFERS_BIT 0x00000010
#define GLX_DEPTH_BUFFER_BIT 0x00000020
#define GLX_STENCIL_BUFFER_BIT 0x00000040
#define GLX_ACCUM_BUFFER_BIT 0x00000080
#define GLX_CONFIG_CAVEAT 0x20
#define GLX_X_VISUAL_TYPE 0x22
#define GLX_TRANSPARENT_TYPE 0x23
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
#define GLX_TRANSPARENT_RED_VALUE 0x25
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
#define GLX_DONT_CARE 0xFFFFFFFF
#define GLX_NONE 0x8000
#define GLX_SLOW_CONFIG 0x8001
#define GLX_TRUE_COLOR 0x8002
#define GLX_DIRECT_COLOR 0x8003
#define GLX_PSEUDO_COLOR 0x8004
#define GLX_STATIC_COLOR 0x8005
#define GLX_GRAY_SCALE 0x8006
#define GLX_STATIC_GRAY 0x8007
#define GLX_TRANSPARENT_RGB 0x8008
#define GLX_TRANSPARENT_INDEX 0x8009
#define GLX_VISUAL_ID 0x800B
#define GLX_SCREEN 0x800C
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_X_RENDERABLE 0x8012
#define GLX_FBCONFIG_ID 0x8013
#define GLX_RGBA_TYPE 0x8014
#define GLX_COLOR_INDEX_TYPE 0x8015
#define GLX_MAX_PBUFFER_WIDTH 0x8016
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
#define GLX_MAX_PBUFFER_PIXELS 0x8018
#define GLX_PRESERVED_CONTENTS 0x801B
#define GLX_LARGEST_PBUFFER 0x801C
#define GLX_WIDTH 0x801D
#define GLX_HEIGHT 0x801E
#define GLX_EVENT_MASK 0x801F
#define GLX_DAMAGED 0x8020
#define GLX_SAVED 0x8021
#define GLX_WINDOW 0x8022
#define GLX_PBUFFER 0x8023
#define GLX_PBUFFER_HEIGHT 0x8040
#define GLX_PBUFFER_WIDTH 0x8041
typedef GLXFBConfig *( *PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
typedef GLXFBConfig *( *PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef int ( *PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
typedef GLXWindow ( *PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
typedef void ( *PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
typedef GLXPixmap ( *PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef void ( *PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
typedef GLXPbuffer ( *PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void ( *PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
typedef void ( *PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
typedef GLXContext ( *PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef Bool ( *PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
typedef int ( *PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
typedef void ( *PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
typedef void ( *PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXFBConfig *glXGetFBConfigs (Display *dpy, int screen, int *nelements);
GLXFBConfig *glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
void glXDestroyWindow (Display *dpy, GLXWindow win);
GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
GLXDrawable glXGetCurrentReadDrawable (void);
int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
#endif
#endif /* GLX_VERSION_1_3 */
#ifndef GLX_VERSION_1_4
#define GLX_VERSION_1_4 1
typedef void ( *__GLXextFuncPtr)(void);
#define GLX_SAMPLE_BUFFERS 100000
#define GLX_SAMPLES 100001
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
#ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
#endif
#endif /* GLX_VERSION_1_4 */
#ifndef GLX_ARB_context_flush_control
#define GLX_ARB_context_flush_control 1
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#endif /* GLX_ARB_context_flush_control */
#ifndef GLX_ARB_create_context
#define GLX_ARB_create_context 1
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
#define GLX_CONTEXT_FLAGS_ARB 0x2094
typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
#endif
#endif /* GLX_ARB_create_context */
#ifndef GLX_ARB_create_context_profile
#define GLX_ARB_create_context_profile 1
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
#endif /* GLX_ARB_create_context_profile */
#ifndef GLX_ARB_create_context_robustness
#define GLX_ARB_create_context_robustness 1
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
#endif /* GLX_ARB_create_context_robustness */
#ifndef GLX_ARB_fbconfig_float
#define GLX_ARB_fbconfig_float 1
#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
#endif /* GLX_ARB_fbconfig_float */
#ifndef GLX_ARB_framebuffer_sRGB
#define GLX_ARB_framebuffer_sRGB 1
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
#endif /* GLX_ARB_framebuffer_sRGB */
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
#ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#endif
#endif /* GLX_ARB_get_proc_address */
#ifndef GLX_ARB_multisample
#define GLX_ARB_multisample 1
#define GLX_SAMPLE_BUFFERS_ARB 100000
#define GLX_SAMPLES_ARB 100001
#endif /* GLX_ARB_multisample */
#ifndef GLX_ARB_robustness_application_isolation
#define GLX_ARB_robustness_application_isolation 1
#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
#endif /* GLX_ARB_robustness_application_isolation */
#ifndef GLX_ARB_robustness_share_group_isolation
#define GLX_ARB_robustness_share_group_isolation 1
#endif /* GLX_ARB_robustness_share_group_isolation */
#ifndef GLX_ARB_vertex_buffer_object
#define GLX_ARB_vertex_buffer_object 1
#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
#endif /* GLX_ARB_vertex_buffer_object */
#ifndef GLX_3DFX_multisample
#define GLX_3DFX_multisample 1
#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
#define GLX_SAMPLES_3DFX 0x8051
#endif /* GLX_3DFX_multisample */
#ifndef GLX_AMD_gpu_association
#define GLX_AMD_gpu_association 1
#define GLX_GPU_VENDOR_AMD 0x1F00
#define GLX_GPU_RENDERER_STRING_AMD 0x1F01
#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define GLX_GPU_RAM_AMD 0x21A3
#define GLX_GPU_CLOCK_AMD 0x21A4
#define GLX_GPU_NUM_PIPES_AMD 0x21A5
#define GLX_GPU_NUM_SIMD_AMD 0x21A6
#define GLX_GPU_NUM_RB_AMD 0x21A7
#define GLX_GPU_NUM_SPI_AMD 0x21A8
#endif /* GLX_AMD_gpu_association */
#ifndef GLX_EXT_buffer_age
#define GLX_EXT_buffer_age 1
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
#endif /* GLX_EXT_buffer_age */
#ifndef GLX_EXT_create_context_es2_profile
#define GLX_EXT_create_context_es2_profile 1
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif /* GLX_EXT_create_context_es2_profile */
#ifndef GLX_EXT_create_context_es_profile
#define GLX_EXT_create_context_es_profile 1
#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#endif /* GLX_EXT_create_context_es_profile */
#ifndef GLX_EXT_fbconfig_packed_float
#define GLX_EXT_fbconfig_packed_float 1
#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
#endif /* GLX_EXT_fbconfig_packed_float */
#ifndef GLX_EXT_framebuffer_sRGB
#define GLX_EXT_framebuffer_sRGB 1
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
#endif /* GLX_EXT_framebuffer_sRGB */
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
#define GLX_SHARE_CONTEXT_EXT 0x800A
#define GLX_VISUAL_ID_EXT 0x800B
#define GLX_SCREEN_EXT 0x800C
typedef Display *( *PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
typedef int ( *PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
typedef GLXContextID ( *PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
typedef GLXContext ( *PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
typedef void ( *PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
#ifdef GLX_GLXEXT_PROTOTYPES
Display *glXGetCurrentDisplayEXT (void);
int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value);
GLXContextID glXGetContextIDEXT (const GLXContext context);
GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
void glXFreeContextEXT (Display *dpy, GLXContext context);
#endif
#endif /* GLX_EXT_import_context */
#ifndef GLX_EXT_stereo_tree
#define GLX_EXT_stereo_tree 1
typedef struct {
int type;
unsigned long serial;
Bool send_event;
Display *display;
int extension;
int evtype;
GLXDrawable window;
Bool stereo_tree;
} GLXStereoNotifyEventEXT;
#define GLX_STEREO_TREE_EXT 0x20F5
#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001
#define GLX_STEREO_NOTIFY_EXT 0x00000000
#endif /* GLX_EXT_stereo_tree */
#ifndef GLX_EXT_swap_control
#define GLX_EXT_swap_control 1
#define GLX_SWAP_INTERVAL_EXT 0x20F1
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
typedef void ( *PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
#endif
#endif /* GLX_EXT_swap_control */
#ifndef GLX_EXT_swap_control_tear
#define GLX_EXT_swap_control_tear 1
#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
#endif /* GLX_EXT_swap_control_tear */
#ifndef GLX_EXT_texture_from_pixmap
#define GLX_EXT_texture_from_pixmap 1
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
#define GLX_Y_INVERTED_EXT 0x20D4
#define GLX_TEXTURE_FORMAT_EXT 0x20D5
#define GLX_TEXTURE_TARGET_EXT 0x20D6
#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
#define GLX_TEXTURE_1D_EXT 0x20DB
#define GLX_TEXTURE_2D_EXT 0x20DC
#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
#define GLX_FRONT_LEFT_EXT 0x20DE
#define GLX_FRONT_RIGHT_EXT 0x20DF
#define GLX_BACK_LEFT_EXT 0x20E0
#define GLX_BACK_RIGHT_EXT 0x20E1
#define GLX_FRONT_EXT 0x20DE
#define GLX_BACK_EXT 0x20E0
#define GLX_AUX0_EXT 0x20E2
#define GLX_AUX1_EXT 0x20E3
#define GLX_AUX2_EXT 0x20E4
#define GLX_AUX3_EXT 0x20E5
#define GLX_AUX4_EXT 0x20E6
#define GLX_AUX5_EXT 0x20E7
#define GLX_AUX6_EXT 0x20E8
#define GLX_AUX7_EXT 0x20E9
#define GLX_AUX8_EXT 0x20EA
#define GLX_AUX9_EXT 0x20EB
typedef void ( *PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
typedef void ( *PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer);
#endif
#endif /* GLX_EXT_texture_from_pixmap */
#ifndef GLX_EXT_visual_info
#define GLX_EXT_visual_info 1
#define GLX_X_VISUAL_TYPE_EXT 0x22
#define GLX_TRANSPARENT_TYPE_EXT 0x23
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
#define GLX_NONE_EXT 0x8000
#define GLX_TRUE_COLOR_EXT 0x8002
#define GLX_DIRECT_COLOR_EXT 0x8003
#define GLX_PSEUDO_COLOR_EXT 0x8004
#define GLX_STATIC_COLOR_EXT 0x8005
#define GLX_GRAY_SCALE_EXT 0x8006
#define GLX_STATIC_GRAY_EXT 0x8007
#define GLX_TRANSPARENT_RGB_EXT 0x8008
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
#endif /* GLX_EXT_visual_info */
#ifndef GLX_EXT_visual_rating
#define GLX_EXT_visual_rating 1
#define GLX_VISUAL_CAVEAT_EXT 0x20
#define GLX_SLOW_VISUAL_EXT 0x8001
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
#endif /* GLX_EXT_visual_rating */
#ifndef GLX_INTEL_swap_event
#define GLX_INTEL_swap_event 1
#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180
#define GLX_COPY_COMPLETE_INTEL 0x8181
#define GLX_FLIP_COMPLETE_INTEL 0x8182
#endif /* GLX_INTEL_swap_event */
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
typedef unsigned int ( *PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
#ifdef GLX_GLXEXT_PROTOTYPES
unsigned int glXGetAGPOffsetMESA (const void *pointer);
#endif
#endif /* GLX_MESA_agp_offset */
#ifndef GLX_MESA_copy_sub_buffer
#define GLX_MESA_copy_sub_buffer 1
typedef void ( *PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#endif
#endif /* GLX_MESA_copy_sub_buffer */
#ifndef GLX_MESA_pixmap_colormap
#define GLX_MESA_pixmap_colormap 1
typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
#endif
#endif /* GLX_MESA_pixmap_colormap */
#ifndef GLX_MESA_query_renderer
#define GLX_MESA_query_renderer 1
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
#define GLX_RENDERER_VERSION_MESA 0x8185
#define GLX_RENDERER_ACCELERATED_MESA 0x8186
#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
#define GLX_RENDERER_ID_MESA 0x818E
typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute);
typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value);
const char *glXQueryCurrentRendererStringMESA (int attribute);
Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute);
#endif
#endif /* GLX_MESA_query_renderer */
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
#endif
#endif /* GLX_MESA_release_buffers */
#ifndef GLX_MESA_set_3dfx_mode
#define GLX_MESA_set_3dfx_mode 1
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXSet3DfxModeMESA (int mode);
#endif
#endif /* GLX_MESA_set_3dfx_mode */
#ifndef GLX_NV_copy_buffer
#define GLX_NV_copy_buffer 1
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#endif
#endif /* GLX_NV_copy_buffer */
#ifndef GLX_NV_copy_image
#define GLX_NV_copy_image 1
typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#endif /* GLX_NV_copy_image */
#ifndef GLX_NV_delay_before_swap
#define GLX_NV_delay_before_swap 1
typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#endif
#endif /* GLX_NV_delay_before_swap */
#ifndef GLX_NV_float_buffer
#define GLX_NV_float_buffer 1
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
#endif /* GLX_NV_float_buffer */
#ifndef GLX_NV_multisample_coverage
#define GLX_NV_multisample_coverage 1
#define GLX_COVERAGE_SAMPLES_NV 100001
#define GLX_COLOR_SAMPLES_NV 0x20B3
#endif /* GLX_NV_multisample_coverage */
#ifndef GLX_NV_present_video
#define GLX_NV_present_video 1
#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0
typedef unsigned int *( *PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
typedef int ( *PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
#ifdef GLX_GLXEXT_PROTOTYPES
unsigned int *glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements);
int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
#endif
#endif /* GLX_NV_present_video */
#ifndef GLX_NV_swap_group
#define GLX_NV_swap_group 1
typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
typedef Bool ( *PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
typedef Bool ( *PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
typedef Bool ( *PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
typedef Bool ( *PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
typedef Bool ( *PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group);
Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier);
Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count);
Bool glXResetFrameCountNV (Display *dpy, int screen);
#endif
#endif /* GLX_NV_swap_group */
#ifndef GLX_NV_video_capture
#define GLX_NV_video_capture 1
typedef XID GLXVideoCaptureDeviceNV;
#define GLX_DEVICE_ID_NV 0x20CD
#define GLX_UNIQUE_ID_NV 0x20CE
#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
typedef int ( *PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
typedef GLXVideoCaptureDeviceNV *( *PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
typedef void ( *PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
typedef int ( *PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
typedef void ( *PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements);
void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
#endif
#endif /* GLX_NV_video_capture */
#ifndef GLX_NV_video_out
#define GLX_NV_video_out 1
typedef unsigned int GLXVideoDeviceNV;
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5
#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define GLX_VIDEO_OUT_FRAME_NV 0x20C8
#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9
#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA
#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
typedef int ( *PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
typedef int ( *PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
typedef int ( *PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
typedef int ( *PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
typedef int ( *PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
typedef int ( *PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#endif /* GLX_NV_video_out */
#ifndef GLX_OML_swap_method
#define GLX_OML_swap_method 1
#define GLX_SWAP_METHOD_OML 0x8060
#define GLX_SWAP_EXCHANGE_OML 0x8061
#define GLX_SWAP_COPY_OML 0x8062
#define GLX_SWAP_UNDEFINED_OML 0x8063
#endif /* GLX_OML_swap_method */
#ifndef GLX_OML_sync_control
#define GLX_OML_sync_control 1
#ifndef GLEXT_64_TYPES_DEFINED
/* This code block is duplicated in glext.h, so must be protected */
#define GLEXT_64_TYPES_DEFINED
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
/* (as used in the GLX_OML_sync_control extension). */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__sun__) || defined(__digital__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__) || defined(_LP64)
typedef long int int64_t;
typedef unsigned long int uint64_t;
#else
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
#elif defined( __VMS ) || defined(__sgi)
#include <inttypes.h>
#elif defined(__SCO__) || defined(__USLC__)
#include <stdint.h>
#elif defined(__UNIXOS2__) || defined(__SOL64__)
typedef long int int32_t;
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
/* Fallback if nothing above works */
#include <inttypes.h>
#endif
#endif
typedef Bool ( *PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool ( *PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
typedef int64_t ( *PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
typedef Bool ( *PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool ( *PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
#endif
#endif /* GLX_OML_sync_control */
#ifndef GLX_SGIS_blended_overlay
#define GLX_SGIS_blended_overlay 1
#define GLX_BLENDED_RGBA_SGIS 0x8025
#endif /* GLX_SGIS_blended_overlay */
#ifndef GLX_SGIS_multisample
#define GLX_SGIS_multisample 1
#define GLX_SAMPLE_BUFFERS_SGIS 100000
#define GLX_SAMPLES_SGIS 100001
#endif /* GLX_SGIS_multisample */
#ifndef GLX_SGIS_shared_multisample
#define GLX_SGIS_shared_multisample 1
#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
#endif /* GLX_SGIS_shared_multisample */
#ifndef GLX_SGIX_dmbuffer
#define GLX_SGIX_dmbuffer 1
typedef XID GLXPbufferSGIX;
#ifdef _DM_BUFFER_H_
#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024
typedef Bool ( *PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
#endif
#endif /* _DM_BUFFER_H_ */
#endif /* GLX_SGIX_dmbuffer */
#ifndef GLX_SGIX_fbconfig
#define GLX_SGIX_fbconfig 1
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
#define GLX_WINDOW_BIT_SGIX 0x00000001
#define GLX_PIXMAP_BIT_SGIX 0x00000002
#define GLX_RGBA_BIT_SGIX 0x00000001
#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
#define GLX_DRAWABLE_TYPE_SGIX 0x8010
#define GLX_RENDER_TYPE_SGIX 0x8011
#define GLX_X_RENDERABLE_SGIX 0x8012
#define GLX_FBCONFIG_ID_SGIX 0x8013
#define GLX_RGBA_TYPE_SGIX 0x8014
#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
typedef int ( *PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
typedef GLXFBConfigSGIX *( *PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
typedef GLXContext ( *PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
GLXFBConfigSGIX *glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements);
GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
#endif
#endif /* GLX_SGIX_fbconfig */
#ifndef GLX_SGIX_hyperpipe
#define GLX_SGIX_hyperpipe 1
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int networkId;
} GLXHyperpipeNetworkSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int channel;
unsigned int participationType;
int timeSlice;
} GLXHyperpipeConfigSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
int destXOrigin, destYOrigin, destWidth, destHeight;
} GLXPipeRect;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int XOrigin, YOrigin, maxHeight, maxWidth;
} GLXPipeRectLimits;
#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
#define GLX_BAD_HYPERPIPE_SGIX 92
#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
#define GLX_PIPE_RECT_SGIX 0x00000001
#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003
#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
#define GLX_HYPERPIPE_ID_SGIX 0x8030
typedef GLXHyperpipeNetworkSGIX *( *PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
typedef int ( *PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
typedef GLXHyperpipeConfigSGIX *( *PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
typedef int ( *PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
typedef int ( *PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
typedef int ( *PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
typedef int ( *PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
typedef int ( *PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes);
int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes);
int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId);
int glXBindHyperpipeSGIX (Display *dpy, int hpId);
int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
#endif
#endif /* GLX_SGIX_hyperpipe */
#ifndef GLX_SGIX_pbuffer
#define GLX_SGIX_pbuffer 1
#define GLX_PBUFFER_BIT_SGIX 0x00000004
#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
#define GLX_LARGEST_PBUFFER_SGIX 0x801C
#define GLX_WIDTH_SGIX 0x801D
#define GLX_HEIGHT_SGIX 0x801E
#define GLX_EVENT_MASK_SGIX 0x801F
#define GLX_DAMAGED_SGIX 0x8020
#define GLX_SAVED_SGIX 0x8021
#define GLX_WINDOW_SGIX 0x8022
#define GLX_PBUFFER_SGIX 0x8023
typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
#endif
#endif /* GLX_SGIX_pbuffer */
#ifndef GLX_SGIX_swap_barrier
#define GLX_SGIX_swap_barrier 1
typedef void ( *PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
typedef Bool ( *PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier);
Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max);
#endif
#endif /* GLX_SGIX_swap_barrier */
#ifndef GLX_SGIX_swap_group
#define GLX_SGIX_swap_group 1
typedef void ( *PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member);
#endif
#endif /* GLX_SGIX_swap_group */
#ifndef GLX_SGIX_video_resize
#define GLX_SGIX_video_resize 1
#define GLX_SYNC_FRAME_SGIX 0x00000000
#define GLX_SYNC_SWAP_SGIX 0x00000001
typedef int ( *PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
typedef int ( *PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
typedef int ( *PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
typedef int ( *PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
typedef int ( *PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window);
int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h);
int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype);
#endif
#endif /* GLX_SGIX_video_resize */
#ifndef GLX_SGIX_video_source
#define GLX_SGIX_video_source 1
typedef XID GLXVideoSourceSGIX;
#ifdef _VL_H
typedef GLXVideoSourceSGIX ( *PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
typedef void ( *PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource);
#endif
#endif /* _VL_H */
#endif /* GLX_SGIX_video_source */
#ifndef GLX_SGIX_visual_select_group
#define GLX_SGIX_visual_select_group 1
#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
#endif /* GLX_SGIX_visual_select_group */
#ifndef GLX_SGI_cushion
#define GLX_SGI_cushion 1
typedef void ( *PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCushionSGI (Display *dpy, Window window, float cushion);
#endif
#endif /* GLX_SGI_cushion */
#ifndef GLX_SGI_make_current_read
#define GLX_SGI_make_current_read 1
typedef Bool ( *PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
GLXDrawable glXGetCurrentReadDrawableSGI (void);
#endif
#endif /* GLX_SGI_make_current_read */
#ifndef GLX_SGI_swap_control
#define GLX_SGI_swap_control 1
typedef int ( *PFNGLXSWAPINTERVALSGIPROC) (int interval);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXSwapIntervalSGI (int interval);
#endif
#endif /* GLX_SGI_swap_control */
#ifndef GLX_SGI_video_sync
#define GLX_SGI_video_sync 1
typedef int ( *PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
typedef int ( *PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetVideoSyncSGI (unsigned int *count);
int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
#endif
#endif /* GLX_SGI_video_sync */
#ifndef GLX_SUN_get_transparent_index
#define GLX_SUN_get_transparent_index 1
typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
#ifdef GLX_GLXEXT_PROTOTYPES
Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
#endif
#endif /* GLX_SUN_get_transparent_index */
#ifdef __cplusplus
}
#endif
#endif

840
deps/GL/wglext.h vendored Normal file
View File

@ -0,0 +1,840 @@
#ifndef __wglext_h_
#define __wglext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/*
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 27684 $ on $Date: 2014-08-11 01:21:35 -0700 (Mon, 11 Aug 2014) $
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#define WGL_WGLEXT_VERSION 20140810
/* Generated C header for:
* API: wgl
* Versions considered: .*
* Versions emitted: _nomatch_^
* Default extensions included: wgl
* Additional extensions included: _nomatch_^
* Extensions removed: _nomatch_^
*/
#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#ifdef WGL_WGLEXT_PROTOTYPES
HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif
#endif /* WGL_ARB_buffer_region */
#ifndef WGL_ARB_context_flush_control
#define WGL_ARB_context_flush_control 1
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#endif /* WGL_ARB_context_flush_control */
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#ifdef WGL_WGLEXT_PROTOTYPES
HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif
#endif /* WGL_ARB_create_context */
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#endif /* WGL_ARB_create_context_profile */
#ifndef WGL_ARB_create_context_robustness
#define WGL_ARB_create_context_robustness 1
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
#endif /* WGL_ARB_create_context_robustness */
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
#ifdef WGL_WGLEXT_PROTOTYPES
const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
#endif
#endif /* WGL_ARB_extensions_string */
#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_ARB_framebuffer_sRGB 1
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
#endif /* WGL_ARB_framebuffer_sRGB */
#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
HDC WINAPI wglGetCurrentReadDCARB (void);
#endif
#endif /* WGL_ARB_make_current_read */
#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#endif /* WGL_ARB_multisample */
#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1
DECLARE_HANDLE(HPBUFFERARB);
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif
#endif /* WGL_ARB_pbuffer */
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#endif /* WGL_ARB_pixel_format */
#ifndef WGL_ARB_pixel_format_float
#define WGL_ARB_pixel_format_float 1
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
#endif /* WGL_ARB_pixel_format_float */
#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif
#endif /* WGL_ARB_render_texture */
#ifndef WGL_ARB_robustness_application_isolation
#define WGL_ARB_robustness_application_isolation 1
#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
#endif /* WGL_ARB_robustness_application_isolation */
#ifndef WGL_ARB_robustness_share_group_isolation
#define WGL_ARB_robustness_share_group_isolation 1
#endif /* WGL_ARB_robustness_share_group_isolation */
#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061
#endif /* WGL_3DFX_multisample */
#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
#endif
#endif /* WGL_3DL_stereo_control */
#ifndef WGL_AMD_gpu_association
#define WGL_AMD_gpu_association 1
#define WGL_GPU_VENDOR_AMD 0x1F00
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define WGL_GPU_RAM_AMD 0x21A3
#define WGL_GPU_CLOCK_AMD 0x21A4
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#ifdef WGL_WGLEXT_PROTOTYPES
UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#endif /* WGL_AMD_gpu_association */
#ifndef WGL_ATI_pixel_format_float
#define WGL_ATI_pixel_format_float 1
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#endif /* WGL_ATI_pixel_format_float */
#ifndef WGL_EXT_create_context_es2_profile
#define WGL_EXT_create_context_es2_profile 1
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif /* WGL_EXT_create_context_es2_profile */
#ifndef WGL_EXT_create_context_es_profile
#define WGL_EXT_create_context_es_profile 1
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#endif /* WGL_EXT_create_context_es_profile */
#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1
#define WGL_DEPTH_FLOAT_EXT 0x2040
#endif /* WGL_EXT_depth_float */
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
#ifdef WGL_WGLEXT_PROTOTYPES
GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
#endif
#endif /* WGL_EXT_display_color_table */
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
const char *WINAPI wglGetExtensionsStringEXT (void);
#endif
#endif /* WGL_EXT_extensions_string */
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_EXT_framebuffer_sRGB 1
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
#endif /* WGL_EXT_framebuffer_sRGB */
#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
HDC WINAPI wglGetCurrentReadDCEXT (void);
#endif
#endif /* WGL_EXT_make_current_read */
#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042
#endif /* WGL_EXT_multisample */
#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1
DECLARE_HANDLE(HPBUFFEREXT);
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif
#endif /* WGL_EXT_pbuffer */
#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#endif /* WGL_EXT_pixel_format */
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
#endif /* WGL_EXT_pixel_format_packed_float */
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglSwapIntervalEXT (int interval);
int WINAPI wglGetSwapIntervalEXT (void);
#endif
#endif /* WGL_EXT_swap_control */
#ifndef WGL_EXT_swap_control_tear
#define WGL_EXT_swap_control_tear 1
#endif /* WGL_EXT_swap_control_tear */
#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
#endif
#endif /* WGL_I3D_digital_video_control */
#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif
#endif /* WGL_I3D_gamma */
#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif
#endif /* WGL_I3D_genlock */
#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
#ifdef WGL_WGLEXT_PROTOTYPES
LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
#endif
#endif /* WGL_I3D_image_buffer */
#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglEnableFrameLockI3D (void);
BOOL WINAPI wglDisableFrameLockI3D (void);
BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
#endif
#endif /* WGL_I3D_swap_frame_lock */
#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
BOOL WINAPI wglBeginFrameTrackingI3D (void);
BOOL WINAPI wglEndFrameTrackingI3D (void);
BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif
#endif /* WGL_I3D_swap_frame_usage */
#ifndef WGL_NV_DX_interop
#define WGL_NV_DX_interop 1
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
#endif
#endif /* WGL_NV_DX_interop */
#ifndef WGL_NV_DX_interop2
#define WGL_NV_DX_interop2 1
#endif /* WGL_NV_DX_interop2 */
#ifndef WGL_NV_copy_image
#define WGL_NV_copy_image 1
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#endif /* WGL_NV_copy_image */
#ifndef WGL_NV_delay_before_swap
#define WGL_NV_delay_before_swap 1
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
#endif
#endif /* WGL_NV_delay_before_swap */
#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
#endif /* WGL_NV_float_buffer */
#ifndef WGL_NV_gpu_affinity
#define WGL_NV_gpu_affinity 1
DECLARE_HANDLE(HGPUNV);
struct _GPU_DEVICE {
DWORD cb;
CHAR DeviceName[32];
CHAR DeviceString[128];
DWORD Flags;
RECT rcVirtualScreen;
};
typedef struct _GPU_DEVICE *PGPU_DEVICE;
#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
BOOL WINAPI wglDeleteDCNV (HDC hdc);
#endif
#endif /* WGL_NV_gpu_affinity */
#ifndef WGL_NV_multisample_coverage
#define WGL_NV_multisample_coverage 1
#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9
#endif /* WGL_NV_multisample_coverage */
#ifndef WGL_NV_present_video
#define WGL_NV_present_video 1
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
#endif
#endif /* WGL_NV_present_video */
#ifndef WGL_NV_render_depth_texture
#define WGL_NV_render_depth_texture 1
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
#define WGL_DEPTH_COMPONENT_NV 0x20A7
#endif /* WGL_NV_render_depth_texture */
#ifndef WGL_NV_render_texture_rectangle
#define WGL_NV_render_texture_rectangle 1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
#endif /* WGL_NV_render_texture_rectangle */
#ifndef WGL_NV_swap_group
#define WGL_NV_swap_group 1
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
BOOL WINAPI wglResetFrameCountNV (HDC hDC);
#endif
#endif /* WGL_NV_swap_group */
#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1
typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
#ifdef WGL_WGLEXT_PROTOTYPES
void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
void WINAPI wglFreeMemoryNV (void *pointer);
#endif
#endif /* WGL_NV_vertex_array_range */
#ifndef WGL_NV_video_capture
#define WGL_NV_video_capture 1
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
#define WGL_UNIQUE_ID_NV 0x20CE
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif
#endif /* WGL_NV_video_capture */
#ifndef WGL_NV_video_output
#define WGL_NV_video_output 1
DECLARE_HANDLE(HPVIDEODEV);
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define WGL_VIDEO_OUT_FRAME 0x20C8
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#endif /* WGL_NV_video_output */
#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif
#endif /* WGL_OML_sync_control */
#ifdef __cplusplus
}
#endif
#endif

1318
deps/glad.c vendored

File diff suppressed because it is too large Load Diff

2214
deps/glad/glad.h vendored

File diff suppressed because it is too large Load Diff

View File

@ -1573,15 +1573,13 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = GLFWAPI= \
GLFW_EXPOSE_NATIVE_WIN32 \
GLFW_EXPOSE_NATIVE_WGL \
GLFW_EXPOSE_NATIVE_X11 \
GLFW_EXPOSE_NATIVE_WAYLAND \
GLFW_EXPOSE_NATIVE_MIR \
GLFW_EXPOSE_NATIVE_GLX \
GLFW_EXPOSE_NATIVE_COCOA \
GLFW_EXPOSE_NATIVE_NSGL \
PREDEFINED = GLFWAPI= \
GLFW_EXPOSE_NATIVE_WIN32 \
GLFW_EXPOSE_NATIVE_WGL \
GLFW_EXPOSE_NATIVE_X11 \
GLFW_EXPOSE_NATIVE_GLX \
GLFW_EXPOSE_NATIVE_COCOA \
GLFW_EXPOSE_NATIVE_NSGL \
GLFW_EXPOSE_NATIVE_EGL
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then

View File

@ -103,14 +103,14 @@ creating OpenGL contexts of version 2.1 and below. Where this extension is
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GL_TRUE` will cause @ref
glfwCreateWindow to fail.
GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
context profiles. Where this extension is unavailable, setting the
`GLFW_OPENGL_PROFILE` hint to anything but `GLFW_OPENGL_ANY_PROFILE`, or setting
`GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` or `GLFW_NO_API` will cause
@ref glfwCreateWindow to fail.
`GLFW_CLIENT_API` to anything but `GLFW_OPENGL_API` will cause @ref
glfwCreateWindow to fail.
GLFW uses the `GLX_ARB_context_flush_control` extension to provide control over
whether a context is flushed when it is released (made non-current). Where this
@ -146,7 +146,7 @@ creating OpenGL contexts of version 2.1 and below. Where this extension is
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
`GLFW_OPENGL_FORWARD_COMPAT` hints to `GL_TRUE` will cause @ref
glfwCreateWindow to fail.
GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
@ -176,7 +176,7 @@ version 2.1.
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
`GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
`GL_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts and the
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.

View File

@ -90,7 +90,10 @@ Once you have Xcode installed, move on to @ref compile_generate.
To compile GLFW for X11, you need to have the X11 and OpenGL header packages
installed, as well as the basic development tools like GCC and make. For
example, on Ubuntu and other distributions based on Debian GNU/Linux, you need
to install the `xorg-dev` package, which pulls in all X.org header packages.
to install the `xorg-dev` and `libgl1-mesa-dev` packages. The former pulls in
all X.org header packages and the latter pulls in the Mesa OpenGL development
packages. Note that using header files and libraries from Mesa during
compilation _will not_ tie your binaries to the Mesa implementation of OpenGL.
Once you have installed the necessary packages, move on to @ref
compile_generate.
@ -180,6 +183,12 @@ library or as a DLL / shared library / dynamic library.
is empty, it is installed to `${CMAKE_INSTALL_PREFIX}/lib`. If it is set to
`64`, it is installed to `${CMAKE_INSTALL_PREFIX}/lib64`.
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
selected library and its header files must be present on the system for this to
work.
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
along with the library.
@ -201,6 +210,8 @@ directory of bundled applications to the `Contents/Resources` directory.
`GLFW_USE_RETINA` determines whether windows will use the full resolution of
Retina displays.
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
@subsubsection compile_options_win32 Windows specific CMake options
@ -238,8 +249,8 @@ defines `_GLFW_USE_CONFIG_H`, which causes this header to be included by
macros to be defined on the command-line.
Three macros _must_ be defined when compiling GLFW: one selecting the window
creation API and one selecting the context creation API. Exactly one of each
kind must be defined for GLFW to compile and link.
creation API, one selecting the context creation API and one client library.
Exactly one of each kind must be defined for GLFW to compile and link.
The window creation API is used to create windows, handle input, monitors, gamma
ramps and clipboard. The options are:
@ -260,6 +271,20 @@ configurations and to create contexts. The options are:
Wayland and Mir both require the EGL backend.
The client library is the one providing the OpenGL or OpenGL ES API, which is
used by GLFW to probe the created context. This is not the same thing as the
client API, as many desktop OpenGL client libraries now expose the OpenGL ES API
through extensions. The options are:
- `_GLFW_USE_OPENGL` for the desktop OpenGL (opengl32.dll, libGL.so or
OpenGL.framework)
- `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental)
- `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental)
Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL,
as the other context creation APIs do not interface with OpenGL ES client
libraries.
If you are building GLFW as a shared library / dynamic library / DLL then you
must also define `_GLFW_BUILD_DLL`. Otherwise, you may not define it.
@ -281,12 +306,6 @@ available:
- `_GLFW_USE_RETINA` to have windows use the full resolution of Retina displays
(recommended)
If you are using the EGL context creation API, the following options are
available:
- `_GLFW_USE_EGLPLATFORM_H` to use `EGL/eglplatform.h` for native handle
definitions (fallback)
@note None of the @ref build_macros may be defined during the compilation of
GLFW. If you define any of these in your build files, make sure they are not
applied to the GLFW sources.

View File

@ -64,7 +64,7 @@ contexts with hidden windows can be created with the
[GLFW_VISIBLE](@ref window_hints_wnd) window hint.
@code
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL);
@endcode
@ -80,14 +80,6 @@ when writing a command-line only application. The menu bar setup can be
disabled with a [compile-time option](@ref compile_options_osx).
@subsection context_less Windows without contexts
You can disable context creation by setting the
[GLFW_CLIENT_API](@ref window_hints_ctx) hint to `GLFW_NO_API`. Windows without
contexts may not be passed to @ref glfwMakeContextCurrent or @ref
glfwSwapBuffers.
@section context_current Current context
Before you can make OpenGL or OpenGL ES calls, you need to have a current
@ -123,7 +115,7 @@ Buffer swapping is part of the window and framebuffer, not the context. See
@section context_glext OpenGL and OpenGL ES extensions
One of the benefits of OpenGL and OpenGL ES is their extensibility.
One of the benefits of OpenGL and OpenGL ES are their extensibility.
Hardware vendors may include extensions in their implementations that extend the
API before that functionality is included in a new version of the OpenGL or
OpenGL ES specification, and some extensions are never included and remain
@ -279,8 +271,8 @@ if (glfwExtensionSupported("GL_ARB_debug_output"))
@endcode
The argument is a null terminated ASCII string with the extension name. If the
extension is supported, @ref glfwExtensionSupported returns `GLFW_TRUE`,
otherwise it returns `GLFW_FALSE`.
extension is supported, @ref glfwExtensionSupported returns `GL_TRUE`, otherwise
it returns `GL_FALSE`.
@subsubsection context_glext_proc Fetching function pointers

View File

@ -192,22 +192,6 @@ void charmods_callback(GLFWwindow* window, unsigned int codepoint, int mods)
@endcode
@subsection input_key_name Key names
If you wish to refer to keys by name, you can query the keyboard layout
dependent name of printable keys with @ref glfwGetKeyName.
@code
const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0);
show_tutorial_hint("Press %s to move forward", key_name);
@endcode
This function can handle both [keys and scancodes](@ref input_key). If the
specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is
ignored. This matches the behavior of the key callback, meaning the callback
arguments can always be passed unmodified to this function.
@section input_mouse Mouse input
Mouse input comes in many forms, including cursor motion, button presses and

View File

@ -37,7 +37,7 @@ GLFW_NOT_INITIALIZED error.
@subsection intro_init_init Initializing GLFW
The library is initialized with @ref glfwInit, which returns `GLFW_FALSE` if an
The library is initialized with @ref glfwInit, which returns `GL_FALSE` if an
error occurred.
@code
@ -50,7 +50,7 @@ if (!glfwInit())
If any part of initialization fails, all remaining bits are terminated as if
@ref glfwTerminate was called. The library only needs to be initialized once
and additional calls to an already initialized library will simply return
`GLFW_TRUE` immediately.
`GL_TRUE` immediately.
Once the library has been successfully initialized, it should be terminated
before the application exits.
@ -203,9 +203,9 @@ functions not on this list will not be made non-reentrant.
@subsection thread_safety Thread safety
Most GLFW functions may only be called from the main thread, but some may be
called from any thread. However, no GLFW function may be called from any thread
but the main thread until GLFW has been successfully initialized, including
functions that may called before initialization.
called from any thread. However, no GLFW function may be called from any other
thread until GLFW has been successfully initialized on the main thread,
including functions that may called before initialization.
The reference documentation for every GLFW function states whether it is limited
to the main thread.

View File

@ -8,7 +8,7 @@ __GLFW__ is a free, Open Source, multi-platform library for creating windows
with OpenGL or OpenGL ES contexts and receiving many kinds of input. It is easy
to integrate into existing applications and does not lay claim to the main loop.
See @ref news_32 for release highlights or the
See @ref news_31 for release highlights or the
[version history](http://www.glfw.org/changelog.html) for details.
@ref quick is a guide for those new to GLFW. It takes you through how to write

View File

@ -216,7 +216,7 @@ glfwTerminate, the window is "open".
A user attempting to close a window is now just an event like any other. Unlike
GLFW 2, windows and contexts created with GLFW 3 will never be destroyed unless
you choose them to be. Each window now has a close flag that is set to
`GLFW_TRUE` when the user attempts to close that window. By default, nothing else
`GL_TRUE` when the user attempts to close that window. By default, nothing else
happens and the window stays visible. It is then up to you to either destroy
the window, take some other action or simply ignore the request.
@ -254,7 +254,7 @@ int GLFWCALL window_close_callback(void);
void window_close_callback(GLFWwindow* window);
@endcode
@note GLFW never clears the close flag to `GLFW_FALSE`, meaning you can use it
@note GLFW never clears the close flag to `GL_FALSE`, meaning you can use it
for other reasons to close the window as well, for example the user choosing
Quit from an in-game menu.

View File

@ -2,21 +2,6 @@
@page news New features
@section news_32 New features in 3.2
@subsection news_32_sizelimits Window size limit support
GLFW now supports setting both absolute and relative window size limits with
@ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio.
@subsection news_32_keyname Localized key names
GLFW now supports querying the localized name of printable keys with @ref
glfwGetKeyName, either by key token or by scancode.
@section news_31 New features in 3.1
These are the release highlights. For a full list of changes see the

View File

@ -6,7 +6,7 @@
This guide takes you through writing a simple application using GLFW 3. The
application will create a window and OpenGL context, render a rotating triangle
and exit when the user closes the window or presses _Escape_. This guide will
and exit when the user closes the window or presses Escape. This guide will
introduce a few of the most commonly used functions, but there are many more.
This guide assumes no experience with earlier versions of GLFW. If you
@ -26,32 +26,33 @@ to include the GLFW 3 header file.
@endcode
This defines all the constants, types and function prototypes of the GLFW API.
It also includes the OpenGL header from your development environment and
defines all the constants and types necessary for it to work on your platform
without including any platform-specific headers.
It also includes the OpenGL header, and defines all the constants and types
necessary for it to work on your platform.
For example, under Windows you are normally required to include `windows.h`
before including `GL/gl.h`. This would make your source file tied to Windows
and pollute your code's namespace with the whole Win32 API.
Instead, the GLFW header takes care of this for you, not by including
`windows.h`, but rather by itself duplicating only the necessary parts of it.
It does this only where needed, so if `windows.h` _is_ included, the GLFW header
does not try to redefine those symbols.
In other words:
- Do _not_ include the OpenGL header yourself, as GLFW does this for you in
a platform-independent way
- Do _not_ include the OpenGL headers yourself, as GLFW does this for you
- Do _not_ include `windows.h` or other platform-specific headers unless
you plan on using those APIs yourself
- If you _do_ need to include such headers, include them _before_ the GLFW
header and it will detect this
you plan on using those APIs directly
- If you _do_ need to include such headers, do it _before_ including the
GLFW one and it will detect this
On some platforms supported by GLFW the OpenGL header and link library only
expose older versions of OpenGL. The most extreme case is Windows, which only
exposes OpenGL 1.2. The easiest way to work around this is to use an
[extension loader library](@ref context_glext_auto).
If you are using such a library then you should include its header _before_ the
GLFW header. This lets it replace the OpenGL header included by GLFW without
conflicts. This example uses
[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such
libraries.
Starting with version 3.0, the GLU header `glu.h` is no longer included by
default. GLU is deprecated and should not be used in new code. If you need to
include it for legacy code, define `GLFW_INCLUDE_GLU` before the inclusion of
the GLFW header.
@code
#include <glad/glad.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
@endcode
@ -59,16 +60,14 @@ libraries.
@subsection quick_init_term Initializing and terminating GLFW
Before you can use most GLFW functions, the library must be initialized. On
successful initialization, `GLFW_TRUE` is returned. If an error occurred,
`GLFW_FALSE` is returned.
successful initialization, `GL_TRUE` is returned. If an error occurred,
`GL_FALSE` is returned.
@code
if (!glfwInit())
exit(EXIT_FAILURE);
@endcode
Note that `GLFW_TRUE` and `GLFW_FALSE` are and will always be just one and zero.
When you are done using GLFW, typically just before the application exits, you
need to terminate GLFW.
@ -96,7 +95,7 @@ description to `stderr`.
@code
void error_callback(int error, const char* description)
{
fprintf(stderr, "Error: %s\n", description);
fputs(description, stderr);
}
@endcode
@ -156,16 +155,6 @@ glfwMakeContextCurrent(window);
The context will remain current until you make another context current or until
the window owning the current context is destroyed.
If you are using an [extension loader library](@ref context_glext_auto) to
access modern OpenGL then this is when to initialize it, as the loader needs
a current context to load from. This example uses
[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such
libraries.
@code
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
@endcode
@subsection quick_window_close Checking the window close flag
@ -190,7 +179,7 @@ called immediately after the close flag has been set.
You can also set it yourself with @ref glfwSetWindowShouldClose. This can be
useful if you want to interpret other kinds of input as closing the window, like
for example pressing the _Escape_ key.
for example pressing the escape key.
@subsection quick_key_input Receiving input events
@ -203,7 +192,7 @@ callback function.
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
@endcode
@ -230,14 +219,7 @@ glViewport(0, 0, width, height);
@endcode
You can also set a framebuffer size callback using @ref
glfwSetFramebufferSizeCallback and be notified when the size changes.
Actual rendering with OpenGL is outside the scope of this tutorial, but there
are [many](https://open.gl/) [excellent](http://learnopengl.com/)
[tutorial](http://openglbook.com/) [sites](http://ogldev.atspace.co.uk/) that
teach modern OpenGL. Some of them use GLFW to create the context and window
while others use GLUT or SDL, but remember that OpenGL itself always works the
same.
glfwSetFramebufferSizeCallback and call `glViewport` from there.
@subsection quick_timer Reading the timer
@ -314,19 +296,13 @@ for example, many kinds of editing tools.
Now that you know how to initialize GLFW, create a window and poll for
keyboard input, it's possible to create a simple program.
This program creates a 640 by 480 windowed mode window and starts a loop that
clears the screen, renders a triangle and processes events until the user either
presses _Escape_ or closes the window.
@snippet simple.c code
The program above can be found in the
[source package](http://www.glfw.org/download.html) as `examples/simple.c`
and is compiled along with all other examples when you build GLFW. If you
built GLFW from the source package then already have this as `simple.exe` on
Windows, `simple` on Linux or `simple.app` on OS X.
This program creates a 640 by 480 windowed mode window and starts a loop that
clears the screen, renders a triangle and processes events until the user either
presses Escape or closes the window.
This tutorial used only a few of the many functions GLFW provides. There are
This program uses only a few of the many functions GLFW provides. There are
guides for each of the areas covered by GLFW. Each guide will introduce all the
functions for that category.
@ -336,10 +312,15 @@ functions for that category.
- @ref monitor
- @ref input
You can access reference documentation for any GLFW function by clicking it and
the reference for each function links to related functions and guide sections.
The tutorial ends here. Once you have written a program that uses GLFW, you
@section quick_build Compiling and linking the program
The complete program above can be found in the source distribution as
`examples/simple.c` and is compiled along with all other examples when you
build GLFW. That is, if you have compiled GLFW then you have already built this
as `simple.exe` on Windows, `simple` on Linux or `simple.app` on OS X.
This tutorial ends here. Once you have written a program that uses GLFW, you
will need to compile and link it. How to do that depends on the development
environment you are using and is best explained by the documentation for that
environment. To learn about the details that are specific to GLFW, see

View File

@ -223,8 +223,8 @@ This hint is ignored for windowed mode windows.
@subsubsection window_hints_ctx Context related hints
`GLFW_CLIENT_API` specifies which client API to create the context for.
Possible values are `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` and `GLFW_NO_API`.
This is a hard constraint.
Possible values are `GLFW_OPENGL_API` and `GLFW_OPENGL_ES_API`. This is a hard
constraint.
`GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` specify the client
API version that the created context must be compatible with. The exact
@ -293,34 +293,17 @@ Context release behaviors are described in detail by the
[GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt)
extension.
`GLFW_CONTEXT_NO_ERROR` specifies whether errors should be generated by the
context. If enabled, situations that would have generated errors instead cause
undefined behavior.
@par
The no error mode for OpenGL and OpenGL ES is described in detail by the
[GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt)
extension.
@note This hint is experimental in its current state. There are currently
(October 2015) no corresponding WGL or GLX extensions. That makes this hint
a [hard constraint](@ref window_hints_hard) for those backends, as creation will
fail if unsupported context flags are requested. Once the extensions are
available, they will be required and creation of `GL_KHR_no_error` contexts may
fail on early drivers where this flag is supported without those extensions
being listed.
@subsubsection window_hints_values Supported and default values
Window hint | Default value | Supported values
------------------------------- | --------------------------- | ----------------
`GLFW_RESIZABLE` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_VISIBLE` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_DECORATED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_FOCUSED` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_AUTO_ICONIFY` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_FLOATING` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_RESIZABLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_VISIBLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_DECORATED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_FOCUSED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_AUTO_ICONIFY` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_FLOATING` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_RED_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
@ -334,16 +317,16 @@ Window hint | Default value | Supported values
`GLFW_AUX_BUFFERS` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_SAMPLES` | 0 | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_REFRESH_RATE` | `GLFW_DONT_CARE` | 0 to `INT_MAX` or `GLFW_DONT_CARE`
`GLFW_STEREO` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_SRGB_CAPABLE` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_DOUBLEBUFFER` | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_CLIENT_API` | `GLFW_OPENGL_API` | `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` or `GLFW_NO_API`
`GLFW_STEREO` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_SRGB_CAPABLE` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_DOUBLEBUFFER` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE`
`GLFW_CLIENT_API` | `GLFW_OPENGL_API` | `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`
`GLFW_CONTEXT_VERSION_MAJOR` | 1 | Any valid major version number of the chosen client API
`GLFW_CONTEXT_VERSION_MINOR` | 0 | Any valid minor version number of the chosen client API
`GLFW_CONTEXT_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS` | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET`
`GLFW_CONTEXT_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`
`GLFW_OPENGL_FORWARD_COMPAT` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_OPENGL_DEBUG_CONTEXT` | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
`GLFW_OPENGL_FORWARD_COMPAT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_OPENGL_DEBUG_CONTEXT` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE`
`GLFW_OPENGL_PROFILE` | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
@ -400,7 +383,7 @@ again unless certain conditions are met.
void window_close_callback(GLFWwindow* window)
{
if (!time_to_close)
glfwSetWindowShouldClose(window, GLFW_FALSE);
glfwSetWindowShouldClose(window, GL_FALSE);
}
@endcode
@ -502,52 +485,6 @@ The size of a framebuffer may change independently of the size of a window, for
example if the window is dragged between a regular monitor and a high-DPI one.
@subsection window_sizelimits Window size limits
The minimum and maximum size of the client area of a windowed mode window can be
enforced with @ref glfwSetWindowSizeLimits. The user may resize the window to
any size and aspect ratio within the specified limits, unless the aspect ratio
is also set.
@code
glfwSetWindowSizeLimits(window, 200, 200, 400, 400);
@endcode
To specify only a minimum size or only a maximum one, set the other pair to
`GLFW_DONT_CARE`.
@code
glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE);
@endcode
To disable size limits for a window, set them all to `GLFW_DONT_CARE`.
The aspect ratio of the client area of a windowed mode window can be enforced
with @ref glfwSetWindowAspectRatio. The user may resize the window freely
unless size limits are also set, but the size will be constrained to maintain
the aspect ratio.
@code
glfwSetWindowAspectRatio(window, 16, 9);
@endcode
The aspect ratio is specified as a numerator and denominator, corresponding to
the width and height, respectively. If you want a window to maintain its
current aspect ratio, simply use its current size as the ratio.
@code
int width, height;
glfwGetWindowSize(window, &width, &height);
glfwSetWindowAspectRatio(window, width, height);
@endcode
To disable the aspect ratio limit for a window, set both terms to
`GLFW_DONT_CARE`.
You can have both size limits and aspect ratio set for a window, but the results
are undefined if they conflict.
@subsection window_pos Window position
The position of a windowed-mode window can be changed with @ref
@ -601,13 +538,7 @@ As long as your source file is encoded as UTF-8, you can use any Unicode
characters directly in the source.
@code
glfwSetWindowTitle(window, "星を追う子ども");
@endcode
If you are using C++11 or C11, you can use a UTF-8 string literal.
@code
glfwSetWindowTitle(window, u8"This is always a UTF-8 string");
glfwSetWindowTitle(window, "プラネテス");
@endcode
@ -810,16 +741,16 @@ topmost or always-on-top. This is controlled by the
@subsubsection window_attribs_ctx Context related attributes
`GLFW_CLIENT_API` indicates the client API provided by the window's context;
either `GLFW_OPENGL_API`, `GLFW_OPENGL_ES_API` or `GLFW_NO_API`.
either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`.
`GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and
`GLFW_CONTEXT_REVISION` indicate the client API version of the window's context.
`GLFW_OPENGL_FORWARD_COMPAT` is `GLFW_TRUE` if the window's context is an OpenGL
forward-compatible one, or `GLFW_FALSE` otherwise.
`GLFW_OPENGL_FORWARD_COMPAT` is `GL_TRUE` if the window's context is an OpenGL
forward-compatible one, or `GL_FALSE` otherwise.
`GLFW_OPENGL_DEBUG_CONTEXT` is `GLFW_TRUE` if the window's context is an OpenGL
debug context, or `GLFW_FALSE` otherwise.
`GLFW_OPENGL_DEBUG_CONTEXT` is `GL_TRUE` if the window's context is an OpenGL
debug context, or `GL_FALSE` otherwise.
`GLFW_OPENGL_PROFILE` indicates the OpenGL profile used by the context. This is
`GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` if the context uses

View File

@ -36,7 +36,6 @@
#include <stdlib.h>
#include <math.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <linmath.h>
@ -92,7 +91,7 @@ typedef struct {float x; float y; float z;} vertex_t;
int width, height;
GLfloat deg_rot_y = 0.f;
GLfloat deg_rot_y_inc = 2.f;
int override_pos = GLFW_FALSE;
GLboolean override_pos = GL_FALSE;
GLfloat cursor_x = 0.f;
GLfloat cursor_y = 0.f;
GLfloat ball_x = -RADIUS;
@ -237,7 +236,7 @@ void reshape( GLFWwindow* window, int w, int h )
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods )
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
static void set_ball_pos ( GLfloat x, GLfloat y )
@ -253,12 +252,12 @@ void mouse_button_callback( GLFWwindow* window, int button, int action, int mods
if (action == GLFW_PRESS)
{
override_pos = GLFW_TRUE;
override_pos = GL_TRUE;
set_ball_pos(cursor_x, cursor_y);
}
else
{
override_pos = GLFW_FALSE;
override_pos = GL_FALSE;
}
}
@ -611,15 +610,12 @@ int main( void )
exit( EXIT_FAILURE );
}
glfwSetWindowAspectRatio(window, 1, 1);
glfwSetFramebufferSizeCallback(window, reshape);
glfwSetKeyCallback(window, key_callback);
glfwSetMouseButtonCallback(window, mouse_button_callback);
glfwSetCursorPosCallback(window, cursor_position_callback);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height);

View File

@ -30,8 +30,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
/**
@ -221,7 +219,7 @@ void key( GLFWwindow* window, int k, int s, int action, int mods )
view_rotz += 5.0;
break;
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_UP:
view_rotx += 5.0;
@ -325,7 +323,6 @@ int main(int argc, char *argv[])
glfwSetKeyCallback(window, key);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height);

View File

@ -386,7 +386,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
case GLFW_KEY_ESCAPE:
/* Exit program on Escape */
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
}
@ -406,7 +406,6 @@ int main(int argc, char** argv)
float f;
GLint uloc_modelview;
GLint uloc_project;
int width, height;
GLuint shader_program;
@ -415,11 +414,11 @@ int main(int argc, char** argv)
if (!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL);
if (! window )
@ -470,8 +469,7 @@ int main(int argc, char** argv)
/* Create the vbo to store all the information for the grid and the height */
/* setup the scene ready for rendering */
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
glViewport(0, 0, 800, 600);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
/* main loop */

View File

@ -39,7 +39,6 @@
#include <getopt.h>
#include <linmath.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
// Define tokens for GL_EXT_separate_specular_color if not already defined
@ -876,7 +875,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
switch (key)
{
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_W:
wireframe = !wireframe;
@ -990,7 +989,6 @@ int main(int argc, char** argv)
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, resize_callback);

View File

@ -24,68 +24,31 @@
//========================================================================
//! [code]
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include "linmath.h"
#include <stdlib.h>
#include <stdio.h>
static const struct
{
float x, y;
float r, g, b;
} vertices[3] =
{
{ -0.6f, -0.4f, 1.f, 0.f, 0.f },
{ 0.6f, -0.4f, 0.f, 1.f, 0.f },
{ 0.f, 0.6f, 0.f, 0.f, 1.f }
};
static const char* vertex_shader_text =
"uniform mat4 MVP;\n"
"attribute vec3 vCol;\n"
"attribute vec2 vPos;\n"
"varying vec3 color;\n"
"void main()\n"
"{\n"
" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
" color = vCol;\n"
"}\n";
static const char* fragment_shader_text =
"varying vec3 color;\n"
"void main()\n"
"{\n"
" gl_FragColor = vec4(color, 1.0);\n"
"}\n";
static void error_callback(int error, const char* description)
{
fprintf(stderr, "Error: %s\n", description);
fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
GLFWwindow* window;
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
GLint mvp_location, vpos_location, vcol_location;
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
if (!window)
{
@ -93,47 +56,15 @@ int main(void)
exit(EXIT_FAILURE);
}
glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
// NOTE: OpenGL error checks have been omitted for brevity
glGenBuffers(1, &vertex_buffer);
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
vertex_shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);
glCompileShader(vertex_shader);
fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);
glCompileShader(fragment_shader);
program = glCreateProgram();
glAttachShader(program, vertex_shader);
glAttachShader(program, fragment_shader);
glLinkProgram(program);
mvp_location = glGetUniformLocation(program, "MVP");
vpos_location = glGetAttribLocation(program, "vPos");
vcol_location = glGetAttribLocation(program, "vCol");
glEnableVertexAttribArray(vpos_location);
glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
sizeof(float) * 5, (void*) 0);
glEnableVertexAttribArray(vcol_location);
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
sizeof(float) * 5, (void*) (sizeof(float) * 2));
glfwSetKeyCallback(window, key_callback);
while (!glfwWindowShouldClose(window))
{
float ratio;
int width, height;
mat4x4 m, p, mvp;
glfwGetFramebufferSize(window, &width, &height);
ratio = width / (float) height;
@ -141,14 +72,22 @@ int main(void)
glViewport(0, 0, width, height);
glClear(GL_COLOR_BUFFER_BIT);
mat4x4_identity(m);
mat4x4_rotate_Z(m, m, (float) glfwGetTime());
mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
mat4x4_mul(mvp, p, m);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
glMatrixMode(GL_MODELVIEW);
glUseProgram(program);
glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
glDrawArrays(GL_TRIANGLES, 0, 3);
glLoadIdentity();
glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
glBegin(GL_TRIANGLES);
glColor3f(1.f, 0.f, 0.f);
glVertex3f(-0.6f, -0.4f, 0.f);
glColor3f(0.f, 1.f, 0.f);
glVertex3f(0.6f, -0.4f, 0.f);
glColor3f(0.f, 0.f, 1.f);
glVertex3f(0.f, 0.6f, 0.f);
glEnd();
glfwSwapBuffers(window);
glfwPollEvents();

View File

@ -10,7 +10,7 @@
// because I am not a friend of orthogonal projections)
//========================================================================
#include <glad/glad.h>
#define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h>
#if defined(_MSC_VER)
@ -473,7 +473,7 @@ static void mouseButtonFun(GLFWwindow* window, int button, int action, int mods)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
@ -513,11 +513,14 @@ int main(void)
// Enable vsync
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3)
if (glfwExtensionSupported("GL_ARB_multisample") ||
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR) >= 2 ||
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR) >= 3)
{
glEnable(GL_MULTISAMPLE_ARB);
}
glfwGetFramebufferSize(window, &width, &height);
framebufferSizeFun(window, width, height);

View File

@ -17,7 +17,6 @@
#include <stdlib.h>
#include <math.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <linmath.h>
@ -279,7 +278,7 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
switch (key)
{
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_SPACE:
init_grid();
@ -412,7 +411,6 @@ int main(int argc, char* argv[])
glfwSetScrollCallback(window, scroll_callback);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwGetFramebufferSize(window, &width, &height);

View File

@ -1,5 +1,5 @@
/*************************************************************************
* GLFW 3.2 - www.glfw.org
* GLFW 3.1 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
@ -38,14 +38,6 @@ extern "C" {
* Doxygen documentation
*************************************************************************/
/*! @file glfw3.h
* @brief The header of the GLFW 3 API.
*
* This is the header file of the GLFW 3 API. It defines all its types and
* declares all its functions.
*
* For more information about how to use this file, see @ref build_include.
*/
/*! @defgroup context Context handling
*
* This is the reference documentation for context related functions. For more
@ -212,32 +204,14 @@ extern "C" {
* backward-compatible.
* @ingroup init
*/
#define GLFW_VERSION_MINOR 2
#define GLFW_VERSION_MINOR 1
/*! @brief The revision number of the GLFW library.
*
* This is incremented when a bug fix release is made that does not contain any
* API changes.
* @ingroup init
*/
#define GLFW_VERSION_REVISION 0
/*! @} */
/*! @name Boolean values
* @{ */
/*! @brief One.
*
* One. Seriously. You don't _need_ to use this symbol in your code. It's
* just semantic sugar for the number 1. You can use `1` or `true` or `_True`
* or `GL_TRUE` or whatever you want.
*/
#define GLFW_TRUE 1
/*! @brief Zero.
*
* Zero. Seriously. You don't _need_ to use this symbol in your code. It's
* just just semantic sugar for the number 0. You can use `0` or `false` or
* `_False` or `GL_FALSE` or whatever you want.
*/
#define GLFW_FALSE 0
#define GLFW_VERSION_REVISION 2
/*! @} */
/*! @name Key and button actions
@ -414,7 +388,6 @@ extern "C" {
#define GLFW_KEY_RIGHT_ALT 346
#define GLFW_KEY_RIGHT_SUPER 347
#define GLFW_KEY_MENU 348
#define GLFW_KEY_LAST GLFW_KEY_MENU
/*! @} */
@ -614,15 +587,6 @@ extern "C" {
* the user, as appropriate.
*/
#define GLFW_FORMAT_UNAVAILABLE 0x00010009
/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
*
* A window that does not have an OpenGL or OpenGL ES context was passed to
* a function that requires it to have one.
*
* @par Analysis
* Application programmer error. Fix the offending call.
*/
#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
/*! @} */
#define GLFW_FOCUSED 0x00020001
@ -659,9 +623,7 @@ extern "C" {
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
#define GLFW_OPENGL_PROFILE 0x00022008
#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
#define GLFW_CONTEXT_NO_ERROR 0x0002200A
#define GLFW_NO_API 0
#define GLFW_OPENGL_API 0x00030001
#define GLFW_OPENGL_ES_API 0x00030002
@ -739,9 +701,6 @@ extern "C" {
* Generic function pointer used for returning client API function pointers
* without forcing a cast from a regular pointer.
*
* @sa @ref context_glext
* @sa glfwGetProcAddress
*
* @ingroup context
*/
typedef void (*GLFWglproc)(void);
@ -750,8 +709,6 @@ typedef void (*GLFWglproc)(void);
*
* Opaque monitor object.
*
* @see @ref monitor_object
*
* @ingroup monitor
*/
typedef struct GLFWmonitor GLFWmonitor;
@ -760,8 +717,6 @@ typedef struct GLFWmonitor GLFWmonitor;
*
* Opaque window object.
*
* @see @ref window_object
*
* @ingroup window
*/
typedef struct GLFWwindow GLFWwindow;
@ -770,8 +725,6 @@ typedef struct GLFWwindow GLFWwindow;
*
* Opaque cursor object.
*
* @see @ref cursor_object
*
* @ingroup cursor
*/
typedef struct GLFWcursor GLFWcursor;
@ -783,7 +736,6 @@ typedef struct GLFWcursor GLFWcursor;
* @param[in] error An [error code](@ref errors).
* @param[in] description A UTF-8 encoded string describing the error.
*
* @sa @ref error_handling
* @sa glfwSetErrorCallback
*
* @ingroup init
@ -800,7 +752,6 @@ typedef void (* GLFWerrorfun)(int,const char*);
* @param[in] ypos The new y-coordinate, in screen coordinates, of the
* upper-left corner of the client area of the window.
*
* @sa @ref window_pos
* @sa glfwSetWindowPosCallback
*
* @ingroup window
@ -815,7 +766,6 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
* @param[in] width The new width, in screen coordinates, of the window.
* @param[in] height The new height, in screen coordinates, of the window.
*
* @sa @ref window_size
* @sa glfwSetWindowSizeCallback
*
* @ingroup window
@ -828,7 +778,6 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
*
* @param[in] window The window that the user attempted to close.
*
* @sa @ref window_close
* @sa glfwSetWindowCloseCallback
*
* @ingroup window
@ -841,7 +790,6 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*);
*
* @param[in] window The window whose content needs to be refreshed.
*
* @sa @ref window_refresh
* @sa glfwSetWindowRefreshCallback
*
* @ingroup window
@ -853,10 +801,9 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
* This is the function signature for window focus callback functions.
*
* @param[in] window The window that gained or lost input focus.
* @param[in] focused `GLFW_TRUE` if the window was given input focus, or
* `GLFW_FALSE` if it lost it.
* @param[in] focused `GL_TRUE` if the window was given input focus, or
* `GL_FALSE` if it lost it.
*
* @sa @ref window_focus
* @sa glfwSetWindowFocusCallback
*
* @ingroup window
@ -869,10 +816,9 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
* functions.
*
* @param[in] window The window that was iconified or restored.
* @param[in] iconified `GLFW_TRUE` if the window was iconified, or
* `GLFW_FALSE` if it was restored.
* @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`
* if it was restored.
*
* @sa @ref window_iconify
* @sa glfwSetWindowIconifyCallback
*
* @ingroup window
@ -888,7 +834,6 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
* @param[in] width The new width, in pixels, of the framebuffer.
* @param[in] height The new height, in pixels, of the framebuffer.
*
* @sa @ref window_fbsize
* @sa glfwSetFramebufferSizeCallback
*
* @ingroup window
@ -906,7 +851,6 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
* held down.
*
* @sa @ref input_mouse_button
* @sa glfwSetMouseButtonCallback
*
* @ingroup input
@ -921,7 +865,6 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
* @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.
* @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.
*
* @sa @ref cursor_pos
* @sa glfwSetCursorPosCallback
*
* @ingroup input
@ -933,10 +876,9 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
* This is the function signature for cursor enter/leave callback functions.
*
* @param[in] window The window that received the event.
* @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
* area, or `GLFW_FALSE` if it left it.
* @param[in] entered `GL_TRUE` if the cursor entered the window's client
* area, or `GL_FALSE` if it left it.
*
* @sa @ref cursor_enter
* @sa glfwSetCursorEnterCallback
*
* @ingroup input
@ -951,13 +893,23 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
* @param[in] xoffset The scroll offset along the x-axis.
* @param[in] yoffset The scroll offset along the y-axis.
*
* @sa @ref scrolling
* @sa glfwSetScrollCallback
*
* @ingroup input
*/
typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
/*! @brief The function signature for menu item callbacks
*
* This is the function signature for menu item callbacks
*
* @param[in] window The window that received the event.
* @param[in] id The menu item ID that was selected
*
*/
typedef void (* GLFWmenufun)(GLFWwindow*,int);
/*! @brief The function signature for keyboard key callbacks.
*
* This is the function signature for keyboard key callback functions.
@ -969,7 +921,6 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
* held down.
*
* @sa @ref input_key
* @sa glfwSetKeyCallback
*
* @ingroup input
@ -983,7 +934,6 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
* @param[in] window The window that received the event.
* @param[in] codepoint The Unicode code point of the character.
*
* @sa @ref input_char
* @sa glfwSetCharCallback
*
* @ingroup input
@ -1002,7 +952,6 @@ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
* held down.
*
* @sa @ref input_char
* @sa glfwSetCharModsCallback
*
* @ingroup input
@ -1017,7 +966,6 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
* @param[in] count The number of dropped files.
* @param[in] paths The UTF-8 encoded file and/or directory path names.
*
* @sa @ref path_drop
* @sa glfwSetDropCallback
*
* @ingroup input
@ -1031,7 +979,6 @@ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
* @param[in] monitor The monitor that was connected or disconnected.
* @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
*
* @sa @ref monitor_event
* @sa glfwSetMonitorCallback
*
* @ingroup monitor
@ -1042,9 +989,6 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
*
* This describes a single video mode.
*
* @sa @ref monitor_modes
* @sa glfwGetVideoMode glfwGetVideoModes
*
* @ingroup monitor
*/
typedef struct GLFWvidmode
@ -1073,7 +1017,6 @@ typedef struct GLFWvidmode
*
* This describes the gamma ramp for a monitor.
*
* @sa @ref monitor_gamma
* @sa glfwGetGammaRamp glfwSetGammaRamp
*
* @ingroup monitor
@ -1095,8 +1038,6 @@ typedef struct GLFWgammaramp
} GLFWgammaramp;
/*! @brief Image data.
*
* @sa @ref cursor_custom
*/
typedef struct GLFWimage
{
@ -1127,9 +1068,9 @@ typedef struct GLFWimage
* succeeds, you should call @ref glfwTerminate before the application exits.
*
* Additional calls to this function after successful initialization but before
* termination will return `GLFW_TRUE` immediately.
* termination will return `GL_TRUE` immediately.
*
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* @return `GL_TRUE` if successful, or `GL_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @remarks __OS X:__ This function will change the current directory of the
@ -1418,6 +1359,9 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
* @return The previously set callback, or `NULL` if no callback was set or the
* library had not been [initialized](@ref intro_init).
*
* @bug __X11:__ This callback is not yet called on monitor configuration
* changes.
*
* @par Thread Safety
* This function may only be called from the main thread.
*
@ -1894,77 +1838,6 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
*/
GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
/*! @brief Sets the size limits of the specified window.
*
* This function sets the size limits of the client area of the specified
* window. If the window is full screen or not resizable, this function does
* nothing.
*
* The size limits are applied immediately and may cause the window to be
* resized.
*
* @param[in] window The window to set limits for.
* @param[in] minwidth The minimum width, in screen coordinates, of the client
* area, or `GLFW_DONT_CARE`.
* @param[in] minheight The minimum height, in screen coordinates, of the
* client area, or `GLFW_DONT_CARE`.
* @param[in] maxwidth The maximum width, in screen coordinates, of the client
* area, or `GLFW_DONT_CARE`.
* @param[in] maxheight The maximum height, in screen coordinates, of the
* client area, or `GLFW_DONT_CARE`.
*
* @remarks If you set size limits and an aspect ratio that conflict, the
* results are undefined.
*
* @par Thread Safety
* This function may only be called from the main thread.
*
* @sa @ref window_sizelimits
* @sa glfwSetWindowAspectRatio
*
* @since Added in GLFW 3.2.
*
* @ingroup window
*/
GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
/*! @brief Sets the aspect ratio of the specified window.
*
* This function sets the required aspect ratio of the client area of the
* specified window. If the window is full screen or not resizable, this
* function does nothing.
*
* The aspect ratio is specified as a numerator and a denominator and both
* values must be greater than zero. For example, the common 16:9 aspect ratio
* is specified as 16 and 9, respectively.
*
* If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
* ratio limit is disabled.
*
* The aspect ratio is applied immediately and may cause the window to be
* resized.
*
* @param[in] window The window to set limits for.
* @param[in] numer The numerator of the desired aspect ratio, or
* `GLFW_DONT_CARE`.
* @param[in] denom The denominator of the desired aspect ratio, or
* `GLFW_DONT_CARE`.
*
* @remarks If you set size limits and an aspect ratio that conflict, the
* results are undefined.
*
* @par Thread Safety
* This function may only be called from the main thread.
*
* @sa @ref window_sizelimits
* @sa glfwSetWindowSizeLimits
*
* @since Added in GLFW 3.2.
*
* @ingroup window
*/
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
/*! @brief Sets the size of the client area of the specified window.
*
* This function sets the size, in screen coordinates, of the client area of
@ -2558,20 +2431,20 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
* and unlimited cursor movement. This is useful for implementing for
* example 3D camera controls.
*
* If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
* enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
* If the mode is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
* enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
* enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
* the next time it is called even if the key had been released before the
* call. This is useful when you are only interested in whether keys have been
* pressed but not when or in which order.
*
* If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
* `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
* If sticky mouse buttons are enabled, a mouse button press will ensure that
* @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
* if the mouse button had been released before the call. This is useful when
* you are only interested in whether mouse buttons have been pressed but not
* when or in which order.
* `GL_TRUE` to enable sticky mouse buttons, or `GL_FALSE` to disable it. If
* sticky mouse buttons are enabled, a mouse button press will ensure that @ref
* glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even if
* the mouse button had been released before the call. This is useful when you
* are only interested in whether mouse buttons have been pressed but not when
* or in which order.
*
* @param[in] window The window whose input mode to set.
* @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
@ -2589,33 +2462,6 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
*/
GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
/*! @brief Returns the localized name of the specified printable key.
*
* This function returns the localized name of the specified printable key.
*
* If the key is `GLFW_KEY_UNKNOWN`, the scancode is used, otherwise the
* scancode is ignored.
*
* @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
* @param[in] scancode The scancode of the key to query.
* @return The localized name of the key.
*
* @par Pointer Lifetime
* The returned string is allocated and freed by GLFW. You should not free it
* yourself. It is valid until the next call to @ref glfwGetKeyName, or until
* the library is terminated.
*
* @par Thread Safety
* This function may only be called from the main thread.
*
* @sa @ref input_key_name
*
* @since Added in GLFW 3.2.
*
* @ingroup input
*/
GLFWAPI const char* glfwGetKeyName(int key, int scancode);
/*! @brief Returns the last reported state of a keyboard key for the specified
* window.
*
@ -2635,8 +2481,6 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
* The [modifier key bit masks](@ref mods) are not key tokens and cannot be
* used with this function.
*
* __Do not use this function__ to implement [text input](@ref input_char).
*
* @param[in] window The desired window.
* @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
* not a valid key for this function.
@ -2873,6 +2717,19 @@ GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
*/
GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
/*! @brief Sets the menu item callback
*
* This function sets the menu item callback of the specified window,
* which is called when a menu item is selected.
*
* @param[in] window The window whose callback to set
* @param[in] cbfun The new menu item callback
*/
GLFWAPI GLFWmenufun glfwSetMenuCallback(GLFWwindow* window, GLFWmenufun cbfun);
/*! @brief Sets the key callback.
*
* This function sets the key callback of the specified window, which is called
@ -3124,7 +2981,7 @@ GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
* This function returns whether the specified joystick is present.
*
* @param[in] joy The [joystick](@ref joysticks) to query.
* @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
* @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
*
* @par Thread Safety
* This function may only be called from the main thread.
@ -3330,10 +3187,6 @@ GLFWAPI void glfwSetTime(double time);
* whether a context performs this flush by setting the
* [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
*
* The specified window must have an OpenGL or OpenGL ES context. Specifying
* a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
* error.
*
* @param[in] window The window whose context to make current, or `NULL` to
* detach the current context.
*
@ -3375,10 +3228,6 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
* the swap interval is greater than zero, the GPU driver waits the specified
* number of screen updates before swapping the buffers.
*
* The specified window must have an OpenGL or OpenGL ES context. Specifying
* a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
* error.
*
* @param[in] window The window whose buffers to swap.
*
* @par Thread Safety
@ -3454,8 +3303,7 @@ GLFWAPI void glfwSwapInterval(int interval);
* a context, so there is no danger in doing this.
*
* @param[in] extension The ASCII encoded name of the extension.
* @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
* otherwise.
* @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.
*
* @par Thread Safety
* This function may be called from any thread.
@ -3480,8 +3328,8 @@ GLFWAPI int glfwExtensionSupported(const char* extension);
* without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
*
* @param[in] procname The ASCII encoded name of the function.
* @return The address of the function, or `NULL` if an
* [error](@ref error_handling) occurred.
* @return The address of the function, or `NULL` if an [error](@ref
* error_handling) occurred.
*
* @remarks The address of a given function is not guaranteed to be the same
* between contexts.

View File

@ -1,5 +1,5 @@
/*************************************************************************
* GLFW 3.2 - www.glfw.org
* GLFW 3.1 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
@ -38,12 +38,6 @@ extern "C" {
* Doxygen documentation
*************************************************************************/
/*! @file glfw3native.h
* @brief The header of the native access functions.
*
* This is the header file of the native access functions. See @ref native for
* more information.
*/
/*! @defgroup native Native access
*
* **By using the native access functions you assert that you know what you're
@ -54,15 +48,10 @@ extern "C" {
* window system API macro and exactly one context creation API macro. Failure
* to do this will cause a compile-time error.
*
* The chosen backends must match those the library was compiled for. Failure
* to do this will cause a link-time error.
*
* The available window API macros are:
* * `GLFW_EXPOSE_NATIVE_WIN32`
* * `GLFW_EXPOSE_NATIVE_COCOA`
* * `GLFW_EXPOSE_NATIVE_X11`
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
* * `GLFW_EXPOSE_NATIVE_MIR`
*
* The available context API macros are:
* * `GLFW_EXPOSE_NATIVE_WGL`
@ -97,10 +86,6 @@ extern "C" {
#elif defined(GLFW_EXPOSE_NATIVE_X11)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#elif defined(GLFW_EXPOSE_NATIVE_MIR)
#include <mir_toolkit/mir_client_library.h>
#else
#error "No window API selected"
#endif
@ -314,115 +299,6 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
* @ingroup native
*/
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
/*! @brief Returns the `GLXWindow` of the specified window.
*
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
/*! @brief Returns the `struct wl_display*` used by GLFW.
*
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
/*! @brief Returns the `struct wl_output*` of the specified monitor.
*
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
/*! @brief Returns the main `struct wl_surface*` of the specified window.
*
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_MIR)
/*! @brief Returns the `MirConnection*` used by GLFW.
*
* @return The `MirConnection*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI MirConnection* glfwGetMirDisplay(void);
/*! @brief Returns the Mir output ID of the specified monitor.
*
* @return The Mir output ID of the specified monitor, or zero if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI int glfwGetMirMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `MirSurface*` of the specified window.
*
* @return The `MirSurface*` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @par Thread Safety
* This function may be called from any thread. Access is not synchronized.
*
* @par History
* Added in GLFW 3.2.
*
* @ingroup native
*/
GLFWAPI MirSurface* glfwGetMirWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
@ -72,10 +72,7 @@ static void changeToResourcesDirectory(void)
//
static void createKeyTables(void)
{
int scancode;
memset(_glfw.ns.publicKeys, -1, sizeof(_glfw.ns.publicKeys));
memset(_glfw.ns.nativeKeys, -1, sizeof(_glfw.ns.nativeKeys));
_glfw.ns.publicKeys[0x1D] = GLFW_KEY_0;
_glfw.ns.publicKeys[0x12] = GLFW_KEY_1;
@ -191,13 +188,6 @@ static void createKeyTables(void)
_glfw.ns.publicKeys[0x51] = GLFW_KEY_KP_EQUAL;
_glfw.ns.publicKeys[0x43] = GLFW_KEY_KP_MULTIPLY;
_glfw.ns.publicKeys[0x4E] = GLFW_KEY_KP_SUBTRACT;
for (scancode = 0; scancode < 256; scancode++)
{
// Store the reverse translation for faster key name lookup
if (_glfw.ns.publicKeys[scancode] >= 0)
_glfw.ns.nativeKeys[_glfw.ns.publicKeys[scancode]] = scancode;
}
}
@ -217,38 +207,21 @@ int _glfwPlatformInit(void)
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
if (!_glfw.ns.eventSource)
return GLFW_FALSE;
return GL_FALSE;
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
// TODO: Catch kTISNotifySelectedKeyboardInputSourceChanged and update
_glfw.ns.inputSource = TISCopyCurrentKeyboardLayoutInputSource();
if (!_glfw.ns.inputSource)
return GLFW_FALSE;
_glfw.ns.unicodeData = TISGetInputSourceProperty(_glfw.ns.inputSource,
kTISPropertyUnicodeKeyLayoutData);
if (!_glfw.ns.unicodeData)
return GLFW_FALSE;
if (!_glfwInitContextAPI())
return GLFW_FALSE;
return GL_FALSE;
_glfwInitTimer();
_glfwInitJoysticks();
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformTerminate(void)
{
if (_glfw.ns.inputSource)
{
CFRelease(_glfw.ns.inputSource);
_glfw.ns.inputSource = NULL;
}
if (_glfw.ns.eventSource)
{
CFRelease(_glfw.ns.eventSource);

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -76,28 +76,28 @@ static char* getDisplayName(CGDirectDisplayID displayID)
// Check whether the display mode should be included in enumeration
//
static GLFWbool modeIsGood(CGDisplayModeRef mode)
static GLboolean modeIsGood(CGDisplayModeRef mode)
{
uint32_t flags = CGDisplayModeGetIOFlags(mode);
if (!(flags & kDisplayModeValidFlag) || !(flags & kDisplayModeSafeFlag))
return GLFW_FALSE;
return GL_FALSE;
if (flags & kDisplayModeInterlacedFlag)
return GLFW_FALSE;
return GL_FALSE;
if (flags & kDisplayModeStretchedFlag)
return GLFW_FALSE;
return GL_FALSE;
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) &&
CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0))
{
CFRelease(format);
return GLFW_FALSE;
return GL_FALSE;
}
CFRelease(format);
return GLFW_TRUE;
return GL_TRUE;
}
// Convert Core Graphics display mode to GLFW video mode
@ -166,7 +166,7 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
// Change the current video mode
//
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
CFArrayRef modes;
CFIndex count, i;
@ -178,7 +178,7 @@ GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
best = _glfwChooseVideoMode(monitor, desired);
_glfwPlatformGetVideoMode(monitor, &current);
if (_glfwCompareVideoModes(&current, best) == 0)
return GLFW_TRUE;
return GL_TRUE;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
@ -216,10 +216,10 @@ GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Monitor mode list changed");
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
// Restore the previously saved (original) video mode
@ -283,7 +283,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return monitors;
}
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
// HACK: Compare unit numbers instead of display IDs to work around display
// replacement on machines with automatic graphics switching

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
@ -30,10 +30,8 @@
#include <stdint.h>
#if defined(__OBJC__)
#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#else
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
typedef void* id;
#endif
@ -75,17 +73,13 @@ typedef struct _GLFWwindowNS
//
typedef struct _GLFWlibraryNS
{
CGEventSourceRef eventSource;
id delegate;
id autoreleasePool;
id cursor;
TISInputSourceRef inputSource;
id unicodeData;
CGEventSourceRef eventSource;
id delegate;
id autoreleasePool;
id cursor;
char keyName[64];
short int publicKeys[256];
short int nativeKeys[GLFW_KEY_LAST + 1];
char* clipboardString;
short int publicKeys[256];
char* clipboardString;
} _GLFWlibraryNS;
@ -122,7 +116,7 @@ typedef struct _GLFWtimeNS
void _glfwInitTimer(void);
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
#endif // _glfw3_cocoa_platform_h_

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
@ -64,12 +64,27 @@ static void centerCursor(_GLFWwindow *window)
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
}
// Update the cursor to match the specified cursor mode
//
static void updateModeCursor(_GLFWwindow* window)
{
if (window->cursorMode == GLFW_CURSOR_NORMAL)
{
if (window->cursor)
[(NSCursor*) window->cursor->ns.object set];
else
[[NSCursor arrowCursor] set];
}
else
[(NSCursor*) _glfw.ns.cursor set];
}
// Enter full screen mode
//
static GLFWbool enterFullscreenMode(_GLFWwindow* window)
static GLboolean enterFullscreenMode(_GLFWwindow* window)
{
GLFWvidmode mode;
GLFWbool status;
GLboolean status;
int xpos, ypos;
status = _glfwSetVideoMode(window->monitor, &window->videoMode);
@ -99,6 +114,18 @@ static float transformY(float y)
return height - y;
}
// Returns the backing rect of the specified window
//
static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
return [window->ns.view convertRectToBacking:contentRect];
else
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
return contentRect;
}
// Translates OS X key modifiers into GLFW ones
//
static int translateFlags(NSUInteger flags)
@ -160,8 +187,7 @@ static int translateKey(unsigned int key)
- (void)windowDidResize:(NSNotification *)notification
{
if (window->context.api != GLFW_NO_API)
[window->context.nsgl.object update];
[window->nsgl.context update];
if (_glfw.cursorWindow == window &&
window->cursorMode == GLFW_CURSOR_DISABLED)
@ -170,7 +196,7 @@ static int translateKey(unsigned int key)
}
const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
const NSRect fbRect = convertRectToBacking(window, contentRect);
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
@ -178,8 +204,7 @@ static int translateKey(unsigned int key)
- (void)windowDidMove:(NSNotification *)notification
{
if (window->context.api != GLFW_NO_API)
[window->context.nsgl.object update];
[window->nsgl.context update];
if (_glfw.cursorWindow == window &&
window->cursorMode == GLFW_CURSOR_DISABLED)
@ -197,7 +222,7 @@ static int translateKey(unsigned int key)
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GLFW_TRUE);
_glfwInputWindowIconify(window, GL_TRUE);
}
- (void)windowDidDeminiaturize:(NSNotification *)notification
@ -205,7 +230,7 @@ static int translateKey(unsigned int key)
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GLFW_FALSE);
_glfwInputWindowIconify(window, GL_FALSE);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
@ -216,8 +241,8 @@ static int translateKey(unsigned int key)
centerCursor(window);
}
_glfwInputWindowFocus(window, GLFW_TRUE);
_glfwPlatformSetCursorMode(window, window->cursorMode);
_glfwInputWindowFocus(window, GL_TRUE);
_glfwPlatformApplyCursorMode(window);
}
- (void)windowDidResignKey:(NSNotification *)notification
@ -225,7 +250,7 @@ static int translateKey(unsigned int key)
if (window->monitor && window->autoIconify)
_glfwPlatformIconifyWindow(window);
_glfwInputWindowFocus(window, GLFW_FALSE);
_glfwInputWindowFocus(window, GL_FALSE);
}
@end
@ -342,7 +367,7 @@ static int translateKey(unsigned int key)
- (void)cursorUpdate:(NSEvent *)event
{
_glfwPlatformSetCursorMode(window, window->cursorMode);
updateModeCursor(window);
}
- (void)mouseDown:(NSEvent *)event
@ -430,18 +455,18 @@ static int translateKey(unsigned int key)
- (void)mouseExited:(NSEvent *)event
{
_glfwInputCursorEnter(window, GLFW_FALSE);
_glfwInputCursorEnter(window, GL_FALSE);
}
- (void)mouseEntered:(NSEvent *)event
{
_glfwInputCursorEnter(window, GLFW_TRUE);
_glfwInputCursorEnter(window, GL_TRUE);
}
- (void)viewDidChangeBackingProperties
{
const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
const NSRect fbRect = convertRectToBacking(window, contentRect);
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
}
@ -532,13 +557,23 @@ static int translateKey(unsigned int key)
{
double deltaX, deltaY;
deltaX = [event scrollingDeltaX];
deltaY = [event scrollingDeltaY];
if ([event hasPreciseScrollingDeltas])
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
deltaX *= 0.1;
deltaY *= 0.1;
deltaX = [event scrollingDeltaX];
deltaY = [event scrollingDeltaY];
if ([event hasPreciseScrollingDeltas])
{
deltaX *= 0.1;
deltaY *= 0.1;
}
}
else
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
{
deltaX = [event deltaX];
deltaY = [event deltaY];
}
if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
@ -739,12 +774,18 @@ static void createMenuBar(void)
action:@selector(arrangeInFront:)
keyEquivalent:@""];
// TODO: Make this appear at the bottom of the menu (for consistency)
[windowMenu addItem:[NSMenuItem separatorItem]];
[[windowMenu addItemWithTitle:@"Enter Full Screen"
action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
// TODO: Make this appear at the bottom of the menu (for consistency)
[windowMenu addItem:[NSMenuItem separatorItem]];
[[windowMenu addItemWithTitle:@"Enter Full Screen"
action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
// to get the application menu working properly.
@ -756,10 +797,10 @@ static void createMenuBar(void)
// Initialize the Cocoa Application Kit
//
static GLFWbool initializeAppKit(void)
static GLboolean initializeAppKit(void)
{
if (NSApp)
return GLFW_TRUE;
return GL_TRUE;
// Implicitly create shared NSApplication instance
[GLFWApplication sharedApplication];
@ -781,26 +822,26 @@ static GLFWbool initializeAppKit(void)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to create application delegate");
return GLFW_FALSE;
return GL_FALSE;
}
[NSApp setDelegate:_glfw.ns.delegate];
[NSApp run];
return GLFW_TRUE;
return GL_TRUE;
}
// Create the Cocoa window
//
static GLFWbool createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window];
if (window->ns.delegate == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to create window delegate");
return GLFW_FALSE;
return GL_FALSE;
}
unsigned int styleMask = 0;
@ -840,11 +881,16 @@ static GLFWbool createWindow(_GLFWwindow* window,
if (window->ns.object == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create window");
return GLFW_FALSE;
return GL_FALSE;
}
if (wndconfig->resizable)
[window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
if (wndconfig->resizable)
[window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
if (wndconfig->monitor)
{
@ -861,16 +907,23 @@ static GLFWbool createWindow(_GLFWwindow* window,
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
#if defined(_GLFW_USE_RETINA)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
#endif /*_GLFW_USE_RETINA*/
[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
[window->ns.object setDelegate:window->ns.delegate];
[window->ns.object setAcceptsMouseMovedEvents:YES];
[window->ns.object setContentView:window->ns.view];
[window->ns.object setRestorable:NO];
return GLFW_TRUE;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window->ns.object setRestorable:NO];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
return GL_TRUE;
}
@ -884,25 +937,24 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWfbconfig* fbconfig)
{
if (!initializeAppKit())
return GLFW_FALSE;
return GL_FALSE;
if (!createWindow(window, wndconfig))
return GLFW_FALSE;
return GL_FALSE;
if (ctxconfig->api != GLFW_NO_API)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GL_FALSE;
[window->nsgl.context setView:window->ns.view];
if (wndconfig->monitor)
{
_glfwPlatformShowWindow(window);
if (!enterFullscreenMode(window))
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
@ -912,8 +964,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
if (window->monitor)
leaveFullscreenMode(window);
if (window->context.api != GLFW_NO_API)
_glfwDestroyContext(window);
_glfwDestroyContext(window);
[window->ns.object setDelegate:nil];
[window->ns.delegate release];
@ -968,33 +1019,10 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
[window->ns.object setContentSize:NSMakeSize(width, height)];
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
[window->ns.object setContentMinSize:NSMakeSize(0, 0)];
else
[window->ns.object setContentMinSize:NSMakeSize(minwidth, minheight)];
if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)
[window->ns.object setContentMaxSize:NSMakeSize(0, 0)];
else
[window->ns.object setContentMaxSize:NSMakeSize(maxwidth, maxheight)];
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
{
if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE)
[window->ns.object setContentAspectRatio:NSMakeSize(0, 0)];
else
[window->ns.object setContentAspectRatio:NSMakeSize(numer, denom)];
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{
const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
const NSRect fbRect = convertRectToBacking(window, contentRect);
if (width)
*width = (int) fbRect.size.width;
@ -1128,7 +1156,7 @@ void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
{
_glfwPlatformSetCursorMode(window, window->cursorMode);
updateModeCursor(window);
const NSRect contentRect = [window->ns.view frame];
const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream];
@ -1143,75 +1171,30 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
}
else
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
const NSRect localRect = NSMakeRect(x, contentRect.size.height - y - 1, 0, 0);
const NSRect globalRect = [window->ns.object convertRectToScreen:localRect];
const NSPoint globalPoint = globalRect.origin;
#else
const NSPoint localPoint = NSMakePoint(x, contentRect.size.height - y - 1);
const NSPoint globalPoint = [window->ns.object convertBaseToScreen:localPoint];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
CGWarpMouseCursorPosition(CGPointMake(globalPoint.x,
transformY(globalPoint.y)));
}
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
{
if (mode == GLFW_CURSOR_NORMAL)
{
if (window->cursor)
[(NSCursor*) window->cursor->ns.object set];
else
[[NSCursor arrowCursor] set];
}
else
[(NSCursor*) _glfw.ns.cursor set];
updateModeCursor(window);
if (mode == GLFW_CURSOR_DISABLED)
if (window->cursorMode == GLFW_CURSOR_DISABLED)
CGAssociateMouseAndMouseCursorPosition(false);
else
CGAssociateMouseAndMouseCursorPosition(true);
}
const char* _glfwPlatformGetKeyName(int key, int scancode)
{
if (key != GLFW_KEY_UNKNOWN)
scancode = _glfw.ns.nativeKeys[key];
if (!_glfwIsPrintable(_glfw.ns.publicKeys[scancode]))
return NULL;
UInt32 deadKeyState = 0;
UniChar characters[8];
UniCharCount characterCount = 0;
if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes],
scancode,
kUCKeyActionDisplay,
0,
LMGetKbdType(),
kUCKeyTranslateNoDeadKeysBit,
&deadKeyState,
sizeof(characters) / sizeof(characters[0]),
&characterCount,
characters) != noErr)
{
return NULL;
}
if (!characterCount)
return NULL;
CFStringRef string = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
characters,
characterCount,
kCFAllocatorNull);
CFStringGetCString(string,
_glfw.ns.keyName,
sizeof(_glfw.ns.keyName),
kCFStringEncodingUTF8);
CFRelease(string);
return _glfw.ns.keyName;
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image,
int xhot, int yhot)
@ -1220,7 +1203,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
NSBitmapImageRep* rep;
if (!initializeAppKit())
return GLFW_FALSE;
return GL_FALSE;
rep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
@ -1236,7 +1219,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
bitsPerPixel:32];
if (rep == nil)
return GLFW_FALSE;
return GL_FALSE;
memcpy([rep bitmapData], image->pixels, image->width * image->height * 4);
@ -1250,26 +1233,26 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
[rep release];
if (cursor->ns.object == nil)
return GLFW_FALSE;
return GL_FALSE;
return GLFW_TRUE;
return GL_TRUE;
}
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
if (!initializeAppKit())
return GLFW_FALSE;
return GL_FALSE;
cursor->ns.object = getStandardCursor(shape);
if (!cursor->ns.object)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to retrieve standard cursor");
return GLFW_FALSE;
return GL_FALSE;
}
[cursor->ns.object retain];
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -35,7 +35,7 @@
// Parses the client API version string and extracts the version number
//
static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
static GLboolean parseVersionString(int* api, int* major, int* minor, int* rev)
{
int i;
_GLFWwindow* window;
@ -52,12 +52,12 @@ static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
window = _glfwPlatformGetCurrentContext();
version = (const char*) window->context.GetString(GL_VERSION);
version = (const char*) window->GetString(GL_VERSION);
if (!version)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve context version string");
return GLFW_FALSE;
return GL_FALSE;
}
for (i = 0; prefixes[i]; i++)
@ -76,10 +76,10 @@ static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"No version found in context version string");
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
@ -87,14 +87,13 @@ static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
if (ctxconfig->api != GLFW_NO_API &&
ctxconfig->api != GLFW_OPENGL_API &&
if (ctxconfig->api != GLFW_OPENGL_API &&
ctxconfig->api != GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API");
return GLFW_FALSE;
return GL_FALSE;
}
if (ctxconfig->api == GLFW_OPENGL_API)
@ -113,7 +112,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid OpenGL version %i.%i",
ctxconfig->major, ctxconfig->minor);
return GLFW_FALSE;
return GL_FALSE;
}
if (ctxconfig->profile)
@ -123,10 +122,10 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid OpenGL profile");
return GLFW_FALSE;
return GL_FALSE;
}
if (ctxconfig->major <= 2 ||
if (ctxconfig->major < 3 ||
(ctxconfig->major == 3 && ctxconfig->minor < 2))
{
// Desktop OpenGL context profiles are only defined for version 3.2
@ -134,16 +133,16 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
_glfwInputError(GLFW_INVALID_VALUE,
"Context profiles are only defined for OpenGL version 3.2 and above");
return GLFW_FALSE;
return GL_FALSE;
}
}
if (ctxconfig->forward && ctxconfig->major <= 2)
if (ctxconfig->forward && ctxconfig->major < 3)
{
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
_glfwInputError(GLFW_INVALID_VALUE,
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
return GLFW_FALSE;
return GL_FALSE;
}
}
else if (ctxconfig->api == GLFW_OPENGL_ES_API)
@ -160,7 +159,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid OpenGL ES version %i.%i",
ctxconfig->major, ctxconfig->minor);
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -171,7 +170,7 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context robustness mode");
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -182,11 +181,11 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context release behavior");
return GLFW_FALSE;
return GL_FALSE;
}
}
return GLFW_TRUE;
return GL_TRUE;
}
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
@ -352,36 +351,35 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
return closest;
}
GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
glfwGetProcAddress("glGetIntegerv");
window->context.GetString = (PFNGLGETSTRINGPROC)
glfwGetProcAddress("glGetString");
window->GetIntegerv = (PFNGLGETINTEGERVPROC) glfwGetProcAddress("glGetIntegerv");
window->GetString = (PFNGLGETSTRINGPROC) glfwGetProcAddress("glGetString");
window->Clear = (PFNGLCLEARPROC) glfwGetProcAddress("glClear");
if (!parseVersionString(&window->context.api,
&window->context.major,
&window->context.minor,
&window->context.revision))
{
return GLFW_FALSE;
return GL_FALSE;
}
if (window->context.major >= 3)
#if defined(_GLFW_USE_OPENGL)
if (window->context.major > 2)
{
// OpenGL 3.0+ uses a different function for extension string retrieval
// We cache it here instead of in glfwExtensionSupported mostly to alert
// users as early as possible that their build may be broken
window->context.GetStringi = (PFNGLGETSTRINGIPROC)
glfwGetProcAddress("glGetStringi");
if (!window->context.GetStringi)
window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi");
if (!window->GetStringi)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Entry point retrieval is broken");
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -391,32 +389,29 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
if (window->context.major >= 3)
{
GLint flags;
window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags);
window->GetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
window->context.forward = GLFW_TRUE;
window->context.forward = GL_TRUE;
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
window->context.debug = GLFW_TRUE;
window->context.debug = GL_TRUE;
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
ctxconfig->debug)
{
// HACK: This is a workaround for older drivers (pre KHR_debug)
// not setting the debug bit in the context flags for
// debug contexts
window->context.debug = GLFW_TRUE;
window->context.debug = GL_TRUE;
}
if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR)
window->context.noerror = GLFW_TRUE;
}
// Read back OpenGL context profile (OpenGL 3.2 and above)
if (window->context.major >= 4 ||
if (window->context.major > 3 ||
(window->context.major == 3 && window->context.minor >= 2))
{
GLint mask;
window->context.GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
window->GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
@ -439,8 +434,7 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
// only present from 3.0 while the extension applies from 1.1
GLint strategy;
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
&strategy);
window->GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
@ -457,8 +451,7 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
// one, so we can reuse them here
GLint strategy;
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
&strategy);
window->GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
@ -470,26 +463,19 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
if (glfwExtensionSupported("GL_KHR_context_flush_control"))
{
GLint behavior;
window->context.GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
window->GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
if (behavior == GL_NONE)
window->context.release = GLFW_RELEASE_BEHAVIOR_NONE;
else if (behavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)
window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH;
}
#endif // _GLFW_USE_OPENGL
// Clearing the front buffer to black to avoid garbage pixels left over from
// previous uses of our bit of VRAM
{
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) glfwGetProcAddress("glClear");
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
}
return GLFW_TRUE;
return GL_TRUE;
}
GLFWbool _glfwIsValidContext(const _GLFWctxconfig* ctxconfig)
GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
@ -505,13 +491,13 @@ GLFWbool _glfwIsValidContext(const _GLFWctxconfig* ctxconfig)
// {GLX|WGL}_ARB_create_context extension and fail here
_glfwInputError(GLFW_VERSION_UNAVAILABLE, NULL);
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions)
int _glfwStringInExtensionString(const char* string, const char* extensions)
{
const char* start = extensions;
@ -522,7 +508,7 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions
where = strstr(start, string);
if (!where)
return GLFW_FALSE;
return GL_FALSE;
terminator = where + strlen(string);
if (where == start || *(where - 1) == ' ')
@ -534,7 +520,7 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions
start = terminator;
}
return GLFW_TRUE;
return GL_TRUE;
}
@ -545,15 +531,7 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT();
if (window && window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return;
}
_glfwPlatformMakeContextCurrent(window);
}
@ -566,15 +544,7 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT();
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return;
}
_glfwPlatformSwapBuffers(window);
}
@ -595,21 +565,22 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
{
_GLFWwindow* window;
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
_GLFW_REQUIRE_INIT_OR_RETURN(GL_FALSE);
window = _glfwPlatformGetCurrentContext();
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
return GLFW_FALSE;
return GL_FALSE;
}
if (*extension == '\0')
{
_glfwInputError(GLFW_INVALID_VALUE, NULL);
return GLFW_FALSE;
return GL_FALSE;
}
#if defined(_GLFW_USE_OPENGL)
if (window->context.major >= 3)
{
int i;
@ -617,38 +588,37 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
// Check if extension is in the modern OpenGL extensions string list
window->context.GetIntegerv(GL_NUM_EXTENSIONS, &count);
window->GetIntegerv(GL_NUM_EXTENSIONS, &count);
for (i = 0; i < count; i++)
{
const char* en = (const char*)
window->context.GetStringi(GL_EXTENSIONS, i);
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
if (!en)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve extension string %i", i);
return GLFW_FALSE;
return GL_FALSE;
}
if (strcmp(en, extension) == 0)
return GLFW_TRUE;
return GL_TRUE;
}
}
else
#endif // _GLFW_USE_OPENGL
{
// Check if extension is in the old style OpenGL extensions string
const char* extensions = (const char*)
window->context.GetString(GL_EXTENSIONS);
const char* extensions = (const char*) window->GetString(GL_EXTENSIONS);
if (!extensions)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve extension string");
return GLFW_FALSE;
return GL_FALSE;
}
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
return GL_TRUE;
}
// Check if extension is in the platform-specific string

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 EGL - www.glfw.org
// GLFW 3.1 EGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -84,9 +84,9 @@ static int getConfigAttrib(EGLConfig config, int attrib)
// Return a list of available and usable framebuffer configs
//
static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* desired,
EGLConfig* result)
static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* desired,
EGLConfig* result)
{
EGLConfig* nativeConfigs;
_GLFWfbconfig* usableConfigs;
@ -97,7 +97,7 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
if (!nativeCount)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned");
return GLFW_FALSE;
return GL_FALSE;
}
nativeConfigs = calloc(nativeCount, sizeof(EGLConfig));
@ -112,6 +112,12 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
const EGLConfig n = nativeConfigs[i];
_GLFWfbconfig* u = usableConfigs + usableCount;
#if defined(_GLFW_X11)
// Only consider EGLConfigs with associated visuals
if (!getConfigAttrib(n, EGL_NATIVE_VISUAL_ID))
continue;
#endif // _GLFW_X11
// Only consider RGB(A) EGLConfigs
if (!(getConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) & EGL_RGB_BUFFER))
continue;
@ -120,12 +126,6 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
if (!(getConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT))
continue;
#if defined(_GLFW_X11)
// Only consider EGLConfigs with associated Visuals
if (!getConfigAttrib(n, EGL_NATIVE_VISUAL_ID))
continue;
#endif // _GLFW_X11
if (ctxconfig->api == GLFW_OPENGL_ES_API)
{
if (ctxconfig->major == 1)
@ -154,7 +154,7 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
u->stencilBits = getConfigAttrib(n, EGL_STENCIL_SIZE);
u->samples = getConfigAttrib(n, EGL_SAMPLES);
u->doublebuffer = GLFW_TRUE;
u->doublebuffer = GL_TRUE;
u->egl = n;
usableCount++;
@ -167,7 +167,7 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
free(nativeConfigs);
free(usableConfigs);
return closest ? GLFW_TRUE : GLFW_FALSE;
return closest ? GL_TRUE : GL_FALSE;
}
@ -194,7 +194,7 @@ int _glfwInitContextAPI(void)
};
if (!_glfwCreateContextTLS())
return GLFW_FALSE;
return GL_FALSE;
for (i = 0; sonames[i]; i++)
{
@ -206,7 +206,7 @@ int _glfwInitContextAPI(void)
if (!_glfw.egl.handle)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to load EGL");
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.egl.GetConfigAttrib =
@ -249,7 +249,7 @@ int _glfwInitContextAPI(void)
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to get EGL display: %s",
getErrorString(_glfw_eglGetError()));
return GLFW_FALSE;
return GL_FALSE;
}
if (!_glfw_eglInitialize(_glfw.egl.display,
@ -259,15 +259,13 @@ int _glfwInitContextAPI(void)
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to initialize EGL: %s",
getErrorString(_glfw_eglGetError()));
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.egl.KHR_create_context =
_glfwPlatformExtensionSupported("EGL_KHR_create_context");
_glfw.egl.KHR_create_context_no_error =
_glfwPlatformExtensionSupported("EGL_KHR_create_context_no_error");
return GLFW_TRUE;
return GL_TRUE;
}
// Terminate EGL
@ -304,15 +302,64 @@ int _glfwCreateContext(_GLFWwindow* window,
EGLContext share = NULL;
if (ctxconfig->share)
share = ctxconfig->share->context.egl.handle;
share = ctxconfig->share->egl.context;
if (!chooseFBConfigs(ctxconfig, fbconfig, &config))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"EGL: Failed to find a suitable EGLConfig");
return GLFW_FALSE;
return GL_FALSE;
}
#if defined(_GLFW_X11)
// Retrieve the visual corresponding to the chosen EGL config
{
EGLint count = 0;
int mask;
EGLint redBits, greenBits, blueBits, alphaBits, visualID = 0;
XVisualInfo info;
_glfw_eglGetConfigAttrib(_glfw.egl.display, config,
EGL_NATIVE_VISUAL_ID, &visualID);
info.screen = _glfw.x11.screen;
mask = VisualScreenMask;
if (visualID)
{
// The X window visual must match the EGL config
info.visualid = visualID;
mask |= VisualIDMask;
}
else
{
// Some EGL drivers do not implement the EGL_NATIVE_VISUAL_ID
// attribute, so attempt to find the closest match
_glfw_eglGetConfigAttrib(_glfw.egl.display, config,
EGL_RED_SIZE, &redBits);
_glfw_eglGetConfigAttrib(_glfw.egl.display, config,
EGL_GREEN_SIZE, &greenBits);
_glfw_eglGetConfigAttrib(_glfw.egl.display, config,
EGL_BLUE_SIZE, &blueBits);
_glfw_eglGetConfigAttrib(_glfw.egl.display, config,
EGL_ALPHA_SIZE, &alphaBits);
info.depth = redBits + greenBits + blueBits + alphaBits;
mask |= VisualDepthMask;
}
window->egl.visual = XGetVisualInfo(_glfw.x11.display,
mask, &info, &count);
if (!window->egl.visual)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to retrieve visual for EGLConfig");
return GL_FALSE;
}
}
#endif // _GLFW_X11
if (ctxconfig->api == GLFW_OPENGL_ES_API)
{
if (!_glfw_eglBindAPI(EGL_OPENGL_ES_API))
@ -320,7 +367,7 @@ int _glfwCreateContext(_GLFWwindow* window,
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL ES: %s",
getErrorString(_glfw_eglGetError()));
return GLFW_FALSE;
return GL_FALSE;
}
}
else
@ -330,7 +377,7 @@ int _glfwCreateContext(_GLFWwindow* window,
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL: %s",
getErrorString(_glfw_eglGetError()));
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -347,12 +394,6 @@ int _glfwCreateContext(_GLFWwindow* window,
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
if (_glfw.egl.KHR_create_context_no_error)
{
if (ctxconfig->noerror)
flags |= EGL_CONTEXT_OPENGL_NO_ERROR_KHR;
}
}
if (ctxconfig->debug)
@ -401,31 +442,18 @@ int _glfwCreateContext(_GLFWwindow* window,
// Context release behaviors (GL_KHR_context_flush_control) are not yet
// supported on EGL but are not a hard constraint, so ignore and continue
window->context.egl.handle = _glfw_eglCreateContext(_glfw.egl.display,
config, share, attribs);
window->egl.context = _glfw_eglCreateContext(_glfw.egl.display,
config, share, attribs);
if (window->context.egl.handle == EGL_NO_CONTEXT)
if (window->egl.context == EGL_NO_CONTEXT)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"EGL: Failed to create context: %s",
getErrorString(_glfw_eglGetError()));
return GLFW_FALSE;
return GL_FALSE;
}
window->context.egl.surface =
_glfw_eglCreateWindowSurface(_glfw.egl.display,
config,
(EGLNativeWindowType)_GLFW_EGL_NATIVE_WINDOW,
NULL);
if (window->context.egl.surface == EGL_NO_SURFACE)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to create window surface: %s",
getErrorString(_glfw_eglGetError()));
return GLFW_FALSE;
}
window->context.egl.config = config;
window->egl.config = config;
// Load the appropriate client library
{
@ -478,20 +506,20 @@ int _glfwCreateContext(_GLFWwindow* window,
for (i = 0; sonames[i]; i++)
{
window->context.egl.client = _glfw_dlopen(sonames[i]);
if (window->context.egl.client)
window->egl.client = _glfw_dlopen(sonames[i]);
if (window->egl.client)
break;
}
if (!window->context.egl.client)
if (!window->egl.client)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to load client library");
return GLFW_FALSE;
return GL_FALSE;
}
}
return GLFW_TRUE;
return GL_TRUE;
}
#undef setEGLattrib
@ -506,68 +534,47 @@ void _glfwDestroyContext(_GLFWwindow* window)
if (window->context.api != GLFW_OPENGL_API)
#endif // _GLFW_X11
{
if (window->context.egl.client)
if (window->egl.client)
{
_glfw_dlclose(window->context.egl.client);
window->context.egl.client = NULL;
_glfw_dlclose(window->egl.client);
window->egl.client = NULL;
}
}
if (window->context.egl.surface)
{
_glfw_eglDestroySurface(_glfw.egl.display, window->context.egl.surface);
window->context.egl.surface = EGL_NO_SURFACE;
}
if (window->context.egl.handle)
{
_glfw_eglDestroyContext(_glfw.egl.display, window->context.egl.handle);
window->context.egl.handle = EGL_NO_CONTEXT;
}
}
// Returns the Visual and depth of the chosen EGLConfig
//
#if defined(_GLFW_X11)
GLFWbool _glfwChooseVisual(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,
Visual** visual, int* depth)
{
XVisualInfo* result;
XVisualInfo desired;
EGLConfig native;
EGLint visualID = 0, count = 0;
const long vimask = VisualScreenMask | VisualIDMask;
if (!chooseFBConfigs(ctxconfig, fbconfig, &native))
if (window->egl.visual)
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"EGL: Failed to find a suitable EGLConfig");
return GLFW_FALSE;
XFree(window->egl.visual);
window->egl.visual = NULL;
}
_glfw_eglGetConfigAttrib(_glfw.egl.display, native,
EGL_NATIVE_VISUAL_ID, &visualID);
desired.screen = _glfw.x11.screen;
desired.visualid = visualID;
result = XGetVisualInfo(_glfw.x11.display, vimask, &desired, &count);
if (!result)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to retrieve Visual for EGLConfig");
return GLFW_FALSE;
}
*visual = result->visual;
*depth = result->depth;
XFree(result);
return GLFW_TRUE;
}
#endif // _GLFW_X11
if (window->egl.surface)
{
_glfw_eglDestroySurface(_glfw.egl.display, window->egl.surface);
window->egl.surface = EGL_NO_SURFACE;
}
if (window->egl.context)
{
_glfw_eglDestroyContext(_glfw.egl.display, window->egl.context);
window->egl.context = EGL_NO_CONTEXT;
}
}
// Analyzes the specified context for possible recreation
//
int _glfwAnalyzeContext(const _GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
#if defined(_GLFW_WIN32)
return _GLFW_RECREATION_NOT_NEEDED;
#else
return 0;
#endif
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
@ -577,10 +584,25 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
{
if (window)
{
if (window->egl.surface == EGL_NO_SURFACE)
{
window->egl.surface =
_glfw_eglCreateWindowSurface(_glfw.egl.display,
window->egl.config,
(EGLNativeWindowType)_GLFW_EGL_NATIVE_WINDOW,
NULL);
if (window->egl.surface == EGL_NO_SURFACE)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to create window surface: %s",
getErrorString(_glfw_eglGetError()));
}
}
_glfw_eglMakeCurrent(_glfw.egl.display,
window->context.egl.surface,
window->context.egl.surface,
window->context.egl.handle);
window->egl.surface,
window->egl.surface,
window->egl.context);
}
else
{
@ -595,7 +617,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
_glfw_eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
_glfw_eglSwapBuffers(_glfw.egl.display, window->egl.surface);
}
void _glfwPlatformSwapInterval(int interval)
@ -610,20 +632,19 @@ int _glfwPlatformExtensionSupported(const char* extension)
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
return GL_TRUE;
}
return GLFW_FALSE;
return GL_FALSE;
}
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
if (window->context.egl.client)
if (window->egl.client)
{
GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->context.egl.client,
procname);
GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->egl.client, procname);
if (proc)
return proc;
}
@ -646,27 +667,13 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_CONTEXT;
}
return window->context.egl.handle;
return window->egl.context;
}
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_SURFACE;
}
return window->context.egl.surface;
return window->egl.surface;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 EGL - www.glfw.org
// GLFW 3.1 EGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -39,88 +39,12 @@
#define _glfw_dlsym(handle, name) dlsym(handle, name)
#endif
#if defined(_GLFW_USE_EGLPLATFORM_H)
#include <EGL/eglplatform.h>
#elif defined(_GLFW_WIN32)
#define EGLAPIENTRY __stdcall
typedef HDC EGLNativeDisplayType;
typedef HWND EGLNativeWindowType;
#elif defined(_GLFW_X11)
#define EGLAPIENTRY
typedef Display* EGLNativeDisplayType;
typedef Window EGLNativeWindowType;
#elif defined(_GLFW_WAYLAND)
#define EGLAPIENTRY
typedef struct wl_display* EGLNativeDisplayType;
typedef struct wl_egl_window* EGLNativeWindowType;
#elif defined(_GLFW_MIR)
#define EGLAPIENTRY
typedef MirEGLNativeDisplayType EGLNativeDisplayType;
typedef MirEGLNativeWindowType EGLNativeWindowType;
#else
#error "No supported EGL platform selected"
#endif
#include <EGL/egl.h>
#define EGL_SUCCESS 0x3000
#define EGL_NOT_INITIALIZED 0x3001
#define EGL_BAD_ACCESS 0x3002
#define EGL_BAD_ALLOC 0x3003
#define EGL_BAD_ATTRIBUTE 0x3004
#define EGL_BAD_CONFIG 0x3005
#define EGL_BAD_CONTEXT 0x3006
#define EGL_BAD_CURRENT_SURFACE 0x3007
#define EGL_BAD_DISPLAY 0x3008
#define EGL_BAD_MATCH 0x3009
#define EGL_BAD_NATIVE_PIXMAP 0x300a
#define EGL_BAD_NATIVE_WINDOW 0x300b
#define EGL_BAD_PARAMETER 0x300c
#define EGL_BAD_SURFACE 0x300d
#define EGL_CONTEXT_LOST 0x300e
#define EGL_COLOR_BUFFER_TYPE 0x303f
#define EGL_RGB_BUFFER 0x308e
#define EGL_SURFACE_TYPE 0x3033
#define EGL_WINDOW_BIT 0x0004
#define EGL_RENDERABLE_TYPE 0x3040
#define EGL_OPENGL_ES_BIT 0x0001
#define EGL_OPENGL_ES2_BIT 0x0004
#define EGL_OPENGL_BIT 0x0008
#define EGL_ALPHA_SIZE 0x3021
#define EGL_BLUE_SIZE 0x3022
#define EGL_GREEN_SIZE 0x3023
#define EGL_RED_SIZE 0x3024
#define EGL_DEPTH_SIZE 0x3025
#define EGL_STENCIL_SIZE 0x3026
#define EGL_SAMPLES 0x3031
#define EGL_OPENGL_ES_API 0x30a0
#define EGL_OPENGL_API 0x30a2
#define EGL_NONE 0x3038
#define EGL_EXTENSIONS 0x3055
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
#define EGL_CONTEXT_FLAGS_KHR 0x30fc
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
#define EGL_NATIVE_VISUAL_ID 0x302e
#define EGL_NO_SURFACE ((EGLSurface) 0)
#define EGL_NO_DISPLAY ((EGLDisplay) 0)
#define EGL_NO_CONTEXT ((EGLContext) 0)
typedef int EGLint;
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef void* EGLConfig;
typedef void* EGLContext;
typedef void* EGLDisplay;
typedef void* EGLSurface;
// This path may need to be changed if you build GLFW using your own setup
// We ship and use our own copy of eglext.h since GLFW uses fairly new
// extensions and not all operating systems come with an up-to-date version
#include "../deps/EGL/eglext.h"
// EGL function pointer typedefs
typedef EGLBoolean (EGLAPIENTRY * PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay,EGLConfig,EGLint,EGLint*);
@ -166,9 +90,13 @@ typedef GLFWglproc (EGLAPIENTRY * PFNEGLGETPROCADDRESSPROC)(const char*);
typedef struct _GLFWcontextEGL
{
EGLConfig config;
EGLContext handle;
EGLContext context;
EGLSurface surface;
#if defined(_GLFW_X11)
XVisualInfo* visual;
#endif
void* client;
} _GLFWcontextEGL;
@ -181,8 +109,7 @@ typedef struct _GLFWlibraryEGL
EGLDisplay display;
EGLint major, minor;
GLFWbool KHR_create_context;
GLFWbool KHR_create_context_no_error;
GLboolean KHR_create_context;
void* handle;
@ -212,10 +139,8 @@ int _glfwCreateContext(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContext(_GLFWwindow* window);
#if defined(_GLFW_X11)
GLFWbool _glfwChooseVisual(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,
Visual** visual, int* depth);
#endif /*_GLFW_X11*/
int _glfwAnalyzeContext(const _GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
#endif // _glfw3_egl_context_h_

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
//
@ -72,3 +72,10 @@
// Define this to 1 if windows should use full resolution on Retina displays
#cmakedefine _GLFW_USE_RETINA
// Define this to 1 if using OpenGL as the client library
#cmakedefine _GLFW_USE_OPENGL
// Define this to 1 if using OpenGL ES 1.1 as the client library
#cmakedefine _GLFW_USE_GLESV1
// Define this to 1 if using OpenGL ES 2.0 as the client library
#cmakedefine _GLFW_USE_GLESV2

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 GLX - www.glfw.org
// GLFW 3.1 GLX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -48,27 +48,27 @@ static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
// Return a list of available and usable framebuffer configs
//
static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result)
static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result)
{
GLXFBConfig* nativeConfigs;
_GLFWfbconfig* usableConfigs;
const _GLFWfbconfig* closest;
int i, nativeCount, usableCount;
const char* vendor;
GLFWbool trustWindowBit = GLFW_TRUE;
GLboolean trustWindowBit = GL_TRUE;
// HACK: This is a (hopefully temporary) workaround for Chromium
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
vendor = _glfw_glXGetClientString(_glfw.x11.display, GLX_VENDOR);
if (strcmp(vendor, "Chromium") == 0)
trustWindowBit = GLFW_FALSE;
trustWindowBit = GL_FALSE;
nativeConfigs = _glfw_glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen,
&nativeCount);
if (!nativeCount)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
return GLFW_FALSE;
return GL_FALSE;
}
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
@ -79,6 +79,10 @@ static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result
const GLXFBConfig n = nativeConfigs[i];
_GLFWfbconfig* u = usableConfigs + usableCount;
// Only consider GLXFBConfigs with associated visuals
if (!getFBConfigAttrib(n, GLX_VISUAL_ID))
continue;
// Only consider RGBA GLXFBConfigs
if (!(getFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
continue;
@ -106,9 +110,9 @@ static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result
u->auxBuffers = getFBConfigAttrib(n, GLX_AUX_BUFFERS);
if (getFBConfigAttrib(n, GLX_STEREO))
u->stereo = GLFW_TRUE;
u->stereo = GL_TRUE;
if (getFBConfigAttrib(n, GLX_DOUBLEBUFFER))
u->doublebuffer = GLFW_TRUE;
u->doublebuffer = GL_TRUE;
if (_glfw.glx.ARB_multisample)
u->samples = getFBConfigAttrib(n, GLX_SAMPLES);
@ -127,7 +131,7 @@ static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result
XFree(nativeConfigs);
free(usableConfigs);
return closest ? GLFW_TRUE : GLFW_FALSE;
return closest ? GL_TRUE : GL_FALSE;
}
// Create the OpenGL context using legacy API
@ -159,13 +163,13 @@ int _glfwInitContextAPI(void)
#endif
if (!_glfwCreateContextTLS())
return GLFW_FALSE;
return GL_FALSE;
_glfw.glx.handle = dlopen(soname, RTLD_LAZY | RTLD_GLOBAL);
if (!_glfw.glx.handle)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: %s", dlerror());
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.glx.GetFBConfigs =
@ -188,23 +192,19 @@ int _glfwInitContextAPI(void)
dlsym(_glfw.glx.handle, "glXQueryExtensionsString");
_glfw.glx.CreateNewContext =
dlsym(_glfw.glx.handle, "glXCreateNewContext");
_glfw.glx.CreateWindow =
dlsym(_glfw.glx.handle, "glXCreateWindow");
_glfw.glx.DestroyWindow =
dlsym(_glfw.glx.handle, "glXDestroyWindow");
_glfw.glx.GetVisualFromFBConfig =
dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
_glfw.glx.GetProcAddress =
dlsym(_glfw.glx.handle, "glXGetProcAddress");
_glfw.glx.GetProcAddressARB =
dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
_glfw.glx.GetVisualFromFBConfig =
dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
if (!_glfw_glXQueryExtension(_glfw.x11.display,
&_glfw.glx.errorBase,
&_glfw.glx.eventBase))
{
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found");
return GLFW_FALSE;
return GL_FALSE;
}
if (!_glfw_glXQueryVersion(_glfw.x11.display,
@ -213,14 +213,14 @@ int _glfwInitContextAPI(void)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"GLX: Failed to query GLX version");
return GLFW_FALSE;
return GL_FALSE;
}
if (_glfw.glx.major == 1 && _glfw.glx.minor < 3)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"GLX: GLX version 1.3 is required");
return GLFW_FALSE;
return GL_FALSE;
}
if (_glfwPlatformExtensionSupported("GLX_EXT_swap_control"))
@ -229,7 +229,7 @@ int _glfwInitContextAPI(void)
_glfwPlatformGetProcAddress("glXSwapIntervalEXT");
if (_glfw.glx.SwapIntervalEXT)
_glfw.glx.EXT_swap_control = GLFW_TRUE;
_glfw.glx.EXT_swap_control = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_SGI_swap_control"))
@ -238,7 +238,7 @@ int _glfwInitContextAPI(void)
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
if (_glfw.glx.SwapIntervalSGI)
_glfw.glx.SGI_swap_control = GLFW_TRUE;
_glfw.glx.SGI_swap_control = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control"))
@ -247,17 +247,17 @@ int _glfwInitContextAPI(void)
_glfwPlatformGetProcAddress("glXSwapIntervalMESA");
if (_glfw.glx.SwapIntervalMESA)
_glfw.glx.MESA_swap_control = GLFW_TRUE;
_glfw.glx.MESA_swap_control = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
_glfw.glx.ARB_multisample = GLFW_TRUE;
_glfw.glx.ARB_multisample = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_ARB_framebuffer_sRGB"))
_glfw.glx.ARB_framebuffer_sRGB = GLFW_TRUE;
_glfw.glx.ARB_framebuffer_sRGB = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_EXT_framebuffer_sRGB"))
_glfw.glx.EXT_framebuffer_sRGB = GLFW_TRUE;
_glfw.glx.EXT_framebuffer_sRGB = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
{
@ -265,22 +265,22 @@ int _glfwInitContextAPI(void)
_glfwPlatformGetProcAddress("glXCreateContextAttribsARB");
if (_glfw.glx.CreateContextAttribsARB)
_glfw.glx.ARB_create_context = GLFW_TRUE;
_glfw.glx.ARB_create_context = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_robustness"))
_glfw.glx.ARB_create_context_robustness = GLFW_TRUE;
_glfw.glx.ARB_create_context_robustness = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_profile"))
_glfw.glx.ARB_create_context_profile = GLFW_TRUE;
_glfw.glx.ARB_create_context_profile = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_EXT_create_context_es2_profile"))
_glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE;
_glfw.glx.EXT_create_context_es2_profile = GL_TRUE;
if (_glfwPlatformExtensionSupported("GLX_ARB_context_flush_control"))
_glfw.glx.ARB_context_flush_control = GLFW_TRUE;
_glfw.glx.ARB_context_flush_control = GL_TRUE;
return GLFW_TRUE;
return GL_TRUE;
}
// Terminate GLX
@ -317,13 +317,22 @@ int _glfwCreateContext(_GLFWwindow* window,
GLXContext share = NULL;
if (ctxconfig->share)
share = ctxconfig->share->context.glx.handle;
share = ctxconfig->share->glx.context;
if (!chooseFBConfig(fbconfig, &native))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"GLX: Failed to find a suitable GLXFBConfig");
return GLFW_FALSE;
return GL_FALSE;
}
window->glx.visual = _glfw_glXGetVisualFromFBConfig(_glfw.x11.display,
native);
if (!window->glx.visual)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"GLX: Failed to retrieve visual for GLXFBConfig");
return GL_FALSE;
}
if (ctxconfig->api == GLFW_OPENGL_ES_API)
@ -334,7 +343,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable");
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -344,7 +353,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable");
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -355,7 +364,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable");
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -380,8 +389,6 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->debug)
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->noerror)
flags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
if (ctxconfig->robustness)
{
@ -436,7 +443,7 @@ int _glfwCreateContext(_GLFWwindow* window,
setGLXattrib(None, None);
window->context.glx.handle =
window->glx.context =
_glfw.glx.CreateContextAttribsARB(_glfw.x11.display,
native,
share,
@ -447,38 +454,29 @@ int _glfwCreateContext(_GLFWwindow* window,
// implementation of GLX_ARB_create_context_profile that fail
// default 1.0 context creation with a GLXBadProfileARB error in
// violation of the extension spec
if (!window->context.glx.handle)
if (!window->glx.context)
{
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
ctxconfig->api == GLFW_OPENGL_API &&
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
ctxconfig->forward == GLFW_FALSE)
ctxconfig->forward == GL_FALSE)
{
window->context.glx.handle =
createLegacyContext(window, native, share);
window->glx.context = createLegacyContext(window, native, share);
}
}
}
else
window->context.glx.handle = createLegacyContext(window, native, share);
window->glx.context = createLegacyContext(window, native, share);
_glfwReleaseXErrorHandler();
if (!window->context.glx.handle)
if (!window->glx.context)
{
_glfwInputXError(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context");
return GLFW_FALSE;
return GL_FALSE;
}
window->context.glx.window = _glfw_glXCreateWindow(_glfw.x11.display, native,
window->x11.handle, NULL);
if (!window->context.glx.window)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to create window");
return GLFW_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
#undef setGLXattrib
@ -487,50 +485,19 @@ int _glfwCreateContext(_GLFWwindow* window,
//
void _glfwDestroyContext(_GLFWwindow* window)
{
if (window->context.glx.window)
if (window->glx.visual)
{
_glfw_glXDestroyWindow(_glfw.x11.display, window->context.glx.window);
window->context.glx.window = None;
XFree(window->glx.visual);
window->glx.visual = NULL;
}
if (window->context.glx.handle)
if (window->glx.context)
{
_glfw_glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
window->context.glx.handle = NULL;
_glfw_glXDestroyContext(_glfw.x11.display, window->glx.context);
window->glx.context = NULL;
}
}
// Returns the Visual and depth of the chosen GLXFBConfig
//
GLFWbool _glfwChooseVisual(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,
Visual** visual, int* depth)
{
GLXFBConfig native;
XVisualInfo* result;
if (!chooseFBConfig(fbconfig, &native))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"GLX: Failed to find a suitable GLXFBConfig");
return GLFW_FALSE;
}
result = _glfw_glXGetVisualFromFBConfig(_glfw.x11.display, native);
if (!result)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"GLX: Failed to retrieve Visual for GLXFBConfig");
return GLFW_FALSE;
}
*visual = result->visual;
*depth = result->depth;
XFree(result);
return GLFW_TRUE;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
@ -541,8 +508,8 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
if (window)
{
_glfw_glXMakeCurrent(_glfw.x11.display,
window->context.glx.window,
window->context.glx.handle);
window->x11.handle,
window->glx.context);
}
else
_glfw_glXMakeCurrent(_glfw.x11.display, None, NULL);
@ -552,7 +519,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
_glfw_glXSwapBuffers(_glfw.x11.display, window->context.glx.window);
_glfw_glXSwapBuffers(_glfw.x11.display, window->x11.handle);
}
void _glfwPlatformSwapInterval(int interval)
@ -562,7 +529,7 @@ void _glfwPlatformSwapInterval(int interval)
if (_glfw.glx.EXT_swap_control)
{
_glfw.glx.SwapIntervalEXT(_glfw.x11.display,
window->context.glx.window,
window->x11.handle,
interval);
}
else if (_glfw.glx.MESA_swap_control)
@ -581,10 +548,10 @@ int _glfwPlatformExtensionSupported(const char* extension)
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
return GL_TRUE;
}
return GLFW_FALSE;
return GL_FALSE;
}
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
@ -606,27 +573,6 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
return window->context.glx.handle;
}
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(None);
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return None;
}
return window->context.glx.window;
return window->glx.context;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 GLX - www.glfw.org
// GLFW 3.1 GLX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -28,51 +28,16 @@
#ifndef _glfw3_glx_context_h_
#define _glfw3_glx_context_h_
#define GLX_VENDOR 1
#define GLX_RGBA_BIT 0x00000001
#define GLX_WINDOW_BIT 0x00000001
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_RGBA_TYPE 0x8014
#define GLX_DOUBLEBUFFER 5
#define GLX_STEREO 6
#define GLX_AUX_BUFFERS 7
#define GLX_RED_SIZE 8
#define GLX_GREEN_SIZE 9
#define GLX_BLUE_SIZE 10
#define GLX_ALPHA_SIZE 11
#define GLX_DEPTH_SIZE 12
#define GLX_STENCIL_SIZE 13
#define GLX_ACCUM_RED_SIZE 14
#define GLX_ACCUM_GREEN_SIZE 15
#define GLX_ACCUM_BLUE_SIZE 16
#define GLX_ACCUM_ALPHA_SIZE 17
#define GLX_SAMPLES 0x186a1
#define GLX_VISUAL_ID 0x800b
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
#define GLX_CONTEXT_FLAGS_ARB 0x2094
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#define GLX_GLXEXT_LEGACY
#include <GL/glx.h>
typedef XID GLXWindow;
typedef XID GLXDrawable;
typedef struct __GLXFBConfig* GLXFBConfig;
typedef struct __GLXcontext* GLXContext;
typedef void (*__GLXextproc)(void);
// This path may need to be changed if you build GLFW using your own setup
// We ship and use our own copy of glxext.h since GLFW uses fairly new
// extensions and not all operating systems come with an up-to-date version
#define GLX_GLXEXT_PROTOTYPES
#include "../deps/GL/glxext.h"
// libGL.so function pointer typedefs
typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*);
typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int);
typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*);
@ -81,18 +46,6 @@ typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext);
typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext);
typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable);
typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int);
typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*);
typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool);
typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int);
typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int);
typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*);
typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig);
typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*);
typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow);
// libGL.so function pointer typedefs
#define _glfw_glXGetFBConfigs _glfw.glx.GetFBConfigs
#define _glfw_glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib
#define _glfw_glXGetClientString _glfw.glx.GetClientString
@ -104,20 +57,24 @@ typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow);
#define _glfw_glXQueryExtensionsString _glfw.glx.QueryExtensionsString
#define _glfw_glXCreateNewContext _glfw.glx.CreateNewContext
#define _glfw_glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig
#define _glfw_glXCreateWindow _glfw.glx.CreateWindow
#define _glfw_glXDestroyWindow _glfw.glx.DestroyWindow
#define _GLFW_PLATFORM_FBCONFIG GLXFBConfig glx
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX glx
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx
#ifndef GLX_MESA_swap_control
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
#endif
// GLX-specific per-context data
//
typedef struct _GLFWcontextGLX
{
GLXContext handle;
GLXWindow window;
// Rendering context
GLXContext context;
// Visual of selected GLXFBConfig
XVisualInfo* visual;
} _GLFWcontextGLX;
@ -145,8 +102,6 @@ typedef struct _GLFWlibraryGLX
PFNGLXQUERYEXTENSIONSSTRINGPROC QueryExtensionsString;
PFNGLXCREATENEWCONTEXTPROC CreateNewContext;
PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig;
PFNGLXCREATEWINDOWPROC CreateWindow;
PFNGLXDESTROYWINDOWPROC DestroyWindow;
// GLX 1.4 and extension functions
PFNGLXGETPROCADDRESSPROC GetProcAddress;
@ -155,17 +110,17 @@ typedef struct _GLFWlibraryGLX
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLFWbool SGI_swap_control;
GLFWbool EXT_swap_control;
GLFWbool MESA_swap_control;
GLFWbool ARB_multisample;
GLFWbool ARB_framebuffer_sRGB;
GLFWbool EXT_framebuffer_sRGB;
GLFWbool ARB_create_context;
GLFWbool ARB_create_context_profile;
GLFWbool ARB_create_context_robustness;
GLFWbool EXT_create_context_es2_profile;
GLFWbool ARB_context_flush_control;
GLboolean SGI_swap_control;
GLboolean EXT_swap_control;
GLboolean MESA_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_framebuffer_sRGB;
GLboolean EXT_framebuffer_sRGB;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;
GLboolean ARB_create_context_robustness;
GLboolean EXT_create_context_es2_profile;
GLboolean ARB_context_flush_control;
} _GLFWlibraryGLX;
@ -176,8 +131,5 @@ int _glfwCreateContext(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContext(_GLFWwindow* window);
GLFWbool _glfwChooseVisual(const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig,
Visual** visual, int* depth);
#endif // _glfw3_glx_context_h_

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -39,7 +39,7 @@
// Global state shared between compilation units of GLFW
// These are documented in internal.h
//
GLFWbool _glfwInitialized = GLFW_FALSE;
GLboolean _glfwInitialized = GL_FALSE;
_GLFWlibrary _glfw;
// This is outside of _glfw so it can be initialized and usable before
@ -72,8 +72,6 @@ static const char* getErrorString(int error)
return "A platform-specific error occurred";
case GLFW_FORMAT_UNAVAILABLE:
return "The requested format is unavailable";
case GLFW_NO_WINDOW_CONTEXT:
return "The specified window has no context";
}
return "ERROR: UNKNOWN ERROR TOKEN PASSED TO glfwErrorString";
@ -120,23 +118,23 @@ void _glfwInputError(int error, const char* format, ...)
GLFWAPI int glfwInit(void)
{
if (_glfwInitialized)
return GLFW_TRUE;
return GL_TRUE;
memset(&_glfw, 0, sizeof(_glfw));
if (!_glfwPlatformInit())
{
_glfwPlatformTerminate();
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount);
_glfwInitialized = GLFW_TRUE;
_glfwInitialized = GL_TRUE;
// Not all window hints have zero as their default value
glfwDefaultWindowHints();
return GLFW_TRUE;
return GL_TRUE;
}
GLFWAPI void glfwTerminate(void)
@ -168,7 +166,7 @@ GLFWAPI void glfwTerminate(void)
_glfwPlatformTerminate();
memset(&_glfw, 0, sizeof(_glfw));
_glfwInitialized = GLFW_FALSE;
_glfwInitialized = GL_FALSE;
}
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -78,7 +78,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
_glfwPlatformSetCursorPos(window, width / 2, height / 2);
}
_glfwPlatformSetCursorMode(window, window->cursorMode);
_glfwPlatformApplyCursorMode(window);
}
}
@ -135,13 +135,13 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
{
if (key >= 0 && key <= GLFW_KEY_LAST)
{
GLFWbool repeated = GLFW_FALSE;
GLboolean repeated = GL_FALSE;
if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE)
return;
if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS)
repeated = GLFW_TRUE;
repeated = GL_TRUE;
if (action == GLFW_RELEASE && window->stickyKeys)
window->keys[key] = _GLFW_STICK;
@ -156,7 +156,14 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
}
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain)
//EDIT
void _glfwInputMenuItem(_GLFWwindow* window, int id)
{
if (window->callbacks.menuitem)
window->callbacks.menuitem((GLFWwindow*)window, id);
}
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain)
{
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
return;
@ -210,7 +217,7 @@ void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y)
window->callbacks.cursorPos((GLFWwindow*) window, x, y);
}
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered)
void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
{
if (window->callbacks.cursorEnter)
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
@ -223,18 +230,6 @@ void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwIsPrintable(int key)
{
return (key >= GLFW_KEY_APOSTROPHE && key <= GLFW_KEY_WORLD_2) ||
(key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_ADD) ||
key == GLFW_KEY_KP_EQUAL;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
@ -271,10 +266,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
setCursorMode(window, value);
break;
case GLFW_STICKY_KEYS:
setStickyKeys(window, value ? GLFW_TRUE : GLFW_FALSE);
setStickyKeys(window, value ? GL_TRUE : GL_FALSE);
break;
case GLFW_STICKY_MOUSE_BUTTONS:
setStickyMouseButtons(window, value ? GLFW_TRUE : GLFW_FALSE);
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
break;
default:
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
@ -282,12 +277,6 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
}
}
GLFWAPI const char* glfwGetKeyName(int key, int scancode)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfwPlatformGetKeyName(key, scancode);
}
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
@ -473,6 +462,15 @@ GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
window->cursor = cursor;
}
//EDIT
GLFWAPI GLFWmenufun glfwSetMenuCallback(GLFWwindow* handle, GLFWmenufun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*)handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.menuitem, cbfun);
return cbfun;
}
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -33,6 +33,8 @@
#include "glfw_config.h"
#endif
#define _GLFW_VERSION_NUMBER "3.1.2"
#if defined(GLFW_INCLUDE_GLCOREARB) || \
defined(GLFW_INCLUDE_ES1) || \
defined(GLFW_INCLUDE_ES2) || \
@ -44,49 +46,41 @@
#error "You may not define any header option macros when compiling GLFW"
#endif
#define GLFW_INCLUDE_NONE
#if defined(_GLFW_USE_OPENGL)
// This is the default for glfw3.h
#elif defined(_GLFW_USE_GLESV1)
#define GLFW_INCLUDE_ES1
#elif defined(_GLFW_USE_GLESV2)
#define GLFW_INCLUDE_ES2
#else
#error "No supported client library selected"
#endif
// Disable the inclusion of the platform glext.h by gl.h to allow proper
// inclusion of our own, newer glext.h below
#define GL_GLEXT_LEGACY
#include "../include/GLFW/glfw3.h"
#define GL_VERSION 0x1f02
#define GL_NONE 0
#define GL_COLOR_BUFFER_BIT 0x00004000
#define GL_EXTENSIONS 0x1f03
#define GL_NUM_EXTENSIONS 0x821d
#define GL_CONTEXT_FLAGS 0x821e
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
#define GL_CONTEXT_PROFILE_MASK 0x9126
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
typedef int GLint;
typedef unsigned int GLuint;
typedef unsigned int GLenum;
typedef unsigned int GLbitfield;
typedef unsigned char GLubyte;
#if defined(_GLFW_USE_OPENGL)
// This path may need to be changed if you build GLFW using your own setup
// GLFW comes with its own copy of glext.h since it uses fairly new extensions
// and not all development environments come with an up-to-date version
#include "../deps/GL/glext.h"
#endif
typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
typedef struct _GLFWwndconfig _GLFWwndconfig;
typedef struct _GLFWctxconfig _GLFWctxconfig;
typedef struct _GLFWfbconfig _GLFWfbconfig;
typedef struct _GLFWcontext _GLFWcontext;
typedef struct _GLFWwindow _GLFWwindow;
typedef struct _GLFWlibrary _GLFWlibrary;
typedef struct _GLFWmonitor _GLFWmonitor;
typedef struct _GLFWcursor _GLFWcursor;
typedef int GLFWbool;
#if defined(_GLFW_COCOA)
#include "cocoa_platform.h"
#elif defined(_GLFW_WIN32)
@ -133,13 +127,6 @@ typedef int GLFWbool;
// Helper macros
//========================================================================
// Constructs a version number string from the public header macros
#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
#define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \
GLFW_VERSION_MINOR, \
GLFW_VERSION_REVISION)
// Checks for whether the library has been initialized
#define _GLFW_REQUIRE_INIT() \
if (!_glfwInitialized) \
@ -179,12 +166,12 @@ struct _GLFWwndconfig
int width;
int height;
const char* title;
GLFWbool resizable;
GLFWbool visible;
GLFWbool decorated;
GLFWbool focused;
GLFWbool autoIconify;
GLFWbool floating;
GLboolean resizable;
GLboolean visible;
GLboolean decorated;
GLboolean focused;
GLboolean autoIconify;
GLboolean floating;
_GLFWmonitor* monitor;
};
@ -200,9 +187,8 @@ struct _GLFWctxconfig
int api;
int major;
int minor;
GLFWbool forward;
GLFWbool debug;
GLFWbool noerror;
GLboolean forward;
GLboolean debug;
int profile;
int robustness;
int release;
@ -241,26 +227,6 @@ struct _GLFWfbconfig
};
/*! @brief Context structure.
*/
struct _GLFWcontext
{
int api;
int major, minor, revision;
GLFWbool forward, debug, noerror;
int profile;
int robustness;
int release;
PFNGLGETSTRINGIPROC GetStringi;
PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETSTRINGPROC GetString;
// This is defined in the context API's context.h
_GLFW_PLATFORM_CONTEXT_STATE;
};
/*! @brief Window and context structure.
*/
struct _GLFWwindow
@ -268,25 +234,40 @@ struct _GLFWwindow
struct _GLFWwindow* next;
// Window settings and state
GLFWbool resizable;
GLFWbool decorated;
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool closed;
GLboolean resizable;
GLboolean decorated;
GLboolean autoIconify;
GLboolean floating;
GLboolean closed;
void* userPointer;
GLFWvidmode videoMode;
_GLFWmonitor* monitor;
_GLFWcursor* cursor;
// Window input state
GLFWbool stickyKeys;
GLFWbool stickyMouseButtons;
GLboolean stickyKeys;
GLboolean stickyMouseButtons;
double cursorPosX, cursorPosY;
int cursorMode;
char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
char keys[GLFW_KEY_LAST + 1];
_GLFWcontext context;
// OpenGL extensions and context attributes
struct {
int api;
int major, minor, revision;
GLboolean forward, debug;
int profile;
int robustness;
int release;
} context;
#if defined(_GLFW_USE_OPENGL)
PFNGLGETSTRINGIPROC GetStringi;
#endif
PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETSTRINGPROC GetString;
PFNGLCLEARPROC Clear;
struct {
GLFWwindowposfun pos;
@ -301,6 +282,7 @@ struct _GLFWwindow
GLFWcursorenterfun cursorEnter;
GLFWscrollfun scroll;
GLFWkeyfun key;
GLFWmenufun menuitem;
GLFWcharfun character;
GLFWcharmodsfun charmods;
GLFWdropfun drop;
@ -308,6 +290,8 @@ struct _GLFWwindow
// This is defined in the window API's platform.h
_GLFW_PLATFORM_WINDOW_STATE;
// This is defined in the context API's context.h
_GLFW_PLATFORM_CONTEXT_STATE;
};
@ -386,7 +370,7 @@ struct _GLFWlibrary
/*! @brief Flag indicating whether GLFW has been successfully initialized.
*/
extern GLFWbool _glfwInitialized;
extern GLboolean _glfwInitialized;
/*! @brief All global data protected by @ref _glfwInitialized.
* This should only be touched after a call to @ref glfwInit that has not been
@ -400,7 +384,7 @@ extern _GLFWlibrary _glfw;
//========================================================================
/*! @brief Initializes the platform-specific part of the library.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an error occurred.
* @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred.
* @ingroup platform
*/
int _glfwPlatformInit(void);
@ -429,16 +413,11 @@ void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
*/
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
/*! @brief Sets the specified cursor mode of the specified window.
* @param[in] window The window whose cursor mode to set.
/*! @brief Applies the cursor mode of the specified window to the system.
* @param[in] window The window whose cursor mode to apply.
* @ingroup platform
*/
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
/*! @copydoc glfwGetKeyName
* @ingroup platform
*/
const char* _glfwPlatformGetKeyName(int key, int scancode);
void _glfwPlatformApplyCursorMode(_GLFWwindow* window);
/*! @copydoc glfwGetMonitors
* @ingroup platform
@ -449,11 +428,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count);
*
* @param[in] first The first monitor.
* @param[in] second The second monitor.
* @return @c GLFW_TRUE if the monitor objects represent the same monitor, or
* @c GLFW_FALSE otherwise.
* @return @c GL_TRUE if the monitor objects represent the same monitor, or @c
* GL_FALSE otherwise.
* @ingroup platform
*/
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second);
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second);
/*! @copydoc glfwGetMonitorPos
* @ingroup platform
@ -558,16 +537,6 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height);
*/
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
/*! @copydoc glfwSetWindowSizeLimits
* @ingroup platform
*/
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
/*! @copydoc glfwSetWindowAspectRatio
* @ingroup platform
*/
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom);
/*! @copydoc glfwGetFramebufferSize
* @ingroup platform
*/
@ -689,11 +658,11 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
/*! @brief Notifies shared code of a window focus event.
* @param[in] window The window that received the event.
* @param[in] focused `GLFW_TRUE` if the window received focus, or `GLFW_FALSE`
* @param[in] focused `GL_TRUE` if the window received focus, or `GL_FALSE`
* if it lost focus.
* @ingroup event
*/
void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused);
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused);
/*! @brief Notifies shared code of a window movement event.
* @param[in] window The window that received the event.
@ -721,11 +690,11 @@ void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height);
/*! @brief Notifies shared code of a window iconification event.
* @param[in] window The window that received the event.
* @param[in] iconified `GLFW_TRUE` if the window was iconified, or
* `GLFW_FALSE` if it was restored.
* @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`
* if it was restored.
* @ingroup event
*/
void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified);
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
/*! @brief Notifies shared code of a window damage event.
* @param[in] window The window that received the event.
@ -738,6 +707,13 @@ void _glfwInputWindowDamage(_GLFWwindow* window);
*/
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
/*! @brief Notifies shared code of a menu item event.
* @param[in] window The Window that received the event.
* @param[in] id The ID of the menu item
* @ingroup event
*/
void _glfwInputMenuItem(_GLFWwindow* window, int id);
/*! @brief Notifies shared code of a physical key event.
* @param[in] window The window that received the event.
* @param[in] key The key that was pressed or released.
@ -752,11 +728,11 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
* @param[in] window The window that received the event.
* @param[in] codepoint The Unicode code point of the input character.
* @param[in] mods Bit field describing which modifier keys were held down.
* @param[in] plain `GLFW_TRUE` if the character is regular text input, or
* `GLFW_FALSE` otherwise.
* @param[in] plain `GL_TRUE` if the character is regular text input, or
* `GL_FALSE` otherwise.
* @ingroup event
*/
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain);
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain);
/*! @brief Notifies shared code of a scroll event.
* @param[in] window The window that received the event.
@ -786,11 +762,11 @@ void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y);
/*! @brief Notifies shared code of a cursor enter/leave event.
* @param[in] window The window that received the event.
* @param[in] entered `GLFW_TRUE` if the cursor entered the client area of the
* window, or `GLFW_FALSE` if it left it.
* @param[in] entered `GL_TRUE` if the cursor entered the client area of the
* window, or `GL_FALSE` if it left it.
* @ingroup event
*/
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered);
void _glfwInputCursorEnter(_GLFWwindow* window, int entered);
/*! @ingroup event
*/
@ -802,11 +778,7 @@ void _glfwInputMonitorChange(void);
* description.
* @ingroup event
*/
#if defined(__GNUC__)
void _glfwInputError(int error, const char* format, ...) __attribute__((format(printf, 2, 3)));
#else
void _glfwInputError(int error, const char* format, ...);
#endif
/*! @brief Notifies dropped object over window.
* @param[in] window The window that received the event.
@ -839,10 +811,10 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
/*! @brief Searches an extension string for the specified extension.
* @param[in] string The extension string to search.
* @param[in] extensions The extension to search for.
* @return `GLFW_TRUE` if the extension was found, or `GLFW_FALSE` otherwise.
* @return `GL_TRUE` if the extension was found, or `GL_FALSE` otherwise.
* @ingroup utility
*/
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions);
int _glfwStringInExtensionString(const char* string, const char* extensions);
/*! @brief Chooses the framebuffer config that best matches the desired one.
* @param[in] desired The desired framebuffer config.
@ -858,15 +830,14 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
/*! @brief Retrieves the attributes of the current context.
* @param[in] ctxconfig The desired context attributes.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if the context is
* unusable.
* @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable.
* @ingroup utility
*/
GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig);
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig);
/*! @brief Checks whether the desired context attributes are valid.
* @param[in] ctxconfig The context attributes to check.
* @return `GLFW_TRUE` if the context attributes are valid, or `GLFW_FALSE`
* @return `GL_TRUE` if the context attributes are valid, or `GL_FALSE`
* otherwise.
* @ingroup utility
*
@ -874,16 +845,16 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig);
* exists and whether all relevant options have supported and non-conflicting
* values.
*/
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
/*! @brief Checks whether the current context fulfils the specified hard
* constraints.
* @param[in] ctxconfig The desired context attributes.
* @return `GLFW_TRUE` if the context fulfils the hard constraints, or
* `GLFW_FALSE` otherwise.
* @return `GL_TRUE` if the context fulfils the hard constraints, or `GL_FALSE`
* otherwise.
* @ingroup utility
*/
GLFWbool _glfwIsValidContext(const _GLFWctxconfig* ctxconfig);
GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig);
/*! @ingroup utility
*/
@ -912,8 +883,4 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor);
*/
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count);
/*! @ingroup utility
*/
int _glfwIsPrintable(int key);
#endif // _glfw3_internal_h_

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 IOKit - www.glfw.org
// GLFW 3.1 IOKit - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2014 Camilla Berglund <elmindreda@elmindreda.org>
//

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 IOKit - www.glfw.org
// GLFW 3.1 IOKit - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
@ -286,7 +286,7 @@ static void matchCallback(void* context,
if (joy > GLFW_JOYSTICK_LAST)
return;
joystick->present = GLFW_TRUE;
joystick->present = GL_TRUE;
joystick->deviceRef = deviceRef;
CFStringRef name = IOHIDDeviceGetProperty(deviceRef,

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Linux - www.glfw.org
// GLFW 3.1 Linux - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -100,7 +100,7 @@ static void openJoystickDevice(const char* path)
_glfw.linux_js.js[joy].axes = calloc(axisCount, sizeof(float));
_glfw.linux_js.js[joy].buttons = calloc(buttonCount, 1);
_glfw.linux_js.js[joy].present = GLFW_TRUE;
_glfw.linux_js.js[joy].present = GL_TRUE;
#endif // __linux__
}
@ -199,7 +199,7 @@ int _glfwInitJoysticks(void)
_glfwInputError(GLFW_PLATFORM_ERROR,
"Linux: Failed to initialize inotify: %s",
strerror(errno));
return GLFW_FALSE;
return GL_FALSE;
}
// HACK: Register for IN_ATTRIB as well to get notified when udev is done
@ -220,7 +220,7 @@ int _glfwInitJoysticks(void)
if (regcomp(&_glfw.linux_js.regex, "^js[0-9]\\+$", 0) != 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
return GLFW_FALSE;
return GL_FALSE;
}
dir = opendir(dirname);
@ -253,7 +253,7 @@ int _glfwInitJoysticks(void)
#endif // __linux__
return GLFW_TRUE;
return GL_TRUE;
}
// Close all opened joystick handles

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Linux - www.glfw.org
// GLFW 3.1 Linux - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
//

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Mir - www.glfw.org
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//
@ -46,14 +46,14 @@ int _glfwPlatformInit(void)
"Mir: Unable to connect to server: %s",
mir_connection_get_error_message(_glfw.mir.connection));
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.mir.display =
mir_connection_get_egl_native_display(_glfw.mir.connection);
if (!_glfwInitContextAPI())
return GLFW_FALSE;
return GL_FALSE;
// Need the default conf for when we set a NULL cursor
_glfw.mir.default_conf = mir_cursor_configuration_from_name(mir_arrow_cursor_name);
@ -70,10 +70,10 @@ int _glfwPlatformInit(void)
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Failed to create event mutex: %s",
strerror(error));
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformTerminate(void)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Mir - www.glfw.org
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//
@ -73,7 +73,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return monitors;
}
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
return first->mir.output_id == second->mir.output_id;
}
@ -168,15 +168,3 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwGetMirMonitor(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(0);
return monitor->mir.output_id;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Mir - www.glfw.org
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Mir - www.glfw.org
// GLFW 3.1 Mir - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014-2015 Brandon Schaefer <brandon.schaefer@canonical.com>
//
@ -44,9 +44,9 @@ static void deleteNode(EventQueue* queue, EventNode* node)
free(node);
}
static GLFWbool emptyEventQueue(EventQueue* queue)
static int emptyEventQueue(EventQueue* queue)
{
return queue->head.tqh_first == NULL;
return queue->head.tqh_first == NULL ? GL_TRUE : GL_FALSE;
}
// TODO The mir_event_ref is not supposed to be used but ... its needed
@ -385,7 +385,7 @@ static void addNewEvent(MirSurface* surface, const MirEvent* event, void* contex
enqueueEvent(event, context);
}
static GLFWbool createSurface(_GLFWwindow* window)
static int createSurface(_GLFWwindow* window)
{
MirSurfaceSpec* spec;
MirBufferUsage buffer_usage = mir_buffer_usage_hardware;
@ -395,7 +395,7 @@ static GLFWbool createSurface(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unable to find a correct pixel format");
return GLFW_FALSE;
return GL_FALSE;
}
spec = mir_connection_create_spec_for_normal_surface(_glfw.mir.connection,
@ -415,12 +415,12 @@ static GLFWbool createSurface(_GLFWwindow* window)
"Mir: Unable to create surface: %s",
mir_surface_get_error_message(window->mir.surface));
return GLFW_FALSE;
return GL_FALSE;
}
mir_surface_set_event_handler(window->mir.surface, addNewEvent, window);
return GLFW_TRUE;
return GL_TRUE;
}
//////////////////////////////////////////////////////////////////////////
@ -462,11 +462,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (ctxconfig->api != GLFW_NO_API)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GL_FALSE;
if (wndconfig->monitor)
{
@ -481,7 +478,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
"Mir: Requested surface size too large: %ix%i",
wndconfig->width, wndconfig->height);
return GLFW_FALSE;
return GL_FALSE;
}
}
@ -489,12 +486,12 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
window->mir.height = wndconfig->height;
if (!createSurface(window))
return GLFW_FALSE;
return GL_FALSE;
window->mir.window = mir_buffer_stream_get_egl_native_window(
mir_surface_get_buffer_stream(window->mir.surface));
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
@ -532,20 +529,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
mir_surface_spec_release(spec);
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@ -616,14 +599,14 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GLFW_FALSE;
return GL_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GLFW_FALSE;
return GL_FALSE;
}
int _glfwPlatformWindowVisible(_GLFWwindow* window)
@ -681,7 +664,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unable to find a correct pixel format");
return GLFW_FALSE;
return GL_FALSE;
}
stream = mir_connection_create_buffer_stream_sync(_glfw.mir.connection,
@ -716,7 +699,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
cursor->mir.custom_cursor = stream;
return GLFW_TRUE;
return GL_TRUE;
}
const char* getSystemCursorName(int shape)
@ -749,10 +732,10 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
cursor->mir.conf = mir_cursor_configuration_from_name(cursor_name);
cursor->mir.custom_cursor = NULL;
return GLFW_TRUE;
return GL_TRUE;
}
return GLFW_FALSE;
return GL_FALSE;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
@ -796,19 +779,12 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
const char* _glfwPlatformGetKeyName(int key, int scancode)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return NULL;
}
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@ -823,21 +799,3 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
return NULL;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI MirConnection* glfwGetMirDisplay(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfw.mir.connection;
}
GLFWAPI MirSurface* glfwGetMirWindow(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return window->mir.surface;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -60,17 +60,17 @@ static int compareVideoModes(const void* firstPtr, const void* secondPtr)
// Retrieves the available modes for the specified monitor
//
static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
static int refreshVideoModes(_GLFWmonitor* monitor)
{
int modeCount;
GLFWvidmode* modes;
if (monitor->modes)
return GLFW_TRUE;
return GL_TRUE;
modes = _glfwPlatformGetVideoModes(monitor, &modeCount);
if (!modes)
return GLFW_FALSE;
return GL_FALSE;
qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes);
@ -78,7 +78,7 @@ static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
monitor->modes = modes;
monitor->modeCount = modeCount;
return GLFW_TRUE;
return GL_TRUE;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
@ -37,7 +37,7 @@
typedef struct _GLFWcontextNSGL
{
id pixelFormat;
id object;
id context;
} _GLFWcontextNSGL;

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 OS X - www.glfw.org
// GLFW 3.1 OS X - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
//
@ -36,7 +36,7 @@
int _glfwInitContextAPI(void)
{
if (!_glfwCreateContextTLS())
return GLFW_FALSE;
return GL_FALSE;
_glfw.nsgl.framework =
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
@ -44,10 +44,10 @@ int _glfwInitContextAPI(void)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"NSGL: Failed to locate OpenGL framework");
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
// Terminate OpenGL support
@ -69,14 +69,15 @@ int _glfwCreateContext(_GLFWwindow* window,
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"NSGL: OpenGL ES is not available on OS X");
return GLFW_FALSE;
return GL_FALSE;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X does not support OpenGL 3.0 or 3.1");
return GLFW_FALSE;
return GL_FALSE;
}
if (ctxconfig->major > 2)
@ -85,16 +86,25 @@ int _glfwCreateContext(_GLFWwindow* window,
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above");
return GLFW_FALSE;
return GL_FALSE;
}
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X only supports core profile contexts for OpenGL 3.2 and above");
return GLFW_FALSE;
return GL_FALSE;
}
}
#else
// Fail if OpenGL 3.0 or above was requested
if (ctxconfig->major > 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X does not support OpenGL version 3.0 or above");
return GL_FALSE;
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
// Context robustness modes (GL_KHR_robustness) are not yet supported on
// OS X but are not a hard constraint, so ignore and continue
@ -111,6 +121,7 @@ int _glfwCreateContext(_GLFWwindow* window,
ADD_ATTR(NSOpenGLPFAAccelerated);
ADD_ATTR(NSOpenGLPFAClosestPolicy);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
if (ctxconfig->major >= 4)
{
@ -122,6 +133,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
if (ctxconfig->major <= 2)
{
@ -195,43 +207,42 @@ int _glfwCreateContext(_GLFWwindow* window,
#undef ADD_ATTR
#undef ADD_ATTR2
window->context.nsgl.pixelFormat =
window->nsgl.pixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
if (window->context.nsgl.pixelFormat == nil)
if (window->nsgl.pixelFormat == nil)
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"NSGL: Failed to find a suitable pixel format");
return GLFW_FALSE;
return GL_FALSE;
}
NSOpenGLContext* share = NULL;
if (ctxconfig->share)
share = ctxconfig->share->context.nsgl.object;
share = ctxconfig->share->nsgl.context;
window->context.nsgl.object =
[[NSOpenGLContext alloc] initWithFormat:window->context.nsgl.pixelFormat
window->nsgl.context =
[[NSOpenGLContext alloc] initWithFormat:window->nsgl.pixelFormat
shareContext:share];
if (window->context.nsgl.object == nil)
if (window->nsgl.context == nil)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: Failed to create OpenGL context");
return GLFW_FALSE;
return GL_FALSE;
}
[window->context.nsgl.object setView:window->ns.view];
return GLFW_TRUE;
return GL_TRUE;
}
// Destroy the OpenGL context
//
void _glfwDestroyContext(_GLFWwindow* window)
{
[window->context.nsgl.pixelFormat release];
window->context.nsgl.pixelFormat = nil;
[window->nsgl.pixelFormat release];
window->nsgl.pixelFormat = nil;
[window->context.nsgl.object release];
window->context.nsgl.object = nil;
[window->nsgl.context release];
window->nsgl.context = nil;
}
@ -242,7 +253,7 @@ void _glfwDestroyContext(_GLFWwindow* window)
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
{
if (window)
[window->context.nsgl.object makeCurrentContext];
[window->nsgl.context makeCurrentContext];
else
[NSOpenGLContext clearCurrentContext];
@ -252,7 +263,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
{
// ARP appears to be unnecessary, but this is future-proof
[window->context.nsgl.object flushBuffer];
[window->nsgl.context flushBuffer];
}
void _glfwPlatformSwapInterval(int interval)
@ -260,14 +271,13 @@ void _glfwPlatformSwapInterval(int interval)
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
GLint sync = interval;
[window->context.nsgl.object setValues:&sync
forParameter:NSOpenGLCPSwapInterval];
[window->nsgl.context setValues:&sync forParameter:NSOpenGLCPSwapInterval];
}
int _glfwPlatformExtensionSupported(const char* extension)
{
// There are no NSGL extensions
return GLFW_FALSE;
return GL_FALSE;
}
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
@ -293,13 +303,6 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
return window->context.nsgl.object;
return window->nsgl.context;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 POSIX - www.glfw.org
// GLFW 3.1 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -66,7 +66,7 @@ void _glfwInitTimer(void)
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
{
_glfw.posix_time.monotonic = GLFW_TRUE;
_glfw.posix_time.monotonic = GL_TRUE;
_glfw.posix_time.resolution = 1e-9;
}
else

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 POSIX - www.glfw.org
// GLFW 3.1 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -37,7 +37,7 @@
//
typedef struct _GLFWtimePOSIX
{
GLFWbool monotonic;
GLboolean monotonic;
double resolution;
uint64_t base;

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 POSIX - www.glfw.org
// GLFW 3.1 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -32,23 +32,21 @@
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwCreateContextTLS(void)
int _glfwCreateContextTLS(void)
{
if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"POSIX: Failed to create context TLS");
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.posix_tls.allocated = GLFW_TRUE;
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwDestroyContextTLS(void)
{
if (_glfw.posix_tls.allocated)
pthread_key_delete(_glfw.posix_tls.context);
pthread_key_delete(_glfw.posix_tls.context);
}
void _glfwSetContextTLS(_GLFWwindow* context)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 POSIX - www.glfw.org
// GLFW 3.1 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -37,13 +37,12 @@
//
typedef struct _GLFWtlsPOSIX
{
GLFWbool allocated;
pthread_key_t context;
} _GLFWtlsPOSIX;
GLFWbool _glfwCreateContextTLS(void);
int _glfwCreateContextTLS(void);
void _glfwDestroyContextTLS(void);
void _glfwSetContextTLS(_GLFWwindow* context);

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 WGL - www.glfw.org
// GLFW 3.1 WGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -34,51 +34,49 @@
// Initialize WGL-specific extensions
//
static void loadExtensions(void)
static void initWGLExtensions(_GLFWwindow* window)
{
// Functions for WGL_EXT_extension_string
// NOTE: These are needed by _glfwPlatformExtensionSupported
_glfw.wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
_glfw_wglGetProcAddress("wglGetExtensionsStringEXT");
_glfw.wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
window->wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
_glfw_wglGetProcAddress("wglGetExtensionsStringARB");
// Functions for WGL_ARB_create_context
_glfw.wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
window->wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
_glfw_wglGetProcAddress("wglCreateContextAttribsARB");
// Functions for WGL_EXT_swap_control
_glfw.wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
window->wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
_glfw_wglGetProcAddress("wglSwapIntervalEXT");
// Functions for WGL_ARB_pixel_format
_glfw.wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)
window->wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)
_glfw_wglGetProcAddress("wglGetPixelFormatAttribivARB");
// This needs to include every extension used below except for
// WGL_ARB_extensions_string and WGL_EXT_extensions_string
_glfw.wgl.ARB_multisample =
window->wgl.ARB_multisample =
_glfwPlatformExtensionSupported("WGL_ARB_multisample");
_glfw.wgl.ARB_framebuffer_sRGB =
window->wgl.ARB_framebuffer_sRGB =
_glfwPlatformExtensionSupported("WGL_ARB_framebuffer_sRGB");
_glfw.wgl.EXT_framebuffer_sRGB =
window->wgl.EXT_framebuffer_sRGB =
_glfwPlatformExtensionSupported("WGL_EXT_framebuffer_sRGB");
_glfw.wgl.ARB_create_context =
window->wgl.ARB_create_context =
_glfwPlatformExtensionSupported("WGL_ARB_create_context");
_glfw.wgl.ARB_create_context_profile =
window->wgl.ARB_create_context_profile =
_glfwPlatformExtensionSupported("WGL_ARB_create_context_profile");
_glfw.wgl.EXT_create_context_es2_profile =
window->wgl.EXT_create_context_es2_profile =
_glfwPlatformExtensionSupported("WGL_EXT_create_context_es2_profile");
_glfw.wgl.ARB_create_context_robustness =
window->wgl.ARB_create_context_robustness =
_glfwPlatformExtensionSupported("WGL_ARB_create_context_robustness");
_glfw.wgl.EXT_swap_control =
window->wgl.EXT_swap_control =
_glfwPlatformExtensionSupported("WGL_EXT_swap_control");
_glfw.wgl.ARB_pixel_format =
window->wgl.ARB_pixel_format =
_glfwPlatformExtensionSupported("WGL_ARB_pixel_format");
_glfw.wgl.ARB_context_flush_control =
window->wgl.ARB_context_flush_control =
_glfwPlatformExtensionSupported("WGL_ARB_context_flush_control");
_glfw.wgl.extensionsLoaded = GLFW_TRUE;
}
// Returns the specified attribute of the specified pixel format
@ -87,11 +85,11 @@ static int getPixelFormatAttrib(_GLFWwindow* window, int pixelFormat, int attrib
{
int value = 0;
assert(_glfw.wgl.ARB_pixel_format);
assert(window->wgl.ARB_pixel_format);
if (!_glfw.wgl.GetPixelFormatAttribivARB(window->context.wgl.dc,
pixelFormat,
0, 1, &attrib, &value))
if (!window->wgl.GetPixelFormatAttribivARB(window->wgl.dc,
pixelFormat,
0, 1, &attrib, &value))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to retrieve pixel format attribute %i",
@ -104,15 +102,15 @@ static int getPixelFormatAttrib(_GLFWwindow* window, int pixelFormat, int attrib
// Return a list of available and usable framebuffer configs
//
static GLFWbool choosePixelFormat(_GLFWwindow* window,
const _GLFWfbconfig* desired,
int* result)
static GLboolean choosePixelFormat(_GLFWwindow* window,
const _GLFWfbconfig* desired,
int* result)
{
_GLFWfbconfig* usableConfigs;
const _GLFWfbconfig* closest;
int i, nativeCount, usableCount;
if (_glfw.wgl.ARB_pixel_format)
if (window->wgl.ARB_pixel_format)
{
nativeCount = getPixelFormatAttrib(window,
1,
@ -120,7 +118,7 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
}
else
{
nativeCount = DescribePixelFormat(window->context.wgl.dc,
nativeCount = DescribePixelFormat(window->wgl.dc,
1,
sizeof(PIXELFORMATDESCRIPTOR),
NULL);
@ -134,7 +132,7 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
const int n = i + 1;
_GLFWfbconfig* u = usableConfigs + usableCount;
if (_glfw.wgl.ARB_pixel_format)
if (window->wgl.ARB_pixel_format)
{
// Get pixel format attributes through "modern" extension
@ -172,18 +170,18 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
u->auxBuffers = getPixelFormatAttrib(window, n, WGL_AUX_BUFFERS_ARB);
if (getPixelFormatAttrib(window, n, WGL_STEREO_ARB))
u->stereo = GLFW_TRUE;
u->stereo = GL_TRUE;
if (getPixelFormatAttrib(window, n, WGL_DOUBLE_BUFFER_ARB))
u->doublebuffer = GLFW_TRUE;
u->doublebuffer = GL_TRUE;
if (_glfw.wgl.ARB_multisample)
if (window->wgl.ARB_multisample)
u->samples = getPixelFormatAttrib(window, n, WGL_SAMPLES_ARB);
if (_glfw.wgl.ARB_framebuffer_sRGB ||
_glfw.wgl.EXT_framebuffer_sRGB)
if (window->wgl.ARB_framebuffer_sRGB ||
window->wgl.EXT_framebuffer_sRGB)
{
if (getPixelFormatAttrib(window, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB))
u->sRGB = GLFW_TRUE;
u->sRGB = GL_TRUE;
}
}
else
@ -192,7 +190,7 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
// Get pixel format attributes through legacy PFDs
if (!DescribePixelFormat(window->context.wgl.dc,
if (!DescribePixelFormat(window->wgl.dc,
n,
sizeof(PIXELFORMATDESCRIPTOR),
&pfd))
@ -231,9 +229,9 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
u->auxBuffers = pfd.cAuxBuffers;
if (pfd.dwFlags & PFD_STEREO)
u->stereo = GLFW_TRUE;
u->stereo = GL_TRUE;
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
u->doublebuffer = GLFW_TRUE;
u->doublebuffer = GL_TRUE;
}
u->wgl = n;
@ -246,7 +244,7 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
"WGL: The driver does not appear to support OpenGL");
free(usableConfigs);
return GLFW_FALSE;
return GL_FALSE;
}
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
@ -256,13 +254,13 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
"WGL: Failed to find a suitable pixel format");
free(usableConfigs);
return GLFW_FALSE;
return GL_FALSE;
}
*result = closest->wgl;
free(usableConfigs);
return GLFW_TRUE;
return GL_TRUE;
}
@ -275,35 +273,46 @@ static GLFWbool choosePixelFormat(_GLFWwindow* window,
int _glfwInitContextAPI(void)
{
if (!_glfwCreateContextTLS())
return GLFW_FALSE;
return GL_FALSE;
_glfw.wgl.instance = LoadLibraryA("opengl32.dll");
if (!_glfw.wgl.instance)
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
if (!_glfw.wgl.opengl32.instance)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "WGL: Failed to load opengl32.dll");
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.wgl.CreateContext = (WGLCREATECONTEXT_T)
GetProcAddress(_glfw.wgl.instance, "wglCreateContext");
_glfw.wgl.DeleteContext = (WGLDELETECONTEXT_T)
GetProcAddress(_glfw.wgl.instance, "wglDeleteContext");
_glfw.wgl.GetProcAddress = (WGLGETPROCADDRESS_T)
GetProcAddress(_glfw.wgl.instance, "wglGetProcAddress");
_glfw.wgl.MakeCurrent = (WGLMAKECURRENT_T)
GetProcAddress(_glfw.wgl.instance, "wglMakeCurrent");
_glfw.wgl.ShareLists = (WGLSHARELISTS_T)
GetProcAddress(_glfw.wgl.instance, "wglShareLists");
_glfw.wgl.opengl32.CreateContext = (WGLCREATECONTEXT_T)
GetProcAddress(_glfw.wgl.opengl32.instance, "wglCreateContext");
_glfw.wgl.opengl32.DeleteContext = (WGLDELETECONTEXT_T)
GetProcAddress(_glfw.wgl.opengl32.instance, "wglDeleteContext");
_glfw.wgl.opengl32.GetProcAddress = (WGLGETPROCADDRESS_T)
GetProcAddress(_glfw.wgl.opengl32.instance, "wglGetProcAddress");
_glfw.wgl.opengl32.MakeCurrent = (WGLMAKECURRENT_T)
GetProcAddress(_glfw.wgl.opengl32.instance, "wglMakeCurrent");
_glfw.wgl.opengl32.ShareLists = (WGLSHARELISTS_T)
GetProcAddress(_glfw.wgl.opengl32.instance, "wglShareLists");
return GLFW_TRUE;
if (!_glfw.wgl.opengl32.CreateContext ||
!_glfw.wgl.opengl32.DeleteContext ||
!_glfw.wgl.opengl32.GetProcAddress ||
!_glfw.wgl.opengl32.MakeCurrent ||
!_glfw.wgl.opengl32.ShareLists)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to load opengl32 functions");
return GL_FALSE;
}
return GL_TRUE;
}
// Terminate WGL
//
void _glfwTerminateContextAPI(void)
{
if (_glfw.wgl.instance)
FreeLibrary(_glfw.wgl.instance);
if (_glfw.wgl.opengl32.instance)
FreeLibrary(_glfw.wgl.opengl32.instance);
_glfwDestroyContextTLS();
}
@ -327,35 +336,34 @@ int _glfwCreateContext(_GLFWwindow* window,
HGLRC share = NULL;
if (ctxconfig->share)
share = ctxconfig->share->context.wgl.handle;
share = ctxconfig->share->wgl.context;
window->context.wgl.dc = GetDC(window->win32.handle);
if (!window->context.wgl.dc)
window->wgl.dc = GetDC(window->win32.handle);
if (!window->wgl.dc)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to retrieve DC for window");
return GLFW_FALSE;
return GL_FALSE;
}
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
return GLFW_FALSE;
return GL_FALSE;
if (!DescribePixelFormat(window->context.wgl.dc,
pixelFormat, sizeof(pfd), &pfd))
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to retrieve PFD for selected pixel format");
return GLFW_FALSE;
return GL_FALSE;
}
if (!SetPixelFormat(window->context.wgl.dc, pixelFormat, &pfd))
if (!SetPixelFormat(window->wgl.dc, pixelFormat, &pfd))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to set selected pixel format");
return GLFW_FALSE;
return GL_FALSE;
}
if (_glfw.wgl.ARB_create_context)
if (window->wgl.ARB_create_context)
{
int index = 0, mask = 0, flags = 0;
@ -374,12 +382,10 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->debug)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->noerror)
flags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
if (ctxconfig->robustness)
{
if (_glfw.wgl.ARB_create_context_robustness)
if (window->wgl.ARB_create_context_robustness)
{
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
{
@ -398,7 +404,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->release)
{
if (_glfw.wgl.ARB_context_flush_control)
if (window->wgl.ARB_context_flush_control)
{
if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
{
@ -430,39 +436,41 @@ int _glfwCreateContext(_GLFWwindow* window,
setWGLattrib(0, 0);
window->context.wgl.handle =
_glfw.wgl.CreateContextAttribsARB(window->context.wgl.dc,
share, attribs);
if (!window->context.wgl.handle)
window->wgl.context = window->wgl.CreateContextAttribsARB(window->wgl.dc,
share,
attribs);
if (!window->wgl.context)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Failed to create OpenGL context");
return GLFW_FALSE;
return GL_FALSE;
}
}
else
{
window->context.wgl.handle =
_glfw_wglCreateContext(window->context.wgl.dc);
if (!window->context.wgl.handle)
window->wgl.context = _glfw_wglCreateContext(window->wgl.dc);
if (!window->wgl.context)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Failed to create OpenGL context");
return GLFW_FALSE;
return GL_FALSE;
}
if (share)
{
if (!_glfw_wglShareLists(share, window->context.wgl.handle))
if (!_glfw_wglShareLists(share, window->wgl.context))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to enable sharing with specified OpenGL context");
return GLFW_FALSE;
return GL_FALSE;
}
}
}
return GLFW_TRUE;
_glfwPlatformMakeContextCurrent(window);
initWGLExtensions(window);
return GL_TRUE;
}
#undef setWGLattrib
@ -471,106 +479,100 @@ int _glfwCreateContext(_GLFWwindow* window,
//
void _glfwDestroyContext(_GLFWwindow* window)
{
if (window->context.wgl.handle)
if (window->wgl.context)
{
_glfw_wglDeleteContext(window->context.wgl.handle);
window->context.wgl.handle = NULL;
_glfw_wglDeleteContext(window->wgl.context);
window->wgl.context = NULL;
}
if (window->context.wgl.dc)
if (window->wgl.dc)
{
ReleaseDC(window->win32.handle, window->context.wgl.dc);
window->context.wgl.dc = NULL;
ReleaseDC(window->win32.handle, window->wgl.dc);
window->wgl.dc = NULL;
}
}
// Analyzes the specified context for possible recreation
//
int _glfwAnalyzeContext(_GLFWwindow* window,
int _glfwAnalyzeContext(const _GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
GLFWbool required = GLFW_FALSE;
if (_glfw.wgl.extensionsLoaded)
return _GLFW_RECREATION_NOT_NEEDED;
_glfwPlatformMakeContextCurrent(window);
loadExtensions();
GLboolean required = GL_FALSE;
if (ctxconfig->api == GLFW_OPENGL_API)
{
if (ctxconfig->forward)
{
if (!_glfw.wgl.ARB_create_context)
if (!window->wgl.ARB_create_context)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: A forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable");
return _GLFW_RECREATION_IMPOSSIBLE;
}
required = GLFW_TRUE;
required = GL_TRUE;
}
if (ctxconfig->profile)
{
if (!_glfw.wgl.ARB_create_context_profile)
if (!window->wgl.ARB_create_context_profile)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable");
return _GLFW_RECREATION_IMPOSSIBLE;
}
required = GLFW_TRUE;
required = GL_TRUE;
}
if (ctxconfig->release)
{
if (_glfw.wgl.ARB_context_flush_control)
required = GLFW_TRUE;
if (window->wgl.ARB_context_flush_control)
required = GL_TRUE;
}
}
else
{
if (!_glfw.wgl.ARB_create_context ||
!_glfw.wgl.ARB_create_context_profile ||
!_glfw.wgl.EXT_create_context_es2_profile)
if (!window->wgl.ARB_create_context ||
!window->wgl.ARB_create_context_profile ||
!window->wgl.EXT_create_context_es2_profile)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"WGL: OpenGL ES requested but WGL_ARB_create_context_es2_profile is unavailable");
return _GLFW_RECREATION_IMPOSSIBLE;
}
required = GLFW_TRUE;
required = GL_TRUE;
}
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
{
if (_glfw.wgl.ARB_create_context)
required = GLFW_TRUE;
if (window->wgl.ARB_create_context)
required = GL_TRUE;
}
if (ctxconfig->debug)
{
if (_glfw.wgl.ARB_create_context)
required = GLFW_TRUE;
if (window->wgl.ARB_create_context)
required = GL_TRUE;
}
if (fbconfig->samples > 0)
{
// MSAA is not a hard constraint, so do nothing if it's not supported
if (_glfw.wgl.ARB_multisample && _glfw.wgl.ARB_pixel_format)
required = GLFW_TRUE;
if (window->wgl.ARB_multisample && window->wgl.ARB_pixel_format)
required = GL_TRUE;
}
if (fbconfig->sRGB)
{
// sRGB is not a hard constraint, so do nothing if it's not supported
if ((_glfw.wgl.ARB_framebuffer_sRGB ||
_glfw.wgl.EXT_framebuffer_sRGB) &&
_glfw.wgl.ARB_pixel_format)
if ((window->wgl.ARB_framebuffer_sRGB ||
window->wgl.EXT_framebuffer_sRGB) &&
window->wgl.ARB_pixel_format)
{
required = GLFW_TRUE;
required = GL_TRUE;
}
}
@ -588,10 +590,7 @@ int _glfwAnalyzeContext(_GLFWwindow* window,
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
{
if (window)
{
_glfw_wglMakeCurrent(window->context.wgl.dc,
window->context.wgl.handle);
}
_glfw_wglMakeCurrent(window->wgl.dc, window->wgl.context);
else
_glfw_wglMakeCurrent(NULL, NULL);
@ -603,27 +602,27 @@ void _glfwPlatformSwapBuffers(_GLFWwindow* window)
// HACK: Use DwmFlush when desktop composition is enabled
if (_glfwIsCompositionEnabled() && !window->monitor)
{
int count = abs(window->context.wgl.interval);
int count = abs(window->wgl.interval);
while (count--)
_glfw_DwmFlush();
}
SwapBuffers(window->context.wgl.dc);
SwapBuffers(window->wgl.dc);
}
void _glfwPlatformSwapInterval(int interval)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
window->context.wgl.interval = interval;
window->wgl.interval = interval;
// HACK: Disable WGL swap interval when desktop composition is enabled to
// avoid interfering with DWM vsync
if (_glfwIsCompositionEnabled() && !window->monitor)
interval = 0;
if (_glfw.wgl.EXT_swap_control)
_glfw.wgl.SwapIntervalEXT(interval);
if (window->wgl.EXT_swap_control)
window->wgl.SwapIntervalEXT(interval);
}
int _glfwPlatformExtensionSupported(const char* extension)
@ -632,27 +631,27 @@ int _glfwPlatformExtensionSupported(const char* extension)
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
if (_glfw.wgl.GetExtensionsStringEXT)
if (window->wgl.GetExtensionsStringEXT != NULL)
{
extensions = _glfw.wgl.GetExtensionsStringEXT();
extensions = window->wgl.GetExtensionsStringEXT();
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
return GL_TRUE;
}
}
if (_glfw.wgl.GetExtensionsStringARB)
if (window->wgl.GetExtensionsStringARB != NULL)
{
extensions = _glfw.wgl.GetExtensionsStringARB(window->context.wgl.dc);
extensions = window->wgl.GetExtensionsStringARB(window->wgl.dc);
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
return GL_TRUE;
}
}
return GLFW_FALSE;
return GL_FALSE;
}
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
@ -661,7 +660,7 @@ GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
if (proc)
return proc;
return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname);
return (GLFWglproc) GetProcAddress(_glfw.wgl.opengl32.instance, procname);
}
@ -673,13 +672,6 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
return window->context.wgl.handle;
return window->wgl.context;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 WGL - www.glfw.org
// GLFW 3.1 WGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -28,73 +28,22 @@
#ifndef _glfw3_wgl_context_h_
#define _glfw3_wgl_context_h_
// This path may need to be changed if you build GLFW using your own setup
// We ship and use our own copy of wglext.h since GLFW uses fairly new
// extensions and not all operating systems come with an up-to-date version
#include "../deps/GL/wglext.h"
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_TYPE_RGBA_ARB 0x202b
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201a
#define WGL_ALPHA_BITS_ARB 0x201b
#define WGL_ALPHA_SHIFT_ARB 0x201c
#define WGL_ACCUM_BITS_ARB 0x201d
#define WGL_ACCUM_RED_BITS_ARB 0x201e
#define WGL_ACCUM_GREEN_BITS_ARB 0x201f
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_STEREO_ARB 0x2012
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_SAMPLES_ARB 0x2042
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
// opengl32.dll function pointer typedefs
typedef HGLRC (WINAPI * WGLCREATECONTEXT_T)(HDC);
typedef BOOL (WINAPI * WGLDELETECONTEXT_T)(HGLRC);
typedef PROC (WINAPI * WGLGETPROCADDRESS_T)(LPCSTR);
typedef BOOL (WINAPI * WGLMAKECURRENT_T)(HDC,HGLRC);
typedef BOOL (WINAPI * WGLSHARELISTS_T)(HGLRC,HGLRC);
// opengl32.dll function pointer typedefs
#define _glfw_wglCreateContext _glfw.wgl.CreateContext
#define _glfw_wglDeleteContext _glfw.wgl.DeleteContext
#define _glfw_wglGetProcAddress _glfw.wgl.GetProcAddress
#define _glfw_wglMakeCurrent _glfw.wgl.MakeCurrent
#define _glfw_wglShareLists _glfw.wgl.ShareLists
#define _GLFW_RECREATION_NOT_NEEDED 0
#define _GLFW_RECREATION_REQUIRED 1
#define _GLFW_RECREATION_IMPOSSIBLE 2
#define _glfw_wglCreateContext _glfw.wgl.opengl32.CreateContext
#define _glfw_wglDeleteContext _glfw.wgl.opengl32.DeleteContext
#define _glfw_wglGetProcAddress _glfw.wgl.opengl32.GetProcAddress
#define _glfw_wglMakeCurrent _glfw.wgl.opengl32.MakeCurrent
#define _glfw_wglShareLists _glfw.wgl.opengl32.ShareLists
#define _GLFW_PLATFORM_FBCONFIG int wgl
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl
@ -105,10 +54,27 @@ typedef BOOL (WINAPI * WGLSHARELISTS_T)(HGLRC,HGLRC);
//
typedef struct _GLFWcontextWGL
{
HDC dc;
HGLRC handle;
HDC dc; // Private GDI device context
HGLRC context; // Permanent rendering context
int interval;
// WGL extensions (context specific)
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLboolean EXT_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_framebuffer_sRGB;
GLboolean EXT_framebuffer_sRGB;
GLboolean ARB_pixel_format;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;
GLboolean EXT_create_context_es2_profile;
GLboolean ARB_create_context_robustness;
GLboolean ARB_context_flush_control;
} _GLFWcontextWGL;
@ -116,30 +82,14 @@ typedef struct _GLFWcontextWGL
//
typedef struct _GLFWlibraryWGL
{
HINSTANCE instance;
WGLCREATECONTEXT_T CreateContext;
WGLDELETECONTEXT_T DeleteContext;
WGLGETPROCADDRESS_T GetProcAddress;
WGLMAKECURRENT_T MakeCurrent;
WGLSHARELISTS_T ShareLists;
GLFWbool extensionsLoaded;
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLFWbool EXT_swap_control;
GLFWbool ARB_multisample;
GLFWbool ARB_framebuffer_sRGB;
GLFWbool EXT_framebuffer_sRGB;
GLFWbool ARB_pixel_format;
GLFWbool ARB_create_context;
GLFWbool ARB_create_context_profile;
GLFWbool EXT_create_context_es2_profile;
GLFWbool ARB_create_context_robustness;
GLFWbool ARB_context_flush_control;
struct {
HINSTANCE instance;
WGLCREATECONTEXT_T CreateContext;
WGLDELETECONTEXT_T DeleteContext;
WGLGETPROCADDRESS_T GetProcAddress;
WGLMAKECURRENT_T MakeCurrent;
WGLSHARELISTS_T ShareLists;
} opengl32;
} _GLFWlibraryWGL;
@ -150,7 +100,7 @@ int _glfwCreateContext(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContext(_GLFWwindow* window);
int _glfwAnalyzeContext(_GLFWwindow* window,
int _glfwAnalyzeContext(const _GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -60,13 +60,14 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
// Load necessary libraries (DLLs)
//
static GLFWbool initLibraries(void)
static GLboolean initLibraries(void)
{
_glfw.win32.winmm.instance = LoadLibraryA("winmm.dll");
_glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll");
if (!_glfw.win32.winmm.instance)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to load winmm.dll");
return GLFW_FALSE;
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to load winmm.dll");
return GL_FALSE;
}
_glfw.win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T)
@ -78,19 +79,26 @@ static GLFWbool initLibraries(void)
_glfw.win32.winmm.timeGetTime = (TIMEGETTIME_T)
GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime");
_glfw.win32.user32.instance = LoadLibraryA("user32.dll");
if (!_glfw.win32.user32.instance)
if (!_glfw.win32.winmm.joyGetDevCaps ||
!_glfw.win32.winmm.joyGetPos ||
!_glfw.win32.winmm.joyGetPosEx ||
!_glfw.win32.winmm.timeGetTime)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to load user32.dll");
return GLFW_FALSE;
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to load winmm functions");
return GL_FALSE;
}
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
_glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T)
GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
_glfw.win32.user32.instance = LoadLibraryW(L"user32.dll");
if (_glfw.win32.user32.instance)
{
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
_glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T)
GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
}
_glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll");
_glfw.win32.dwmapi.instance = LoadLibraryW(L"dwmapi.dll");
if (_glfw.win32.dwmapi.instance)
{
_glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T)
@ -99,14 +107,7 @@ static GLFWbool initLibraries(void)
GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
}
_glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
if (_glfw.win32.shcore.instance)
{
_glfw.win32.shcore.SetProcessDPIAwareness = (SETPROCESSDPIAWARENESS_T)
GetProcAddress(_glfw.win32.shcore.instance, "SetProcessDPIAwareness");
}
return GLFW_TRUE;
return GL_TRUE;
}
// Unload used libraries (DLLs)
@ -121,19 +122,13 @@ static void terminateLibraries(void)
if (_glfw.win32.dwmapi.instance)
FreeLibrary(_glfw.win32.dwmapi.instance);
if (_glfw.win32.shcore.instance)
FreeLibrary(_glfw.win32.shcore.instance);
}
// Create key code translation tables
//
static void createKeyTables(void)
{
int scancode;
memset(_glfw.win32.publicKeys, -1, sizeof(_glfw.win32.publicKeys));
memset(_glfw.win32.nativeKeys, -1, sizeof(_glfw.win32.nativeKeys));
_glfw.win32.publicKeys[0x00B] = GLFW_KEY_0;
_glfw.win32.publicKeys[0x002] = GLFW_KEY_1;
@ -255,12 +250,6 @@ static void createKeyTables(void)
_glfw.win32.publicKeys[0x11C] = GLFW_KEY_KP_ENTER;
_glfw.win32.publicKeys[0x037] = GLFW_KEY_KP_MULTIPLY;
_glfw.win32.publicKeys[0x04A] = GLFW_KEY_KP_SUBTRACT;
for (scancode = 0; scancode < 512; scancode++)
{
if (_glfw.win32.publicKeys[scancode] > 0)
_glfw.win32.nativeKeys[_glfw.win32.publicKeys[scancode]] = scancode;
}
}
@ -343,25 +332,23 @@ int _glfwPlatformInit(void)
SPIF_SENDCHANGE);
if (!initLibraries())
return GLFW_FALSE;
return GL_FALSE;
createKeyTables();
if (_glfw_SetProcessDPIAwareness)
_glfw_SetProcessDPIAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
else if (_glfw_SetProcessDPIAware)
if (_glfw_SetProcessDPIAware)
_glfw_SetProcessDPIAware();
if (!_glfwRegisterWindowClass())
return GLFW_FALSE;
return GL_FALSE;
if (!_glfwInitContextAPI())
return GLFW_FALSE;
return GL_FALSE;
_glfwInitTimer();
_glfwInitJoysticks();
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformTerminate(void)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -47,7 +47,7 @@
// Change the current video mode
//
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
GLFWvidmode current;
const GLFWvidmode* best;
@ -56,7 +56,7 @@ GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
best = _glfwChooseVideoMode(monitor, desired);
_glfwPlatformGetVideoMode(monitor, &current);
if (_glfwCompareVideoModes(&current, best) == 0)
return GLFW_TRUE;
return GL_TRUE;
ZeroMemory(&dm, sizeof(dm));
dm.dmSize = sizeof(DEVMODEW);
@ -77,11 +77,11 @@ GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
NULL) != DISP_CHANGE_SUCCESSFUL)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to set video mode");
return GLFW_FALSE;
return GL_FALSE;
}
monitor->win32.modeChanged = GLFW_TRUE;
return GLFW_TRUE;
monitor->win32.modeChanged = GL_TRUE;
return GL_TRUE;
}
// Restore the previously saved (original) video mode
@ -92,7 +92,7 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
{
ChangeDisplaySettingsExW(monitor->win32.adapterName,
NULL, NULL, CDS_FULLSCREEN, NULL);
monitor->win32.modeChanged = GLFW_FALSE;
monitor->win32.modeChanged = GL_FALSE;
}
}
@ -112,8 +112,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
for (adapterIndex = 0; ; adapterIndex++)
{
DISPLAY_DEVICEW adapter;
int widthMM, heightMM;
HDC dc;
ZeroMemory(&adapter, sizeof(DISPLAY_DEVICEW));
adapter.cb = sizeof(DISPLAY_DEVICEW);
@ -124,16 +122,12 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE))
continue;
dc = CreateDCW(L"DISPLAY", adapter.DeviceName, NULL, NULL);
widthMM = GetDeviceCaps(dc, HORZSIZE);
heightMM = GetDeviceCaps(dc, VERTSIZE);
DeleteDC(dc);
for (displayIndex = 0; ; displayIndex++)
{
DISPLAY_DEVICEW display;
_GLFWmonitor* monitor;
char* name;
HDC dc;
ZeroMemory(&display, sizeof(DISPLAY_DEVICEW));
display.cb = sizeof(DISPLAY_DEVICEW);
@ -149,11 +143,17 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
continue;
}
monitor = _glfwAllocMonitor(name, widthMM, heightMM);
dc = CreateDCW(L"DISPLAY", adapter.DeviceName, NULL, NULL);
monitor = _glfwAllocMonitor(name,
GetDeviceCaps(dc, HORZSIZE),
GetDeviceCaps(dc, VERTSIZE));
DeleteDC(dc);
free(name);
if (adapter.StateFlags & DISPLAY_DEVICE_MODESPRUNED)
monitor->win32.modesPruned = GLFW_TRUE;
monitor->win32.modesPruned = GL_TRUE;
wcscpy(monitor->win32.adapterName, adapter.DeviceName);
wcscpy(monitor->win32.displayName, display.DeviceName);
@ -186,7 +186,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return monitors;
}
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
return wcscmp(first->win32.displayName, second->win32.displayName) == 0;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -86,12 +86,6 @@
#ifndef UNICODE_NOCHAR
#define UNICODE_NOCHAR 0xFFFF
#endif
#ifndef WM_DPICHANGED
#define WM_DPICHANGED 0x02E0
#endif
#ifndef GET_XBUTTON_WPARAM
#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
#endif
#if WINVER < 0x0601
typedef struct tagCHANGEFILTERSTRUCT
@ -105,15 +99,6 @@ typedef struct tagCHANGEFILTERSTRUCT
#endif
#endif /*Windows 7*/
#ifndef DPI_ENUMS_DECLARED
typedef enum PROCESS_DPI_AWARENESS
{
PROCESS_DPI_UNAWARE = 0,
PROCESS_SYSTEM_DPI_AWARE = 1,
PROCESS_PER_MONITOR_DPI_AWARE = 2
} PROCESS_DPI_AWARENESS;
#endif /*DPI_ENUMS_DECLARED*/
// winmm.dll function pointer typedefs
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
@ -136,9 +121,9 @@ typedef HRESULT (WINAPI * DWMFLUSH_T)(VOID);
#define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled
#define _glfw_DwmFlush _glfw.win32.dwmapi.DwmFlush
// shcore.dll function pointer typedefs
typedef HRESULT (WINAPI * SETPROCESSDPIAWARENESS_T)(PROCESS_DPI_AWARENESS);
#define _glfw_SetProcessDPIAwareness _glfw.win32.shcore.SetProcessDPIAwareness
#define _GLFW_RECREATION_NOT_NEEDED 0
#define _GLFW_RECREATION_REQUIRED 1
#define _GLFW_RECREATION_IMPOSSIBLE 2
#include "win32_tls.h"
#include "winmm_joystick.h"
@ -166,12 +151,8 @@ typedef struct _GLFWwindowWin32
{
HWND handle;
GLFWbool cursorTracked;
GLFWbool iconified;
int minwidth, minheight;
int maxwidth, maxheight;
int numer, denom;
GLboolean cursorTracked;
GLboolean iconified;
// The last received cursor position, regardless of source
int cursorPosX, cursorPosY;
@ -185,9 +166,7 @@ typedef struct _GLFWlibraryWin32
{
DWORD foregroundLockTimeout;
char* clipboardString;
char keyName[64];
short int publicKeys[512];
short int nativeKeys[GLFW_KEY_LAST + 1];
// winmm.dll
struct {
@ -212,12 +191,6 @@ typedef struct _GLFWlibraryWin32
DWMFLUSH_T DwmFlush;
} dwmapi;
// shcore.dll
struct {
HINSTANCE instance;
SETPROCESSDPIAWARENESS_T SetProcessDPIAwareness;
} shcore;
} _GLFWlibraryWin32;
@ -230,8 +203,8 @@ typedef struct _GLFWmonitorWin32
WCHAR displayName[32];
char publicAdapterName[64];
char publicDisplayName[64];
GLFWbool modesPruned;
GLFWbool modeChanged;
GLboolean modesPruned;
GLboolean modeChanged;
} _GLFWmonitorWin32;
@ -249,14 +222,14 @@ typedef struct _GLFWcursorWin32
//
typedef struct _GLFWtimeWin32
{
GLFWbool hasPC;
GLboolean hasPC;
double resolution;
unsigned __int64 base;
} _GLFWtimeWin32;
GLFWbool _glfwRegisterWindowClass(void);
GLboolean _glfwRegisterWindowClass(void);
void _glfwUnregisterWindowClass(void);
BOOL _glfwIsCompositionEnabled(void);
@ -266,7 +239,7 @@ char* _glfwCreateUTF8FromWideString(const WCHAR* source);
void _glfwInitTimer(void);
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
#endif // _glfw3_win32_platform_h_

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -55,12 +55,12 @@ void _glfwInitTimer(void)
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
{
_glfw.win32_time.hasPC = GLFW_TRUE;
_glfw.win32_time.hasPC = GL_TRUE;
_glfw.win32_time.resolution = 1.0 / (double) frequency;
}
else
{
_glfw.win32_time.hasPC = GLFW_FALSE;
_glfw.win32_time.hasPC = GL_FALSE;
_glfw.win32_time.resolution = 0.001; // winmm resolution is 1 ms
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -32,18 +32,18 @@
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwCreateContextTLS(void)
int _glfwCreateContextTLS(void)
{
_glfw.win32_tls.context = TlsAlloc();
if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to allocate TLS index");
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.win32_tls.allocated = GLFW_TRUE;
return GLFW_TRUE;
_glfw.win32_tls.allocated = GL_TRUE;
return GL_TRUE;
}
void _glfwDestroyContextTLS(void)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -35,13 +35,13 @@
//
typedef struct _GLFWtlsWin32
{
GLFWbool allocated;
GLboolean allocated;
DWORD context;
} _GLFWtlsWin32;
GLFWbool _glfwCreateContextTLS(void);
int _glfwCreateContextTLS(void);
void _glfwDestroyContextTLS(void);
void _glfwSetContextTLS(_GLFWwindow* context);

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Win32 - www.glfw.org
// GLFW 3.1 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -37,6 +37,7 @@
#define _GLFW_WNDCLASSNAME L"GLFW30"
// Returns the window style for the specified window
//
static DWORD getWindowStyle(const _GLFWwindow* window)
@ -68,47 +69,6 @@ static DWORD getWindowExStyle(const _GLFWwindow* window)
return style;
}
// Translate client window size to full window size according to styles
//
static void getFullWindowSize(DWORD style, DWORD exStyle,
int clientWidth, int clientHeight,
int* fullWidth, int* fullHeight)
{
RECT rect = { 0, 0, clientWidth, clientHeight };
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
*fullWidth = rect.right - rect.left;
*fullHeight = rect.bottom - rect.top;
}
// Enforce the client rect aspect ratio based on which edge is being dragged
//
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
{
int xoff, yoff;
const float ratio = (float) window->win32.numer /
(float) window->win32.denom;
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
0, 0, &xoff, &yoff);
if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT ||
edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT)
{
area->bottom = area->top + yoff +
(int) ((area->right - area->left - xoff) / ratio);
}
else if (edge == WMSZ_TOPLEFT || edge == WMSZ_TOPRIGHT)
{
area->top = area->bottom - yoff -
(int) ((area->right - area->left - xoff) / ratio);
}
else if (edge == WMSZ_TOP || edge == WMSZ_BOTTOM)
{
area->right = area->left + xoff +
(int) ((area->bottom - area->top - yoff) * ratio);
}
}
// Updates the cursor clip rect
//
static void updateClipRect(_GLFWwindow* window)
@ -120,6 +80,56 @@ static void updateClipRect(_GLFWwindow* window)
ClipCursor(&clipRect);
}
// Hide the mouse cursor
//
static void hideCursor(_GLFWwindow* window)
{
POINT pos;
ClipCursor(NULL);
if (GetCursorPos(&pos))
{
if (WindowFromPoint(pos) == window->win32.handle)
SetCursor(NULL);
}
}
// Disable the mouse cursor
//
static void disableCursor(_GLFWwindow* window)
{
POINT pos;
updateClipRect(window);
if (GetCursorPos(&pos))
{
if (WindowFromPoint(pos) == window->win32.handle)
SetCursor(NULL);
}
}
// Restores the mouse cursor
//
static void restoreCursor(_GLFWwindow* window)
{
POINT pos;
ClipCursor(NULL);
if (GetCursorPos(&pos))
{
if (WindowFromPoint(pos) == window->win32.handle)
{
if (window->cursor)
SetCursor(window->cursor->win32.handle);
else
SetCursor(LoadCursorW(NULL, IDC_ARROW));
}
}
}
// Translates a GLFW standard cursor to a resource ID
//
static LPWSTR translateCursorShape(int shape)
@ -225,10 +235,10 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
// Enter full screen mode
//
static GLFWbool enterFullscreenMode(_GLFWwindow* window)
static GLboolean enterFullscreenMode(_GLFWwindow* window)
{
GLFWvidmode mode;
GLFWbool status;
GLboolean status;
int xpos, ypos;
status = _glfwSetVideoMode(window->monitor, &window->videoMode);
@ -249,7 +259,7 @@ static void leaveFullscreenMode(_GLFWwindow* window)
_glfwRestoreVideoMode(window->monitor);
}
// Window callback function (handles window messages)
// Window callback function (handles window events)
//
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam)
@ -267,25 +277,29 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SETFOCUS:
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
if (window->cursorMode != GLFW_CURSOR_NORMAL)
_glfwPlatformApplyCursorMode(window);
_glfwInputWindowFocus(window, GLFW_TRUE);
_glfwInputWindowFocus(window, GL_TRUE);
return 0;
}
case WM_KILLFOCUS:
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
if (window->cursorMode != GLFW_CURSOR_NORMAL)
restoreCursor(window);
if (window->monitor && window->autoIconify)
_glfwPlatformIconifyWindow(window);
_glfwInputWindowFocus(window, GLFW_FALSE);
_glfwInputWindowFocus(window, GL_FALSE);
return 0;
}
case WM_COMMAND:
{
_glfwInputMenuItem(window, LOWORD(wParam));
break;
}
case WM_SYSCOMMAND:
{
switch (wParam & 0xfff0)
@ -316,52 +330,69 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return 0;
}
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
{
const int scancode = (lParam >> 16) & 0x1ff;
const int key = translateKey(wParam, lParam);
if (key == _GLFW_KEY_INVALID)
break;
_glfwInputKey(window, key, scancode, GLFW_PRESS, getKeyMods());
break;
}
case WM_CHAR:
{
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GL_TRUE);
return 0;
}
case WM_SYSCHAR:
{
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GL_FALSE);
return 0;
}
case WM_UNICHAR:
{
const GLFWbool plain = (uMsg != WM_SYSCHAR);
// This message is not sent by Windows, but is sent by some
// third-party input method engines
if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR)
if (wParam == UNICODE_NOCHAR)
{
// WM_UNICHAR is not sent by Windows, but is sent by some
// third-party input method engine
// Returning TRUE here announces support for this message
return TRUE;
}
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
return 0;
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GL_TRUE);
return FALSE;
}
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
case WM_KEYUP:
case WM_SYSKEYUP:
{
const int key = translateKey(wParam, lParam);
const int scancode = (lParam >> 16) & 0x1ff;
const int action = ((lParam >> 31) & 1) ? GLFW_RELEASE : GLFW_PRESS;
const int mods = getKeyMods();
const int scancode = (lParam >> 16) & 0x1ff;
const int key = translateKey(wParam, lParam);
if (key == _GLFW_KEY_INVALID)
break;
if (action == GLFW_RELEASE && wParam == VK_SHIFT)
if (wParam == VK_SHIFT)
{
// Release both Shift keys on Shift up event, as only one event
// is sent even if both keys are released
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, action, mods);
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, action, mods);
_glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, GLFW_RELEASE, mods);
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, GLFW_RELEASE, mods);
}
else if (wParam == VK_SNAPSHOT)
{
// Key down is not reported for the Print Screen key
// Key down is not reported for the print screen key
_glfwInputKey(window, key, scancode, GLFW_PRESS, mods);
_glfwInputKey(window, key, scancode, GLFW_RELEASE, mods);
}
else
_glfwInputKey(window, key, scancode, action, mods);
_glfwInputKey(window, key, scancode, GLFW_RELEASE, mods);
break;
}
@ -370,40 +401,54 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_XBUTTONDOWN:
{
const int mods = getKeyMods();
SetCapture(hWnd);
if (uMsg == WM_LBUTTONDOWN)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
else if (uMsg == WM_RBUTTONDOWN)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods);
else if (uMsg == WM_MBUTTONDOWN)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods);
else
{
if (HIWORD(wParam) == XBUTTON1)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_4, GLFW_PRESS, mods);
else if (HIWORD(wParam) == XBUTTON2)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_5, GLFW_PRESS, mods);
return TRUE;
}
return 0;
}
case WM_LBUTTONUP:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
case WM_XBUTTONUP:
{
int button, action;
const int mods = getKeyMods();
if (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONUP)
button = GLFW_MOUSE_BUTTON_LEFT;
else if (uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONUP)
button = GLFW_MOUSE_BUTTON_RIGHT;
else if (uMsg == WM_MBUTTONDOWN || uMsg == WM_MBUTTONUP)
button = GLFW_MOUSE_BUTTON_MIDDLE;
else if (GET_XBUTTON_WPARAM(wParam) == XBUTTON1)
button = GLFW_MOUSE_BUTTON_4;
else
button = GLFW_MOUSE_BUTTON_5;
ReleaseCapture();
if (uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN ||
uMsg == WM_MBUTTONDOWN || uMsg == WM_XBUTTONDOWN)
{
action = GLFW_PRESS;
SetCapture(hWnd);
}
if (uMsg == WM_LBUTTONUP)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, mods);
else if (uMsg == WM_RBUTTONUP)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE, mods);
else if (uMsg == WM_MBUTTONUP)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_RELEASE, mods);
else
{
action = GLFW_RELEASE;
ReleaseCapture();
}
if (HIWORD(wParam) == XBUTTON1)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_4, GLFW_RELEASE, mods);
else if (HIWORD(wParam) == XBUTTON2)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_5, GLFW_RELEASE, mods);
_glfwInputMouseClick(window, button, action, getKeyMods());
if (uMsg == WM_XBUTTONDOWN || uMsg == WM_XBUTTONUP)
return TRUE;
}
return 0;
}
@ -437,8 +482,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
tme.hwndTrack = window->win32.handle;
TrackMouseEvent(&tme);
window->win32.cursorTracked = GLFW_TRUE;
_glfwInputCursorEnter(window, GLFW_TRUE);
window->win32.cursorTracked = GL_TRUE;
_glfwInputCursorEnter(window, GL_TRUE);
}
return 0;
@ -446,8 +491,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_MOUSELEAVE:
{
window->win32.cursorTracked = GLFW_FALSE;
_glfwInputCursorEnter(window, GLFW_FALSE);
window->win32.cursorTracked = GL_FALSE;
_glfwInputCursorEnter(window, GL_FALSE);
return 0;
}
@ -475,20 +520,20 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (!window->win32.iconified && wParam == SIZE_MINIMIZED)
{
window->win32.iconified = GLFW_TRUE;
window->win32.iconified = GL_TRUE;
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GLFW_TRUE);
_glfwInputWindowIconify(window, GL_TRUE);
}
else if (window->win32.iconified &&
(wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED))
{
window->win32.iconified = GLFW_FALSE;
window->win32.iconified = GL_FALSE;
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GLFW_FALSE);
_glfwInputWindowIconify(window, GL_FALSE);
}
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
@ -512,46 +557,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return 0;
}
case WM_SIZING:
{
if (window->win32.numer == GLFW_DONT_CARE ||
window->win32.denom == GLFW_DONT_CARE)
{
break;
}
applyAspectRatio(window, (int) wParam, (RECT*) lParam);
return TRUE;
}
case WM_GETMINMAXINFO:
{
int xoff, yoff;
MINMAXINFO* mmi = (MINMAXINFO*) lParam;
if (!window)
break;
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
0, 0, &xoff, &yoff);
if (window->win32.minwidth != GLFW_DONT_CARE &&
window->win32.minheight != GLFW_DONT_CARE)
{
mmi->ptMinTrackSize.x = window->win32.minwidth + xoff;
mmi->ptMinTrackSize.y = window->win32.minheight + yoff;
}
if (window->win32.maxwidth != GLFW_DONT_CARE &&
window->win32.maxheight != GLFW_DONT_CARE)
{
mmi->ptMaxTrackSize.x = window->win32.maxwidth + xoff;
mmi->ptMaxTrackSize.y = window->win32.maxheight + yoff;
}
return 0;
}
case WM_PAINT:
{
_glfwInputWindowDamage(window);
@ -583,19 +588,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
break;
}
case WM_DPICHANGED:
{
RECT* rect = (RECT*) lParam;
SetWindowPos(window->win32.handle,
HWND_TOP,
rect->left,
rect->top,
rect->right - rect->left,
rect->bottom - rect->top,
SWP_NOACTIVATE | SWP_NOZORDER);
break;
}
case WM_DEVICECHANGE:
{
if (DBT_DEVNODES_CHANGED == wParam)
@ -641,12 +633,28 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
}
}
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
// Translate client window size to full window size (including window borders)
//
static void getFullWindowSize(_GLFWwindow* window,
int clientWidth, int clientHeight,
int* fullWidth, int* fullHeight)
{
RECT rect = { 0, 0, clientWidth, clientHeight };
AdjustWindowRectEx(&rect, getWindowStyle(window),
FALSE, getWindowExStyle(window));
*fullWidth = rect.right - rect.left;
*fullHeight = rect.bottom - rect.top;
}
// Creates the GLFW window and rendering context
//
static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
static int createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
int xpos, ypos, fullWidth, fullHeight;
WCHAR* wideTitle;
@ -668,7 +676,7 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
xpos = CW_USEDEFAULT;
ypos = CW_USEDEFAULT;
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
getFullWindowSize(window,
wndconfig->width, wndconfig->height,
&fullWidth, &fullHeight);
}
@ -678,7 +686,7 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to convert window title to UTF-16");
return GLFW_FALSE;
return GL_FALSE;
}
window->win32.handle = CreateWindowExW(getWindowExStyle(window),
@ -697,7 +705,7 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
if (!window->win32.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window");
return GLFW_FALSE;
return GL_FALSE;
}
if (_glfw_ChangeWindowMessageFilterEx)
@ -720,20 +728,18 @@ static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig)
DragAcceptFiles(window->win32.handle, TRUE);
window->win32.minwidth = GLFW_DONT_CARE;
window->win32.minheight = GLFW_DONT_CARE;
window->win32.maxwidth = GLFW_DONT_CARE;
window->win32.maxheight = GLFW_DONT_CARE;
window->win32.numer = GLFW_DONT_CARE;
window->win32.denom = GLFW_DONT_CARE;
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GL_FALSE;
return GLFW_TRUE;
return GL_TRUE;
}
// Destroys the GLFW window and rendering context
//
static void destroyWindow(_GLFWwindow* window)
{
_glfwDestroyContext(window);
if (window->win32.handle)
{
DestroyWindow(window->win32.handle);
@ -748,7 +754,7 @@ static void destroyWindow(_GLFWwindow* window)
// Registers the GLFW window class
//
GLFWbool _glfwRegisterWindowClass(void)
GLboolean _glfwRegisterWindowClass(void)
{
WNDCLASSW wc;
@ -763,25 +769,21 @@ GLFWbool _glfwRegisterWindowClass(void)
wc.lpszClassName = _GLFW_WNDCLASSNAME;
// Load user-provided icon if available
wc.hIcon = LoadImageW(GetModuleHandleW(NULL),
L"GLFW_ICON", IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
wc.hIcon = LoadIconW(GetModuleHandleW(NULL), L"GLFW_ICON");
if (!wc.hIcon)
{
// No user-provided icon found, load default icon
wc.hIcon = LoadImageW(NULL,
IDI_APPLICATION, IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED);
wc.hIcon = LoadIconW(NULL, IDI_WINLOGO);
}
if (!RegisterClassW(&wc))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to register window class");
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
// Unregisters the GLFW window class
@ -803,65 +805,53 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
{
int status;
if (!createWindow(window, wndconfig))
return GLFW_FALSE;
if (!createWindow(window, wndconfig, ctxconfig, fbconfig))
return GL_FALSE;
if (ctxconfig->api != GLFW_NO_API)
status = _glfwAnalyzeContext(window, ctxconfig, fbconfig);
if (status == _GLFW_RECREATION_IMPOSSIBLE)
return GL_FALSE;
if (status == _GLFW_RECREATION_REQUIRED)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
// Some window hints require us to re-create the context using WGL
// extensions retrieved through the current context, as we cannot check
// for WGL extensions or retrieve WGL entry points before we have a
// current context (actually until we have implicitly loaded the ICD)
#if defined(_GLFW_WGL)
status = _glfwAnalyzeContext(window, ctxconfig, fbconfig);
// Yes, this is strange, and yes, this is the proper way on Win32
if (status == _GLFW_RECREATION_IMPOSSIBLE)
return GLFW_FALSE;
// As Windows only allows you to set the pixel format once for a
// window, we need to destroy the current window and create a new one
// to be able to use the new pixel format
if (status == _GLFW_RECREATION_REQUIRED)
{
// Some window hints require us to re-create the context using WGL
// extensions retrieved through the current context, as we cannot
// check for WGL extensions or retrieve WGL entry points before we
// have a current context (actually until we have implicitly loaded
// the vendor ICD)
// Technically, it may be possible to keep the old window around if
// we're just creating an OpenGL 3.0+ context with the same pixel
// format, but it's not worth the added code complexity
// Yes, this is strange, and yes, this is the proper way on WGL
// First we clear the current context (the one we just created)
// This is usually done by glfwDestroyWindow, but as we're not doing
// full GLFW window destruction, it's duplicated here
_glfwPlatformMakeContextCurrent(NULL);
// As Windows only allows you to set the pixel format once for
// a window, we need to destroy the current window and create a new
// one to be able to use the new pixel format
// Next destroy the Win32 window and WGL context (without resetting or
// destroying the GLFW window object)
destroyWindow(window);
// Technically, it may be possible to keep the old window around if
// we're just creating an OpenGL 3.0+ context with the same pixel
// format, but it's not worth the added code complexity
// First we clear the current context (the one we just created)
// This is usually done by glfwDestroyWindow, but as we're not doing
// full GLFW window destruction, it's duplicated here
_glfwPlatformMakeContextCurrent(NULL);
// Next destroy the Win32 window and WGL context (without resetting
// or destroying the GLFW window object)
_glfwDestroyContext(window);
destroyWindow(window);
// ...and then create them again, this time with better APIs
if (!createWindow(window, wndconfig))
return GLFW_FALSE;
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
#endif // _GLFW_WGL
// ...and then create them again, this time with better APIs
if (!createWindow(window, wndconfig, ctxconfig, fbconfig))
return GL_FALSE;
}
if (window->monitor)
{
_glfwPlatformShowWindow(window);
if (!enterFullscreenMode(window))
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
@ -869,9 +859,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
if (window->monitor)
leaveFullscreenMode(window);
if (window->context.api != GLFW_NO_API)
_glfwDestroyContext(window);
destroyWindow(window);
}
@ -927,8 +914,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
else
{
int fullWidth, fullHeight;
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
width, height, &fullWidth, &fullHeight);
getFullWindowSize(window, width, height, &fullWidth, &fullHeight);
SetWindowPos(window->win32.handle, HWND_TOP,
0, 0, fullWidth, fullHeight,
@ -936,48 +922,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
}
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
RECT area;
window->win32.minwidth = minwidth;
window->win32.minheight = minheight;
window->win32.maxwidth = maxwidth;
window->win32.maxheight = maxheight;
if ((minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) &&
(maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE))
{
return;
}
GetWindowRect(window->win32.handle, &area);
MoveWindow(window->win32.handle,
area.left, area.top,
area.right - area.left,
area.bottom - area.top, TRUE);
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
{
RECT area;
window->win32.numer = numer;
window->win32.denom = denom;
if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE)
return;
GetWindowRect(window->win32.handle, &area);
applyAspectRatio(window, WMSZ_BOTTOMRIGHT, &area);
MoveWindow(window->win32.handle,
area.left, area.top,
area.right - area.left,
area.bottom - area.top, TRUE);
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{
_glfwPlatformGetWindowSize(window, width, height);
@ -1153,54 +1097,20 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
SetCursorPos(pos.x, pos.y);
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
{
POINT pos;
if (mode == GLFW_CURSOR_DISABLED)
updateClipRect(window);
else
ClipCursor(NULL);
if (!GetCursorPos(&pos))
return;
if (WindowFromPoint(pos) != window->win32.handle)
return;
if (mode == GLFW_CURSOR_NORMAL)
switch (window->cursorMode)
{
if (window->cursor)
SetCursor(window->cursor->win32.handle);
else
SetCursor(LoadCursorW(NULL, IDC_ARROW));
case GLFW_CURSOR_NORMAL:
restoreCursor(window);
break;
case GLFW_CURSOR_HIDDEN:
hideCursor(window);
break;
case GLFW_CURSOR_DISABLED:
disableCursor(window);
break;
}
else
SetCursor(NULL);
}
const char* _glfwPlatformGetKeyName(int key, int scancode)
{
WCHAR name[16];
if (key != GLFW_KEY_UNKNOWN)
scancode = _glfw.win32.nativeKeys[key];
if (!_glfwIsPrintable(_glfw.win32.publicKeys[scancode]))
return NULL;
if (!GetKeyNameTextW(scancode << 16, name, sizeof(name) / sizeof(WCHAR)))
return NULL;
if (!WideCharToMultiByte(CP_UTF8, 0, name, -1,
_glfw.win32.keyName,
sizeof(_glfw.win32.keyName),
NULL, NULL))
{
return NULL;
}
return _glfw.win32.keyName;
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
@ -1233,13 +1143,13 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
ReleaseDC(NULL, dc);
if (!bitmap)
return GLFW_FALSE;
return GL_FALSE;
mask = CreateBitmap(image->width, image->height, 1, 1, NULL);
if (!mask)
{
DeleteObject(bitmap);
return GLFW_FALSE;
return GL_FALSE;
}
for (i = 0; i < image->width * image->height; i++, target++, source += 4)
@ -1263,9 +1173,9 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
DeleteObject(mask);
if (!cursor->win32.handle)
return GLFW_FALSE;
return GL_FALSE;
return GLFW_TRUE;
return GL_TRUE;
}
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
@ -1276,10 +1186,10 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to create standard cursor");
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 - www.glfw.org
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -36,7 +36,7 @@
////// GLFW event API //////
//////////////////////////////////////////////////////////////////////////
void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused)
void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
{
if (focused)
{
@ -82,7 +82,7 @@ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
window->callbacks.size((GLFWwindow*) window, width, height);
}
void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified)
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
{
if (window->callbacks.iconify)
window->callbacks.iconify((GLFWwindow*) window, iconified);
@ -102,7 +102,7 @@ void _glfwInputWindowDamage(_GLFWwindow* window)
void _glfwInputWindowCloseRequest(_GLFWwindow* window)
{
window->closed = GLFW_TRUE;
window->closed = GL_TRUE;
if (window->callbacks.close)
window->callbacks.close((GLFWwindow*) window);
@ -142,22 +142,14 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
wndconfig.monitor = (_GLFWmonitor*) monitor;
ctxconfig.share = (_GLFWwindow*) share;
if (ctxconfig.share)
{
if (ctxconfig.share->context.api == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
}
if (wndconfig.monitor)
{
wndconfig.resizable = GLFW_TRUE;
wndconfig.visible = GLFW_TRUE;
wndconfig.focused = GLFW_TRUE;
wndconfig.resizable = GL_TRUE;
wndconfig.visible = GL_TRUE;
wndconfig.focused = GL_TRUE;
}
// Check the OpenGL bits of the window config
if (!_glfwIsValidContextConfig(&ctxconfig))
return NULL;
@ -190,30 +182,32 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
return NULL;
}
if (ctxconfig.api != GLFW_NO_API)
_glfwPlatformMakeContextCurrent(window);
// Retrieve the actual (as opposed to requested) context attributes
if (!_glfwRefreshContextAttribs(&ctxconfig))
{
_glfwPlatformMakeContextCurrent(window);
// Retrieve the actual (as opposed to requested) context attributes
if (!_glfwRefreshContextAttribs(&ctxconfig))
{
glfwDestroyWindow((GLFWwindow*) window);
_glfwPlatformMakeContextCurrent(previous);
return NULL;
}
// Verify the context against the requested parameters
if (!_glfwIsValidContext(&ctxconfig))
{
glfwDestroyWindow((GLFWwindow*) window);
_glfwPlatformMakeContextCurrent(previous);
return NULL;
}
// Restore the previously current context (or NULL)
glfwDestroyWindow((GLFWwindow*) window);
_glfwPlatformMakeContextCurrent(previous);
return NULL;
}
// Verify the context against the requested parameters
if (!_glfwIsValidContext(&ctxconfig))
{
glfwDestroyWindow((GLFWwindow*) window);
_glfwPlatformMakeContextCurrent(previous);
return NULL;
}
// Clearing the front buffer to black to avoid garbage pixels left over
// from previous uses of our bit of VRAM
window->Clear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
// Restore the previously current context (or NULL)
_glfwPlatformMakeContextCurrent(previous);
if (wndconfig.monitor)
{
int width, height;
@ -250,11 +244,11 @@ void glfwDefaultWindowHints(void)
_glfw.hints.context.minor = 0;
// The default is a focused, visible, resizable window with decorations
_glfw.hints.window.resizable = GLFW_TRUE;
_glfw.hints.window.visible = GLFW_TRUE;
_glfw.hints.window.decorated = GLFW_TRUE;
_glfw.hints.window.focused = GLFW_TRUE;
_glfw.hints.window.autoIconify = GLFW_TRUE;
_glfw.hints.window.resizable = GL_TRUE;
_glfw.hints.window.visible = GL_TRUE;
_glfw.hints.window.decorated = GL_TRUE;
_glfw.hints.window.focused = GL_TRUE;
_glfw.hints.window.autoIconify = GL_TRUE;
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
// double buffered
@ -264,7 +258,7 @@ void glfwDefaultWindowHints(void)
_glfw.hints.framebuffer.alphaBits = 8;
_glfw.hints.framebuffer.depthBits = 24;
_glfw.hints.framebuffer.stencilBits = 8;
_glfw.hints.framebuffer.doublebuffer = GLFW_TRUE;
_glfw.hints.framebuffer.doublebuffer = GL_TRUE;
// The default is to select the highest available refresh rate
_glfw.hints.refreshRate = GLFW_DONT_CARE;
@ -310,34 +304,34 @@ GLFWAPI void glfwWindowHint(int target, int hint)
_glfw.hints.framebuffer.auxBuffers = hint;
break;
case GLFW_STEREO:
_glfw.hints.framebuffer.stereo = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.stereo = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_DOUBLEBUFFER:
_glfw.hints.framebuffer.doublebuffer = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.doublebuffer = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_SAMPLES:
_glfw.hints.framebuffer.samples = hint;
break;
case GLFW_SRGB_CAPABLE:
_glfw.hints.framebuffer.sRGB = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.sRGB = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_RESIZABLE:
_glfw.hints.window.resizable = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.resizable = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_DECORATED:
_glfw.hints.window.decorated = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.decorated = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_FOCUSED:
_glfw.hints.window.focused = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.focused = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_AUTO_ICONIFY:
_glfw.hints.window.autoIconify = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.autoIconify = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_FLOATING:
_glfw.hints.window.floating = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.floating = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_VISIBLE:
_glfw.hints.window.visible = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.visible = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_CLIENT_API:
_glfw.hints.context.api = hint;
@ -352,13 +346,10 @@ GLFWAPI void glfwWindowHint(int target, int hint)
_glfw.hints.context.robustness = hint;
break;
case GLFW_OPENGL_FORWARD_COMPAT:
_glfw.hints.context.forward = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.context.forward = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_OPENGL_DEBUG_CONTEXT:
_glfw.hints.context.debug = hint ? GLFW_TRUE : GLFW_FALSE;
break;
case GLFW_CONTEXT_NO_ERROR:
_glfw.hints.context.noerror = hint ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.context.debug = hint ? GL_TRUE : GL_FALSE;
break;
case GLFW_OPENGL_PROFILE:
_glfw.hints.context.profile = hint;
@ -490,40 +481,6 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
_glfwPlatformSetWindowSize(window, width, height);
}
GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT();
if (window->monitor || !window->resizable)
return;
_glfwPlatformSetWindowSizeLimits(window,
minwidth, minheight,
maxwidth, maxheight);
}
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT();
if (window->monitor || !window->resizable)
return;
if (!denom)
{
_glfwInputError(GLFW_INVALID_VALUE, "Denominator cannot be zero");
return;
}
_glfwPlatformSetWindowAspectRatio(window, numer, denom);
}
GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
@ -632,8 +589,6 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->context.profile;
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
return window->context.release;
case GLFW_CONTEXT_NO_ERROR:
return window->context.noerror;
}
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute");

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 WinMM - www.glfw.org
// GLFW 3.1 WinMM - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -76,9 +76,9 @@ int _glfwPlatformJoystickPresent(int joy)
JOYINFO ji;
if (_glfw_joyGetPos(joy, &ji) != JOYERR_NOERROR)
return GLFW_FALSE;
return GL_FALSE;
return GLFW_TRUE;
return GL_TRUE;
}
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 WinMM - www.glfw.org
// GLFW 3.1 WinMM - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2014 Camilla Berglund <elmindreda@elmindreda.org>
//

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Wayland - www.glfw.org
// GLFW 3.1 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@ -49,7 +49,7 @@ static void pointerHandleEnter(void* data,
_glfw.wl.pointerFocus = window;
_glfwPlatformSetCursor(window, window->wl.currentCursor);
_glfwInputCursorEnter(window, GLFW_TRUE);
_glfwInputCursorEnter(window, GL_TRUE);
}
static void pointerHandleLeave(void* data,
@ -64,7 +64,7 @@ static void pointerHandleLeave(void* data,
_glfw.wl.pointerSerial = serial;
_glfw.wl.pointerFocus = NULL;
_glfwInputCursorEnter(window, GLFW_FALSE);
_glfwInputCursorEnter(window, GL_FALSE);
}
static void pointerHandleMotion(void* data,
@ -233,7 +233,7 @@ static void keyboardHandleEnter(void* data,
_GLFWwindow* window = wl_surface_get_user_data(surface);
_glfw.wl.keyboardFocus = window;
_glfwInputWindowFocus(window, GLFW_TRUE);
_glfwInputWindowFocus(window, GL_TRUE);
}
static void keyboardHandleLeave(void* data,
@ -247,7 +247,7 @@ static void keyboardHandleLeave(void* data,
return;
_glfw.wl.keyboardFocus = NULL;
_glfwInputWindowFocus(window, GLFW_FALSE);
_glfwInputWindowFocus(window, GL_FALSE);
}
static int toGLFWKeyCode(uint32_t key)
@ -548,7 +548,7 @@ int _glfwPlatformInit(void)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to connect to display");
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
@ -562,7 +562,7 @@ int _glfwPlatformInit(void)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to initialize xkb context");
return GLFW_FALSE;
return GL_FALSE;
}
// Sync so we got all registry objects
@ -572,7 +572,7 @@ int _glfwPlatformInit(void)
wl_display_roundtrip(_glfw.wl.display);
if (!_glfwInitContextAPI())
return GLFW_FALSE;
return GL_FALSE;
_glfwInitTimer();
_glfwInitJoysticks();
@ -584,13 +584,21 @@ int _glfwPlatformInit(void)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Unable to load default cursor theme\n");
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.wl.defaultCursor =
wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr");
if (!_glfw.wl.defaultCursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Unable to load default left pointer\n");
return GL_FALSE;
}
_glfw.wl.cursorSurface =
wl_compositor_create_surface(_glfw.wl.compositor);
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformTerminate(void)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Wayland - www.glfw.org
// GLFW 3.1 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@ -69,7 +69,7 @@ static void mode(void* data,
mode.base.width = width;
mode.base.height = height;
mode.base.refreshRate = refresh / 1000;
mode.base.refreshRate = refresh;
mode.flags = flags;
if (monitor->wl.modesCount + 1 >= monitor->wl.modesSize)
@ -90,7 +90,7 @@ static void done(void* data,
{
struct _GLFWmonitor *monitor = data;
monitor->wl.done = GLFW_TRUE;
monitor->wl.done = GL_TRUE;
}
static void scale(void* data,
@ -195,7 +195,7 @@ err:
return NULL;
}
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
return first->wl.output == second->wl.output;
}
@ -248,15 +248,3 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
fprintf(stderr, "_glfwPlatformSetGammaRamp not implemented yet\n");
}
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return monitor->wl.output;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Wayland - www.glfw.org
// GLFW 3.1 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@ -60,7 +60,7 @@ typedef struct _GLFWvidmodeWayland _GLFWvidmodeWayland;
typedef struct _GLFWwindowWayland
{
int width, height;
GLFWbool visible;
GLboolean visible;
struct wl_surface* surface;
struct wl_egl_window* native;
struct wl_shell_surface* shell_surface;
@ -84,6 +84,7 @@ typedef struct _GLFWlibraryWayland
struct wl_keyboard* keyboard;
struct wl_cursor_theme* cursorTheme;
struct wl_cursor* defaultCursor;
struct wl_surface* cursorSurface;
uint32_t pointerSerial;
@ -117,7 +118,7 @@ typedef struct _GLFWmonitorWayland
_GLFWvidmodeWayland* modes;
int modesCount;
int modesSize;
GLFWbool done;
GLboolean done;
int x;
int y;
@ -129,7 +130,6 @@ typedef struct _GLFWmonitorWayland
//
typedef struct _GLFWcursorWayland
{
struct wl_cursor_image* image;
struct wl_buffer* buffer;
int width, height;
int xhot, yhot;

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Wayland - www.glfw.org
// GLFW 3.1 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@ -72,12 +72,12 @@ static const struct wl_shell_surface_listener shellSurfaceListener = {
handlePopupDone
};
static GLFWbool createSurface(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
static GLboolean createSurface(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);
if (!window->wl.surface)
return GLFW_FALSE;
return GL_FALSE;
wl_surface_set_user_data(window->wl.surface, window);
@ -85,12 +85,12 @@ static GLFWbool createSurface(_GLFWwindow* window,
wndconfig->width,
wndconfig->height);
if (!window->wl.native)
return GLFW_FALSE;
return GL_FALSE;
window->wl.shell_surface = wl_shell_get_shell_surface(_glfw.wl.shell,
window->wl.surface);
if (!window->wl.shell_surface)
return GLFW_FALSE;
return GL_FALSE;
wl_shell_surface_add_listener(window->wl.shell_surface,
&shellSurfaceListener,
@ -99,7 +99,7 @@ static GLFWbool createSurface(_GLFWwindow* window,
window->wl.width = wndconfig->width;
window->wl.height = wndconfig->height;
return GLFW_TRUE;
return GL_TRUE;
}
static int
@ -207,28 +207,6 @@ createAnonymousFile(off_t size)
return fd;
}
// Translates a GLFW standard cursor to a theme cursor name
//
static char *translateCursorShape(int shape)
{
switch (shape)
{
case GLFW_ARROW_CURSOR:
return "left_ptr";
case GLFW_IBEAM_CURSOR:
return "xterm";
case GLFW_CROSSHAIR_CURSOR:
return "crosshair";
case GLFW_HAND_CURSOR:
return "grabbing";
case GLFW_HRESIZE_CURSOR:
return "sb_h_double_arrow";
case GLFW_VRESIZE_CURSOR:
return "sb_v_double_arrow";
}
return NULL;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
@ -238,14 +216,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (!createSurface(window, wndconfig))
return GLFW_FALSE;
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GL_FALSE;
if (ctxconfig->api != GLFW_NO_API)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
if (!createSurface(window, wndconfig))
return GL_FALSE;
if (wndconfig->monitor)
{
@ -262,7 +237,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
window->wl.currentCursor = NULL;
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
@ -270,12 +245,12 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
if (window == _glfw.wl.pointerFocus)
{
_glfw.wl.pointerFocus = NULL;
_glfwInputCursorEnter(window, GLFW_FALSE);
_glfwInputCursorEnter(window, GL_FALSE);
}
if (window == _glfw.wl.keyboardFocus)
{
_glfw.wl.keyboardFocus = NULL;
_glfwInputWindowFocus(window, GLFW_FALSE);
_glfwInputWindowFocus(window, GL_FALSE);
}
_glfwDestroyContext(window);
@ -327,20 +302,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
window->wl.height = height;
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
// TODO
fprintf(stderr, "_glfwPlatformSetWindowSizeLimits not implemented yet\n");
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
{
// TODO
fprintf(stderr, "_glfwPlatformSetWindowAspectRatio not implemented yet\n");
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{
_glfwPlatformGetWindowSize(window, width, height);
@ -386,19 +347,19 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
int _glfwPlatformWindowFocused(_GLFWwindow* window)
{
// TODO
return GLFW_FALSE;
return GL_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window)
{
// TODO
return GLFW_FALSE;
return GL_FALSE;
}
int _glfwPlatformWindowVisible(_GLFWwindow* window)
{
// TODO
return GLFW_FALSE;
return GL_FALSE;
}
void _glfwPlatformPollEvents(void)
@ -431,17 +392,11 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
"Wayland: Cursor position setting not supported");
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
{
_glfwPlatformSetCursor(window, window->wl.currentCursor);
}
const char* _glfwPlatformGetKeyName(int key, int scancode)
{
// TODO
return NULL;
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image,
int xhot, int yhot)
@ -458,7 +413,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Creating a buffer file for %d B failed: %m\n",
length);
return GLFW_FALSE;
return GL_FALSE;
}
data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
@ -467,7 +422,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Cursor mmap failed: %m\n");
close(fd);
return GLFW_FALSE;
return GL_FALSE;
}
pool = wl_shm_create_pool(_glfw.wl.shm, fd, length);
@ -495,40 +450,24 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
cursor->wl.height = image->height;
cursor->wl.xhot = xhot;
cursor->wl.yhot = yhot;
return GLFW_TRUE;
return GL_TRUE;
}
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
struct wl_cursor* standardCursor;
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,
translateCursorShape(shape));
if (!standardCursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Standard cursor \"%s\" not found",
translateCursorShape(shape));
return GLFW_FALSE;
}
cursor->wl.image = standardCursor->images[0];
return GLFW_TRUE;
// TODO
fprintf(stderr, "_glfwPlatformCreateStandardCursor not implemented yet\n");
return GL_FALSE;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
{
// If it's a standard cursor we don't need to do anything here
if (cursor->wl.image)
return;
wl_buffer_destroy(cursor->wl.buffer);
}
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
struct wl_buffer* buffer;
struct wl_cursor* defaultCursor;
struct wl_cursor_image* image;
struct wl_surface* surface = _glfw.wl.cursorSurface;
@ -544,23 +483,9 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
if (window->cursorMode == GLFW_CURSOR_NORMAL)
{
if (cursor)
image = cursor->wl.image;
else
{
defaultCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,
"left_ptr");
if (!defaultCursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Standard cursor not found");
return;
}
image = defaultCursor->images[0];
}
if (image)
if (cursor == NULL)
{
image = _glfw.wl.defaultCursor->images[0];
buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
@ -604,21 +529,3 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
return NULL;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfw.wl.display;
}
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return window->wl.surface;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 X11 - www.glfw.org
// GLFW 3.1 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -234,7 +234,6 @@ static void createKeyTables(void)
int scancode, key;
memset(_glfw.x11.publicKeys, -1, sizeof(_glfw.x11.publicKeys));
memset(_glfw.x11.nativeKeys, -1, sizeof(_glfw.x11.nativeKeys));
if (_glfw.x11.xkb.available)
{
@ -313,35 +312,31 @@ static void createKeyTables(void)
XkbFreeClientMap(desc, 0, True);
}
// Translate the un-translated key codes using traditional X11 KeySym
// lookups
for (scancode = 0; scancode < 256; scancode++)
{
// Translate the un-translated key codes using traditional X11 KeySym
// lookups
if (_glfw.x11.publicKeys[scancode] < 0)
_glfw.x11.publicKeys[scancode] = translateKeyCode(scancode);
// Store the reverse translation for faster key name lookup
if (_glfw.x11.publicKeys[scancode] > 0)
_glfw.x11.nativeKeys[_glfw.x11.publicKeys[scancode]] = scancode;
}
}
// Check whether the IM has a usable style
//
static GLFWbool hasUsableInputMethodStyle(void)
static GLboolean hasUsableInputMethodStyle(void)
{
unsigned int i;
GLFWbool found = GLFW_FALSE;
GLboolean found = GL_FALSE;
XIMStyles* styles = NULL;
if (XGetIMValues(_glfw.x11.im, XNQueryInputStyle, &styles, NULL) != NULL)
return GLFW_FALSE;
return GL_FALSE;
for (i = 0; i < styles->count_styles; i++)
{
if (styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing))
{
found = GLFW_TRUE;
found = GL_TRUE;
break;
}
}
@ -468,7 +463,7 @@ static void detectEWMH(void)
// Initialize X11 display and look for supported X11 extensions
//
static GLFWbool initExtensions(void)
static GLboolean initExtensions(void)
{
// Find or create window manager atoms
_glfw.x11.WM_PROTOCOLS = XInternAtom(_glfw.x11.display,
@ -491,29 +486,29 @@ static GLFWbool initExtensions(void)
#endif /*_GLFW_HAS_XF86VM*/
// Check for RandR extension
if (XRRQueryExtension(_glfw.x11.display,
_glfw.x11.randr.available =
XRRQueryExtension(_glfw.x11.display,
&_glfw.x11.randr.eventBase,
&_glfw.x11.randr.errorBase))
{
if (XRRQueryVersion(_glfw.x11.display,
&_glfw.x11.randr.major,
&_glfw.x11.randr.minor))
{
// The GLFW RandR path requires at least version 1.3
if (_glfw.x11.randr.major > 1 || _glfw.x11.randr.minor >= 3)
_glfw.x11.randr.available = GLFW_TRUE;
}
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Failed to query RandR version");
}
}
&_glfw.x11.randr.errorBase);
if (_glfw.x11.randr.available)
{
XRRScreenResources* sr = XRRGetScreenResources(_glfw.x11.display,
_glfw.x11.root);
XRRScreenResources* sr;
if (!XRRQueryVersion(_glfw.x11.display,
&_glfw.x11.randr.major,
&_glfw.x11.randr.minor))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Failed to query RandR version");
return GL_FALSE;
}
// The GLFW RandR path requires at least version 1.3
if (_glfw.x11.randr.major == 1 && _glfw.x11.randr.minor < 3)
_glfw.x11.randr.available = GL_FALSE;
sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root);
if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0]))
{
@ -523,13 +518,10 @@ static GLFWbool initExtensions(void)
// available
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: RandR gamma ramp support seems broken");
_glfw.x11.randr.gammaBroken = GLFW_TRUE;
_glfw.x11.randr.gammaBroken = GL_TRUE;
}
XRRFreeScreenResources(sr);
XRRSelectInput(_glfw.x11.display, _glfw.x11.root,
RROutputChangeNotifyMask);
}
if (XineramaQueryExtension(_glfw.x11.display,
@ -537,7 +529,7 @@ static GLFWbool initExtensions(void)
&_glfw.x11.xinerama.minor))
{
if (XineramaIsActive(_glfw.x11.display))
_glfw.x11.xinerama.available = GLFW_TRUE;
_glfw.x11.xinerama.available = GL_TRUE;
}
#if defined(_GLFW_HAS_XINPUT)
@ -554,7 +546,7 @@ static GLFWbool initExtensions(void)
&_glfw.x11.xi.major,
&_glfw.x11.xi.minor) != BadRequest)
{
_glfw.x11.xi.available = GLFW_TRUE;
_glfw.x11.xi.available = GL_TRUE;
}
}
#endif /*_GLFW_HAS_XINPUT*/
@ -577,7 +569,7 @@ static GLFWbool initExtensions(void)
if (XkbSetDetectableAutoRepeat(_glfw.x11.display, True, &supported))
{
if (supported)
_glfw.x11.xkb.detectable = GLFW_TRUE;
_glfw.x11.xkb.detectable = GL_TRUE;
}
}
@ -623,7 +615,7 @@ static GLFWbool initExtensions(void)
_glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", True);
_glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", True);
return GLFW_TRUE;
return GL_TRUE;
}
// Create a blank cursor for hidden and disabled cursor modes
@ -741,7 +733,7 @@ int _glfwPlatformInit(void)
"X11: The DISPLAY environment variable is missing");
}
return GLFW_FALSE;
return GL_FALSE;
}
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
@ -749,7 +741,7 @@ int _glfwPlatformInit(void)
_glfw.x11.context = XUniqueContext();
if (!initExtensions())
return GLFW_FALSE;
return GL_FALSE;
_glfw.x11.cursor = createNULLCursor();
@ -769,14 +761,14 @@ int _glfwPlatformInit(void)
}
if (!_glfwInitContextAPI())
return GLFW_FALSE;
return GL_FALSE;
if (!_glfwInitJoysticks())
return GLFW_FALSE;
return GL_FALSE;
_glfwInitTimer();
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformTerminate(void)
@ -795,6 +787,8 @@ void _glfwPlatformTerminate(void)
_glfw.x11.im = NULL;
}
_glfwTerminateJoysticks();
if (_glfw.x11.display)
{
XCloseDisplay(_glfw.x11.display);
@ -802,9 +796,8 @@ void _glfwPlatformTerminate(void)
}
// NOTE: This needs to be done after XCloseDisplay, as libGL registers
// cleanup callbacks that get called by it
// internal cleanup callbacks in libX11
_glfwTerminateContextAPI();
_glfwTerminateJoysticks();
}
const char* _glfwPlatformGetVersionString(void)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 X11 - www.glfw.org
// GLFW 3.1 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -34,7 +34,7 @@
// Check whether the display mode should be included in enumeration
//
static GLFWbool modeIsGood(const XRRModeInfo* mi)
static GLboolean modeIsGood(const XRRModeInfo* mi)
{
return (mi->modeFlags & RR_Interlace) == 0;
}
@ -97,7 +97,7 @@ static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi,
// Set the current video mode for the specified monitor
//
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
{
@ -112,7 +112,7 @@ GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
best = _glfwChooseVideoMode(monitor, desired);
_glfwPlatformGetVideoMode(monitor, &current);
if (_glfwCompareVideoModes(&current, best) == 0)
return GLFW_TRUE;
return GL_TRUE;
sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root);
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
@ -155,11 +155,11 @@ GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Monitor mode list changed");
return GLFW_FALSE;
return GL_FALSE;
}
}
return GLFW_TRUE;
return GL_TRUE;
}
// Restore the saved (original) video mode for the specified monitor
@ -285,7 +285,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: RandR monitor support seems broken");
_glfw.x11.randr.monitorBroken = GLFW_TRUE;
_glfw.x11.randr.monitorBroken = GL_TRUE;
free(monitors);
monitors = NULL;
}
@ -306,7 +306,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return monitors;
}
GLFWbool _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
{
return first->x11.crtc == second->x11.crtc;
}

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 X11 - www.glfw.org
// GLFW 3.1 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -62,8 +62,10 @@
#include "xkb_unicode.h"
#if defined(_GLFW_GLX)
#define _GLFW_X11_CONTEXT_VISUAL window->glx.visual
#include "glx_context.h"
#elif defined(_GLFW_EGL)
#define _GLFW_X11_CONTEXT_VISUAL window->egl.visual
#define _GLFW_EGL_NATIVE_WINDOW window->x11.handle
#define _GLFW_EGL_NATIVE_DISPLAY _glfw.x11.display
#include "egl_context.h"
@ -121,12 +123,8 @@ typedef struct _GLFWlibraryX11
int errorCode;
// Clipboard string (while the selection is owned)
char* clipboardString;
// Key name string
char keyName[64];
// X11 keycode to GLFW key LUT
short int publicKeys[256];
// GLFW key to X11 keycode LUT
short int nativeKeys[GLFW_KEY_LAST + 1];
// Window manager atoms
Atom WM_PROTOCOLS;
@ -170,18 +168,18 @@ typedef struct _GLFWlibraryX11
Atom GLFW_SELECTION;
struct {
GLFWbool available;
GLboolean available;
int eventBase;
int errorBase;
int major;
int minor;
GLFWbool gammaBroken;
GLFWbool monitorBroken;
GLboolean gammaBroken;
GLboolean monitorBroken;
} randr;
struct {
GLFWbool available;
GLFWbool detectable;
GLboolean available;
GLboolean detectable;
int majorOpcode;
int eventBase;
int errorBase;
@ -202,14 +200,14 @@ typedef struct _GLFWlibraryX11
} xdnd;
struct {
GLFWbool available;
GLboolean available;
int major;
int minor;
} xinerama;
#if defined(_GLFW_HAS_XINPUT)
struct {
GLFWbool available;
GLboolean available;
int majorOpcode;
int eventBase;
int errorBase;
@ -220,7 +218,7 @@ typedef struct _GLFWlibraryX11
#if defined(_GLFW_HAS_XF86VM)
struct {
GLFWbool available;
GLboolean available;
int eventBase;
int errorBase;
} vidmode;
@ -253,7 +251,7 @@ typedef struct _GLFWcursorX11
} _GLFWcursorX11;
GLFWbool _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
Cursor _glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 X11 - www.glfw.org
// GLFW 3.1 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -247,23 +247,25 @@ static char** parseUriList(char* text, int* count)
// Create the X11 window (and its colormap)
//
static GLFWbool createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
Visual* visual, int depth)
static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
unsigned long wamask;
XSetWindowAttributes wa;
XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL;
// Every window needs a colormap
// Create one based on the visual used by the current context
// TODO: Decouple this from context creation
window->x11.colormap = XCreateColormap(_glfw.x11.display,
_glfw.x11.root,
visual,
vi->visual,
AllocNone);
// Create the actual window
{
XSetWindowAttributes wa;
const unsigned long wamask = CWBorderPixel | CWColormap | CWEventMask;
wamask = CWBorderPixel | CWColormap | CWEventMask;
wa.colormap = window->x11.colormap;
wa.border_pixel = 0;
@ -278,10 +280,10 @@ static GLFWbool createWindow(_GLFWwindow* window,
_glfw.x11.root,
0, 0,
wndconfig->width, wndconfig->height,
0, // Border width
depth, // Color depth
0, // Border width
vi->depth, // Color depth
InputOutput,
visual,
vi->visual,
wamask,
&wa);
@ -291,7 +293,7 @@ static GLFWbool createWindow(_GLFWwindow* window,
{
_glfwInputXError(GLFW_PLATFORM_ERROR,
"X11: Failed to create window");
return GLFW_FALSE;
return GL_FALSE;
}
XSaveContext(_glfw.x11.display,
@ -398,7 +400,7 @@ static GLFWbool createWindow(_GLFWwindow* window,
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"X11: Failed to allocate WM hints");
return GLFW_FALSE;
return GL_FALSE;
}
hints->flags = StateHint;
@ -479,6 +481,9 @@ static GLFWbool createWindow(_GLFWwindow* window,
_glfwPlatformSetWindowTitle(window, wndconfig->title);
XRRSelectInput(_glfw.x11.display, window->x11.handle,
RRScreenChangeNotifyMask);
if (_glfw.x11.im)
{
window->x11.ic = XCreateIC(_glfw.x11.im,
@ -494,7 +499,40 @@ static GLFWbool createWindow(_GLFWwindow* window,
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
return GLFW_TRUE;
return GL_TRUE;
}
// Hide the mouse cursor
//
static void hideCursor(_GLFWwindow* window)
{
XUngrabPointer(_glfw.x11.display, CurrentTime);
XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.cursor);
}
// Disable the mouse cursor
//
static void disableCursor(_GLFWwindow* window)
{
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync,
window->x11.handle, _glfw.x11.cursor, CurrentTime);
}
// Restores the mouse cursor
//
static void restoreCursor(_GLFWwindow* window)
{
XUngrabPointer(_glfw.x11.display, CurrentTime);
if (window->cursor)
{
XDefineCursor(_glfw.x11.display, window->x11.handle,
window->cursor->x11.handle);
}
else
XUndefineCursor(_glfw.x11.display, window->x11.handle);
}
// Returns whether the event is a selection event
@ -848,16 +886,6 @@ static void processEvent(XEvent *event)
if (_glfw.x11.im)
filtered = XFilterEvent(event, None);
if (_glfw.x11.randr.available)
{
if (event->type == _glfw.x11.randr.eventBase + RRNotify)
{
XRRUpdateConfiguration(event);
_glfwInputMonitorChange();
return;
}
}
if (event->type != GenericEvent)
{
window = findWindowByHandle(event->xany.window);
@ -896,17 +924,17 @@ static void processEvent(XEvent *event)
int count;
Status status;
#if defined(X_HAVE_UTF8_STRING)
char buffer[100];
char buffer[96];
char* chars = buffer;
count = Xutf8LookupString(window->x11.ic,
&event->xkey,
buffer, sizeof(buffer) - 1,
buffer, sizeof(buffer),
NULL, &status);
if (status == XBufferOverflow)
{
chars = calloc(count + 1, 1);
chars = calloc(count, 1);
count = Xutf8LookupString(window->x11.ic,
&event->xkey,
chars, count,
@ -916,7 +944,6 @@ static void processEvent(XEvent *event)
if (status == XLookupChars || status == XLookupBoth)
{
const char* c = chars;
chars[count] = '\0';
while (c - chars < count)
_glfwInputChar(window, decodeUTF8(&c), mods, plain);
}
@ -1082,15 +1109,15 @@ static void processEvent(XEvent *event)
// HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise
// ignore the defined cursor for hidden cursor mode
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_HIDDEN);
hideCursor(window);
_glfwInputCursorEnter(window, GLFW_TRUE);
_glfwInputCursorEnter(window, GL_TRUE);
return;
}
case LeaveNotify:
{
_glfwInputCursorEnter(window, GLFW_FALSE);
_glfwInputCursorEnter(window, GL_FALSE);
return;
}
@ -1296,9 +1323,9 @@ static void processEvent(XEvent *event)
XSetICFocus(window->x11.ic);
if (window->cursorMode == GLFW_CURSOR_DISABLED)
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_DISABLED);
disableCursor(window);
_glfwInputWindowFocus(window, GLFW_TRUE);
_glfwInputWindowFocus(window, GL_TRUE);
return;
}
@ -1316,12 +1343,12 @@ static void processEvent(XEvent *event)
XUnsetICFocus(window->x11.ic);
if (window->cursorMode == GLFW_CURSOR_DISABLED)
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
restoreCursor(window);
if (window->monitor && window->autoIconify)
_glfwPlatformIconifyWindow(window);
_glfwInputWindowFocus(window, GLFW_FALSE);
_glfwInputWindowFocus(window, GL_FALSE);
return;
}
@ -1342,14 +1369,14 @@ static void processEvent(XEvent *event)
if (window->monitor)
leaveFullscreenMode(window);
_glfwInputWindowIconify(window, GLFW_TRUE);
_glfwInputWindowIconify(window, GL_TRUE);
}
else if (state == NormalState)
{
if (window->monitor)
enterFullscreenMode(window);
_glfwInputWindowIconify(window, GLFW_FALSE);
_glfwInputWindowIconify(window, GL_FALSE);
}
}
@ -1419,6 +1446,12 @@ static void processEvent(XEvent *event)
}
#endif /*_GLFW_HAS_XINPUT*/
}
if (event->type - _glfw.x11.randr.eventBase == RRScreenChangeNotify)
{
XRRUpdateConfiguration(event);
return;
}
}
@ -1467,20 +1500,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
Visual* visual;
int depth;
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GL_FALSE;
if (!_glfwChooseVisual(ctxconfig, fbconfig, &visual, &depth))
return GLFW_FALSE;
if (!createWindow(window, wndconfig, visual, depth))
return GLFW_FALSE;
if (ctxconfig->api != GLFW_NO_API)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
if (!createWindow(window, wndconfig))
return GL_FALSE;
if (wndconfig->monitor)
{
@ -1488,7 +1512,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
enterFullscreenMode(window);
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
@ -1502,8 +1526,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
window->x11.ic = NULL;
}
if (window->context.api != GLFW_NO_API)
_glfwDestroyContext(window);
_glfwDestroyContext(window);
if (window->x11.handle)
{
@ -1642,61 +1665,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
XFlush(_glfw.x11.display);
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
long supplied;
XSizeHints* hints = XAllocSizeHints();
if (XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied))
{
if (minwidth == GLFW_DONT_CARE || minwidth == GLFW_DONT_CARE)
hints->flags &= ~PMinSize;
else
{
hints->flags |= PMinSize;
hints->min_width = minwidth;
hints->min_height = minheight;
}
if (maxwidth == GLFW_DONT_CARE || maxwidth == GLFW_DONT_CARE)
hints->flags &= ~PMaxSize;
else
{
hints->flags |= PMaxSize;
hints->max_width = maxwidth;
hints->max_height = maxheight;
}
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
}
XFree(hints);
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
{
long supplied;
XSizeHints* hints = XAllocSizeHints();
if (XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied))
{
if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE)
hints->flags &= ~PAspect;
else
{
hints->flags |= PAspect;
hints->min_aspect.x = hints->max_aspect.x = numer;
hints->min_aspect.y = hints->max_aspect.y = denom;
}
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
}
XFree(hints);
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{
_glfwPlatformGetWindowSize(window, width, height);
@ -1908,63 +1876,20 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
0,0,0,0, (int) x, (int) y);
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
{
if (mode == GLFW_CURSOR_DISABLED)
switch (window->cursorMode)
{
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync,
window->x11.handle, _glfw.x11.cursor, CurrentTime);
case GLFW_CURSOR_NORMAL:
restoreCursor(window);
break;
case GLFW_CURSOR_HIDDEN:
hideCursor(window);
break;
case GLFW_CURSOR_DISABLED:
disableCursor(window);
break;
}
else
{
XUngrabPointer(_glfw.x11.display, CurrentTime);
if (mode == GLFW_CURSOR_NORMAL)
{
if (window->cursor)
{
XDefineCursor(_glfw.x11.display, window->x11.handle,
window->cursor->x11.handle);
}
else
XUndefineCursor(_glfw.x11.display, window->x11.handle);
}
else
{
XDefineCursor(_glfw.x11.display, window->x11.handle,
_glfw.x11.cursor);
}
}
}
const char* _glfwPlatformGetKeyName(int key, int scancode)
{
KeySym keysym;
int extra;
if (!_glfw.x11.xkb.available)
return NULL;
if (key != GLFW_KEY_UNKNOWN)
scancode = _glfw.x11.nativeKeys[key];
if (!_glfwIsPrintable(_glfw.x11.publicKeys[scancode]))
return NULL;
keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
if (keysym == NoSymbol)
return NULL;
XkbTranslateKeySym(_glfw.x11.display, &keysym, 0,
_glfw.x11.keyName, sizeof(_glfw.x11.keyName),
&extra);
if (!strlen(_glfw.x11.keyName))
return NULL;
return _glfw.x11.keyName;
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
@ -1973,9 +1898,9 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
{
cursor->x11.handle = _glfwCreateCursor(image, xhot, yhot);
if (!cursor->x11.handle)
return GLFW_FALSE;
return GL_FALSE;
return GLFW_TRUE;
return GL_TRUE;
}
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
@ -1986,10 +1911,10 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Failed to create standard cursor");
return GLFW_FALSE;
return GL_FALSE;
}
return GLFW_TRUE;
return GL_TRUE;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 X11 - www.glfw.org
// GLFW 3.1 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
@ -827,24 +827,24 @@ static const struct codepair {
{ 0x13be, 0x0178 },
{ 0x20ac, 0x20ac },
// Numeric keypad with numlock on
{ 0xff80 /*XKB_KEY_KP_Space*/, ' ' },
{ 0xffbd /*XKB_KEY_KP_Equal*/, '=' },
{ 0xffaa /*XKB_KEY_KP_Multiply*/, '*' },
{ 0xffab /*XKB_KEY_KP_Add*/, '+' },
{ 0xffac /*XKB_KEY_KP_Separator*/, ',' },
{ 0xffad /*XKB_KEY_KP_Subtract*/, '-' },
{ 0xffae /*XKB_KEY_KP_Decimal*/, '.' },
{ 0xffaf /*XKB_KEY_KP_Divide*/, '/' },
{ 0xffb0 /*XKB_KEY_KP_0*/, 0x0030 },
{ 0xffb1 /*XKB_KEY_KP_1*/, 0x0031 },
{ 0xffb2 /*XKB_KEY_KP_2*/, 0x0032 },
{ 0xffb3 /*XKB_KEY_KP_3*/, 0x0033 },
{ 0xffb4 /*XKB_KEY_KP_4*/, 0x0034 },
{ 0xffb5 /*XKB_KEY_KP_5*/, 0x0035 },
{ 0xffb6 /*XKB_KEY_KP_6*/, 0x0036 },
{ 0xffb7 /*XKB_KEY_KP_7*/, 0x0037 },
{ 0xffb8 /*XKB_KEY_KP_8*/, 0x0038 },
{ 0xffb9 /*XKB_KEY_KP_9*/, 0x0039 }
{ XK_KP_Space, ' ' },
{ XK_KP_Equal, '=' },
{ XK_KP_Multiply, '*' },
{ XK_KP_Add, '+' },
{ XK_KP_Separator, ',' },
{ XK_KP_Subtract, '-' },
{ XK_KP_Decimal, '.' },
{ XK_KP_Divide, '/' },
{ XK_KP_0, 0x0030 },
{ XK_KP_1, 0x0031 },
{ XK_KP_2, 0x0032 },
{ XK_KP_3, 0x0033 },
{ XK_KP_4, 0x0034 },
{ XK_KP_5, 0x0035 },
{ XK_KP_6, 0x0036 },
{ XK_KP_7, 0x0037 },
{ XK_KP_8, 0x0038 },
{ XK_KP_9, 0x0039 }
};

View File

@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.2 Linux - www.glfw.org
// GLFW 3.1 Linux - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//

View File

@ -27,7 +27,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -59,7 +58,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
switch (key)
{
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_V:
@ -128,7 +127,6 @@ int main(int argc, char** argv)
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);

View File

@ -30,7 +30,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#if defined(_MSC_VER)
@ -47,9 +46,9 @@
static double cursor_x;
static double cursor_y;
static int swap_interval = 1;
static int wait_events = GLFW_FALSE;
static int animate_cursor = GLFW_FALSE;
static int track_cursor = GLFW_FALSE;
static GLboolean wait_events = GL_FALSE;
static GLboolean animate_cursor = GL_FALSE;
static GLboolean track_cursor = GL_FALSE;
static GLFWcursor* standard_cursors[6];
static void error_callback(int error, const char* description)
@ -123,7 +122,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
if (glfwGetInputMode(window, GLFW_CURSOR) != GLFW_CURSOR_DISABLED)
{
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
@ -238,7 +237,6 @@ int main(void)
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwGetCursorPos(window, &cursor_x, &cursor_y);
printf("Cursor position: %f %f\n", cursor_x, cursor_y);

View File

@ -29,14 +29,13 @@
#include "tinycthread.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
static volatile int running = GLFW_TRUE;
static volatile GLboolean running = GL_TRUE;
static void error_callback(int error, const char* description)
{
@ -62,7 +61,7 @@ static int thread_main(void* data)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
static float nrand(void)
@ -91,7 +90,6 @@ int main(void)
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSetKeyCallback(window, key_callback);
if (thrd_create(&thread, thread_main, NULL) != thrd_success)
@ -118,7 +116,7 @@ int main(void)
glfwWaitEvents();
if (glfwWindowShouldClose(window))
running = GLFW_FALSE;
running = GL_FALSE;
}
glfwHideWindow(window);

View File

@ -31,7 +31,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -360,25 +359,12 @@ static void scroll_callback(GLFWwindow* window, double x, double y)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
Slot* slot = glfwGetWindowUserPointer(window);
const char* name = glfwGetKeyName(key, scancode);
if (name)
{
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (%s) (with%s) was %s\n",
counter++, slot->number, glfwGetTime(), key, scancode,
get_key_name(key),
name,
get_mods_name(mods),
get_action_name(action));
}
else
{
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n",
counter++, slot->number, glfwGetTime(), key, scancode,
get_key_name(key),
get_mods_name(mods),
get_action_name(action));
}
printf("%08x to %i at %0.3f: Key 0x%04x Scancode 0x%04x (%s) (with%s) was %s\n",
counter++, slot->number, glfwGetTime(), key, scancode,
get_key_name(key),
get_mods_name(mods),
get_action_name(action));
if (action != GLFW_PRESS)
return;
@ -520,7 +506,7 @@ int main(int argc, char** argv)
{
char title[128];
slots[i].closeable = GLFW_TRUE;
slots[i].closeable = GL_TRUE;
slots[i].number = i + 1;
sprintf(title, "Event Linter (Window %i)", slots[i].number);
@ -566,7 +552,6 @@ int main(int argc, char** argv)
glfwSetDropCallback(slots[i].window, drop_callback);
glfwMakeContextCurrent(slots[i].window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
}

View File

@ -28,7 +28,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -70,7 +69,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
case GLFW_KEY_ESCAPE:
{
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
@ -154,7 +153,6 @@ int main(int argc, char** argv)
set_gamma(window, 1.f);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);

View File

@ -23,9 +23,14 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
/* HACK: Explicitly include the glext.h shipping with GLFW, as this program uses
* many modern symbols not provided by the versions in some development
* environments (for example on OS X).
*/
#include <GL/glext.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -88,7 +93,6 @@ static void usage(void)
printf(" --stereo request stereo rendering\n");
printf(" --srgb request an sRGB capable framebuffer\n");
printf(" --singlebuffer request single-buffering\n");
printf(" --no-error request a context that does not emit errors\n");
}
static void error_callback(int error, const char* description)
@ -186,7 +190,7 @@ static void list_extensions(int api, int major, int minor)
putchar('\n');
}
static int valid_version(void)
static GLboolean valid_version(void)
{
int major, minor, revision;
glfwGetVersion(&major, &minor, &revision);
@ -194,13 +198,13 @@ static int valid_version(void)
if (major != GLFW_VERSION_MAJOR)
{
printf("*** ERROR: GLFW major version mismatch! ***\n");
return GLFW_FALSE;
return GL_FALSE;
}
if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION)
printf("*** WARNING: GLFW version mismatch! ***\n");
return GLFW_TRUE;
return GL_TRUE;
}
static void print_version(void)
@ -220,14 +224,14 @@ int main(int argc, char** argv)
{
int ch, api, major, minor, revision, profile;
GLint redbits, greenbits, bluebits, alphabits, depthbits, stencilbits;
int list = GLFW_FALSE;
GLboolean list = GL_FALSE;
GLFWwindow* window;
enum { API, BEHAVIOR, DEBUG, FORWARD, HELP, EXTENSIONS,
MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION,
REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS,
ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS,
AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY };
AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER };
const struct option options[] =
{
{ "behavior", 1, NULL, BEHAVIOR },
@ -256,7 +260,6 @@ int main(int argc, char** argv)
{ "stereo", 0, NULL, STEREO },
{ "srgb", 0, NULL, SRGB },
{ "singlebuffer", 0, NULL, SINGLEBUFFER },
{ "no-error", 0, NULL, NOERROR_SRSLY },
{ NULL, 0, NULL, 0 }
};
@ -306,11 +309,11 @@ int main(int argc, char** argv)
break;
case 'd':
case DEBUG:
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
break;
case 'f':
case FORWARD:
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
break;
case 'h':
case HELP:
@ -318,7 +321,7 @@ int main(int argc, char** argv)
exit(EXIT_SUCCESS);
case 'l':
case EXTENSIONS:
list = GLFW_TRUE;
list = GL_TRUE;
break;
case 'm':
case MAJOR:
@ -441,16 +444,13 @@ int main(int argc, char** argv)
glfwWindowHint(GLFW_SAMPLES, atoi(optarg));
break;
case STEREO:
glfwWindowHint(GLFW_STEREO, GLFW_TRUE);
glfwWindowHint(GLFW_STEREO, GL_TRUE);
break;
case SRGB:
glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
glfwWindowHint(GLFW_SRGB_CAPABLE, GL_TRUE);
break;
case SINGLEBUFFER:
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_FALSE);
break;
case NOERROR_SRSLY:
glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE);
glfwWindowHint(GLFW_DOUBLEBUFFER, GL_FALSE);
break;
default:
usage();
@ -460,7 +460,7 @@ int main(int argc, char** argv)
print_version();
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
if (!window)
@ -470,7 +470,6 @@ int main(int argc, char** argv)
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
// Report client API version
@ -501,12 +500,10 @@ int main(int argc, char** argv)
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
printf(" forward-compatible");
if (flags & 2/*GL_CONTEXT_FLAG_DEBUG_BIT*/)
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
printf(" debug");
if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB)
printf(" robustness");
if (flags & 8/*GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR*/)
printf(" no-error");
putchar('\n');
printf("%s context flags parsed by GLFW:", get_api_name(api));
@ -517,8 +514,6 @@ int main(int argc, char** argv)
printf(" debug");
if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) == GLFW_LOSE_CONTEXT_ON_RESET)
printf(" robustness");
if (glfwGetWindowAttrib(window, GLFW_CONTEXT_NO_ERROR))
printf(" no-error");
putchar('\n');
}

View File

@ -28,7 +28,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -66,7 +65,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
glfwIconifyWindow(window);
break;
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
}
@ -150,16 +149,13 @@ static GLFWwindow* create_window(GLFWmonitor* monitor)
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
return window;
}
int main(int argc, char** argv)
{
int ch, i, window_count;
int auto_iconify = GLFW_TRUE, fullscreen = GLFW_FALSE, all_monitors = GLFW_FALSE;
GLboolean auto_iconify = GL_TRUE, fullscreen = GL_FALSE, all_monitors = GL_FALSE;
GLFWwindow** windows;
while ((ch = getopt(argc, argv, "afhn")) != -1)
@ -167,7 +163,7 @@ int main(int argc, char** argv)
switch (ch)
{
case 'a':
all_monitors = GLFW_TRUE;
all_monitors = GL_TRUE;
break;
case 'h':
@ -175,11 +171,11 @@ int main(int argc, char** argv)
exit(EXIT_SUCCESS);
case 'f':
fullscreen = GLFW_TRUE;
fullscreen = GL_TRUE;
break;
case 'n':
auto_iconify = GLFW_FALSE;
auto_iconify = GL_FALSE;
break;
default:

View File

@ -28,7 +28,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -41,7 +40,7 @@
typedef struct Joystick
{
int present;
GLboolean present;
char* name;
float* axes;
unsigned char* buttons;
@ -177,7 +176,7 @@ static void refresh_joysticks(void)
joystick_count++;
}
j->present = GLFW_TRUE;
j->present = GL_TRUE;
}
else
{
@ -217,7 +216,6 @@ int main(void)
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
while (!glfwWindowShouldClose(window))

View File

@ -28,7 +28,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -79,7 +78,7 @@ static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
static void list_modes(GLFWmonitor* monitor)
@ -150,7 +149,6 @@ static void test_modes(GLFWmonitor* monitor)
glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetTime(0.0);

View File

@ -29,7 +29,7 @@
//
//========================================================================
#include <glad/glad.h>
#define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -97,7 +97,7 @@ int main(int argc, char** argv)
printf("Requesting that MSAA not be available\n");
glfwWindowHint(GLFW_SAMPLES, samples);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL);
if (!window)
@ -110,12 +110,11 @@ int main(int argc, char** argv)
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
if (!GLAD_GL_ARB_multisample && !GLAD_GL_VERSION_1_3)
if (!glfwExtensionSupported("GL_ARB_multisample"))
{
printf("Multisampling is not supported\n");
printf("GL_ARB_multisample extension not supported\n");
glfwTerminate();
exit(EXIT_FAILURE);
@ -123,7 +122,7 @@ int main(int argc, char** argv)
glfwShowWindow(window);
glGetIntegerv(GL_SAMPLES, &samples);
glGetIntegerv(GL_SAMPLES_ARB, &samples);
if (samples)
printf("Context reports MSAA is available with %i samples\n", samples);
else

View File

@ -33,7 +33,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <time.h>
@ -64,7 +63,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
case GLFW_KEY_Q:
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
}
@ -81,7 +80,6 @@ static GLFWwindow* open_window(int width, int height, GLFWmonitor* monitor)
return NULL;
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

View File

@ -27,7 +27,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -47,20 +46,19 @@ static void error_callback(int error, const char* description)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
}
static GLFWwindow* open_window(const char* title, GLFWwindow* share, int posX, int posY)
{
GLFWwindow* window;
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
window = glfwCreateWindow(WIDTH, HEIGHT, title, NULL, share);
if (!window)
return NULL;
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetWindowPos(window, posX, posY);
glfwShowWindow(window);

View File

@ -28,7 +28,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -37,7 +36,7 @@
#include "getopt.h"
static int swap_tear;
static GLboolean swap_tear;
static int swap_interval;
static double frame_rate;
@ -119,7 +118,7 @@ int main(int argc, char** argv)
float position;
unsigned long frame_count = 0;
double last_time, current_time;
int fullscreen = GLFW_FALSE;
GLboolean fullscreen = GL_FALSE;
GLFWmonitor* monitor = NULL;
GLFWwindow* window;
@ -132,7 +131,7 @@ int main(int argc, char** argv)
exit(EXIT_SUCCESS);
case 'f':
fullscreen = GLFW_TRUE;
fullscreen = GL_TRUE;
break;
}
}
@ -171,7 +170,6 @@ int main(int argc, char** argv)
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
set_swap_interval(window, 0);
last_time = glfwGetTime();

View File

@ -30,7 +30,6 @@
#include "tinycthread.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -45,7 +44,7 @@ typedef struct
thrd_t id;
} Thread;
static volatile int running = GLFW_TRUE;
static volatile GLboolean running = GL_TRUE;
static void error_callback(int error, const char* description)
{
@ -88,7 +87,7 @@ int main(void)
if (!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
for (i = 0; i < count; i++)
{
@ -103,14 +102,7 @@ int main(void)
glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
glfwShowWindow(threads[i].window);
}
glfwMakeContextCurrent(threads[0].window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwMakeContextCurrent(NULL);
for (i = 0; i < count; i++)
{
if (thrd_create(&threads[i].id, thread_main, threads + i) !=
thrd_success)
{
@ -128,7 +120,7 @@ int main(void)
for (i = 0; i < count; i++)
{
if (glfwWindowShouldClose(threads[i].window))
running = GLFW_FALSE;
running = GL_FALSE;
}
}

View File

@ -27,7 +27,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -60,7 +59,6 @@ int main(void)
}
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

View File

@ -27,7 +27,6 @@
//
//========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
@ -73,7 +72,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
}
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
}
@ -81,7 +80,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
int main(int argc, char** argv)
{
int i;
int running = GLFW_TRUE;
GLboolean running = GL_TRUE;
GLFWwindow* windows[4];
glfwSetErrorCallback(error_callback);
@ -89,8 +88,8 @@ int main(int argc, char** argv)
if (!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_DECORATED, GL_FALSE);
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
for (i = 0; i < 4; i++)
{
@ -106,7 +105,6 @@ int main(int argc, char** argv)
glfwSetKeyCallback(windows[i], key_callback);
glfwMakeContextCurrent(windows[i]);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f);
glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom);
@ -127,7 +125,7 @@ int main(int argc, char** argv)
glfwSwapBuffers(windows[i]);
if (glfwWindowShouldClose(windows[i]))
running = GLFW_FALSE;
running = GL_FALSE;
}
glfwPollEvents();