From 09fc128136c2c5628cf64064e4b6b31ca1415190 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Thu, 12 Mar 2015 12:55:54 +0100 Subject: [PATCH] Updated GLFW to version 3.1. --- CMakeLists.txt | 4 + extern/glfw/CMake/modules/FindEGL.cmake | 4 +- extern/glfw/CMake/modules/FindGLESv1.cmake | 4 +- extern/glfw/CMake/modules/FindGLESv2.cmake | 4 +- extern/glfw/CMake/modules/FindMir.cmake | 18 + extern/glfw/CMake/modules/FindWayland.cmake | 66 + extern/glfw/CMake/modules/FindXKBCommon.cmake | 34 + .../lib/cmake/glfw/glfwTargets-release.cmake | 19 + .../Export/lib/cmake/glfw/glfwTargets.cmake | 84 + extern/glfw/CMakeLists.txt | 323 ++- extern/glfw/README.md | 206 +- extern/glfw/cmake_install.cmake | 74 + extern/glfw/cmake_uninstall.cmake | 29 + extern/glfw/deps/GL/glext.h | 842 +++++-- extern/glfw/deps/GL/glxext.h | 82 +- extern/glfw/deps/GL/wglext.h | 13 +- extern/glfw/deps/KHR/khrplatform.h | 282 +++ extern/glfw/deps/getopt.c | 467 ++-- extern/glfw/deps/getopt.h | 94 +- extern/glfw/deps/glad.c | 728 +++++++ extern/glfw/deps/glad/glad.h | 1925 +++++++++++++++++ extern/glfw/deps/tinycthread.h | 1 + extern/glfw/docs/CMakeLists.txt | 5 - extern/glfw/docs/Doxyfile.in | 1872 ---------------- extern/glfw/docs/build.dox | 217 -- extern/glfw/docs/compat.dox | 137 -- extern/glfw/docs/compile.dox | 261 --- extern/glfw/docs/context.dox | 174 -- extern/glfw/docs/extra.css | 312 --- extern/glfw/docs/footer.html | 7 - extern/glfw/docs/header.html | 34 - extern/glfw/docs/internal.dox | 116 - extern/glfw/docs/main.dox | 22 - extern/glfw/docs/monitor.dox | 105 - extern/glfw/docs/moving.dox | 327 --- extern/glfw/docs/news.dox | 173 -- extern/glfw/docs/quick.dox | 308 --- extern/glfw/docs/window.dox | 496 ----- extern/glfw/examples/CMakeLists.txt | 48 +- extern/glfw/examples/boing.c | 43 +- extern/glfw/examples/heightmap.c | 285 +-- extern/glfw/examples/particles.c | 1061 +++++++++ extern/glfw/examples/simple.c | 1 + extern/glfw/examples/wave.c | 19 +- extern/glfw/include/GLFW/glfw3.h | 1921 ++++++++++++---- extern/glfw/include/GLFW/glfw3native.h | 212 +- .../glfw/src/CMakeFiles/glfw.dir/context.c.o | Bin 0 -> 10176 bytes .../src/CMakeFiles/glfw.dir/glx_context.c.o | Bin 0 -> 11112 bytes extern/glfw/src/CMakeFiles/glfw.dir/init.c.o | Bin 0 -> 5608 bytes extern/glfw/src/CMakeFiles/glfw.dir/input.c.o | Bin 0 -> 11456 bytes .../CMakeFiles/glfw.dir/linux_joystick.c.o | Bin 0 -> 7832 bytes .../glfw/src/CMakeFiles/glfw.dir/monitor.c.o | Bin 0 -> 11384 bytes .../src/CMakeFiles/glfw.dir/posix_time.c.o | Bin 0 -> 2856 bytes .../src/CMakeFiles/glfw.dir/posix_tls.c.o | Bin 0 -> 2520 bytes .../glfw/src/CMakeFiles/glfw.dir/window.c.o | Bin 0 -> 15320 bytes .../glfw/src/CMakeFiles/glfw.dir/x11_init.c.o | Bin 0 -> 21608 bytes .../src/CMakeFiles/glfw.dir/x11_monitor.c.o | Bin 0 -> 10936 bytes .../src/CMakeFiles/glfw.dir/x11_window.c.o | Bin 0 -> 30352 bytes .../src/CMakeFiles/glfw.dir/xkb_unicode.c.o | Bin 0 -> 4864 bytes extern/glfw/src/CMakeLists.txt | 70 +- extern/glfw/src/cmake_install.cmake | 38 + extern/glfw/src/cocoa_gamma.c | 84 - extern/glfw/src/cocoa_init.m | 138 +- extern/glfw/src/cocoa_monitor.m | 259 ++- extern/glfw/src/cocoa_platform.h | 101 +- extern/glfw/src/cocoa_window.m | 691 +++--- extern/glfw/src/context.c | 215 +- extern/glfw/src/egl_context.c | 93 +- .../src/{egl_platform.h => egl_context.h} | 39 +- extern/glfw/src/gamma.c | 126 -- extern/glfw/src/glfw3.pc | 13 + extern/glfw/src/glfw3.pc.in | 2 +- extern/glfw/src/glfw3Config.cmake | 29 + extern/glfw/src/glfw3Config.cmake.in | 15 + extern/glfw/src/glfw3ConfigVersion.cmake | 46 + extern/glfw/src/glfwConfig.cmake.in | 10 - extern/glfw/src/glfwConfigVersion.cmake.in | 12 - extern/glfw/src/{config.h => glfw_config.h} | 27 +- extern/glfw/src/glfw_config.h.in | 10 +- extern/glfw/src/glx_context.c | 198 +- .../src/{glx_platform.h => glx_context.h} | 57 +- extern/glfw/src/init.c | 16 +- extern/glfw/src/input.c | 328 ++- extern/glfw/src/internal.h | 242 ++- extern/glfw/src/iokit_joystick.h | 61 + .../{cocoa_joystick.m => iokit_joystick.m} | 114 +- extern/glfw/src/joystick.c | 90 - extern/glfw/src/libglfw3.a | Bin 0 -> 151730 bytes extern/glfw/src/linux_joystick.c | 322 +++ extern/glfw/src/linux_joystick.h | 63 + extern/glfw/src/{cocoa_time.c => mach_time.c} | 14 +- extern/glfw/src/mir_init.c | 101 + extern/glfw/src/mir_monitor.c | 138 ++ extern/glfw/src/mir_platform.h | 110 + extern/glfw/src/mir_window.c | 687 ++++++ extern/glfw/src/monitor.c | 151 +- .../src/{nsgl_platform.h => nsgl_context.h} | 40 +- extern/glfw/src/nsgl_context.m | 139 +- extern/glfw/src/{x11_time.c => posix_time.c} | 21 +- extern/glfw/src/{time.c => posix_time.h} | 33 +- extern/glfw/src/posix_tls.c | 66 + extern/glfw/src/{clipboard.c => posix_tls.h} | 39 +- extern/glfw/src/wgl_context.c | 139 +- .../src/{wgl_platform.h => wgl_context.h} | 49 +- extern/glfw/src/win32_clipboard.c | 127 -- extern/glfw/src/win32_gamma.c | 82 - extern/glfw/src/win32_init.c | 195 +- extern/glfw/src/win32_monitor.c | 234 +- extern/glfw/src/win32_platform.h | 189 +- extern/glfw/src/win32_time.c | 22 +- .../src/{cocoa_clipboard.m => win32_tls.c} | 69 +- extern/glfw/src/win32_tls.h | 48 + extern/glfw/src/win32_window.c | 1042 +++++---- extern/glfw/src/window.c | 342 +-- .../{win32_joystick.c => winmm_joystick.c} | 30 +- extern/glfw/src/winmm_joystick.h | 47 + extern/glfw/src/wl_init.c | 630 ++++++ extern/glfw/src/wl_monitor.c | 250 +++ extern/glfw/src/wl_platform.h | 140 ++ extern/glfw/src/wl_window.c | 524 +++++ extern/glfw/src/x11_clipboard.c | 335 --- extern/glfw/src/x11_gamma.c | 123 -- extern/glfw/src/x11_init.c | 477 ++-- extern/glfw/src/x11_joystick.c | 259 --- extern/glfw/src/x11_monitor.c | 402 ++-- extern/glfw/src/x11_platform.h | 156 +- extern/glfw/src/x11_window.c | 1125 ++++++++-- .../glfw/src/{x11_unicode.c => xkb_unicode.c} | 34 +- extern/glfw/src/xkb_unicode.h | 33 + extern/glfw/tests/CMakeLists.txt | 38 +- extern/glfw/tests/accuracy.c | 3 +- extern/glfw/tests/cursor.c | 289 +++ extern/glfw/tests/cursoranim.c | 135 ++ extern/glfw/tests/defaults.c | 2 +- extern/glfw/tests/empty.c | 129 ++ extern/glfw/tests/events.c | 293 ++- extern/glfw/tests/fsaa.c | 12 +- extern/glfw/tests/gamma.c | 8 +- extern/glfw/tests/glfwinfo.c | 51 +- extern/glfw/tests/iconify.c | 178 +- extern/glfw/tests/modes.c | 1 + extern/glfw/tests/peter.c | 57 +- extern/glfw/tests/reopen.c | 4 +- extern/glfw/tests/sharing.c | 3 +- extern/glfw/tests/threads.c | 7 +- extern/glfw/tests/windows.c | 25 +- 146 files changed, 16756 insertions(+), 10089 deletions(-) create mode 100644 extern/glfw/CMake/modules/FindMir.cmake create mode 100644 extern/glfw/CMake/modules/FindWayland.cmake create mode 100644 extern/glfw/CMake/modules/FindXKBCommon.cmake create mode 100644 extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets-release.cmake create mode 100644 extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets.cmake create mode 100644 extern/glfw/cmake_install.cmake create mode 100644 extern/glfw/cmake_uninstall.cmake create mode 100644 extern/glfw/deps/KHR/khrplatform.h create mode 100644 extern/glfw/deps/glad.c create mode 100644 extern/glfw/deps/glad/glad.h delete mode 100644 extern/glfw/docs/CMakeLists.txt delete mode 100644 extern/glfw/docs/Doxyfile.in delete mode 100644 extern/glfw/docs/build.dox delete mode 100644 extern/glfw/docs/compat.dox delete mode 100644 extern/glfw/docs/compile.dox delete mode 100644 extern/glfw/docs/context.dox delete mode 100644 extern/glfw/docs/extra.css delete mode 100644 extern/glfw/docs/footer.html delete mode 100644 extern/glfw/docs/header.html delete mode 100644 extern/glfw/docs/internal.dox delete mode 100644 extern/glfw/docs/main.dox delete mode 100644 extern/glfw/docs/monitor.dox delete mode 100644 extern/glfw/docs/moving.dox delete mode 100644 extern/glfw/docs/news.dox delete mode 100644 extern/glfw/docs/quick.dox delete mode 100644 extern/glfw/docs/window.dox create mode 100644 extern/glfw/examples/particles.c create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/context.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/glx_context.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/init.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/input.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/linux_joystick.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/monitor.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/posix_time.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/posix_tls.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/window.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/x11_init.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/x11_monitor.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/x11_window.c.o create mode 100644 extern/glfw/src/CMakeFiles/glfw.dir/xkb_unicode.c.o create mode 100644 extern/glfw/src/cmake_install.cmake delete mode 100644 extern/glfw/src/cocoa_gamma.c rename extern/glfw/src/{egl_platform.h => egl_context.h} (69%) delete mode 100644 extern/glfw/src/gamma.c create mode 100644 extern/glfw/src/glfw3.pc create mode 100644 extern/glfw/src/glfw3Config.cmake create mode 100644 extern/glfw/src/glfw3Config.cmake.in create mode 100644 extern/glfw/src/glfw3ConfigVersion.cmake delete mode 100644 extern/glfw/src/glfwConfig.cmake.in delete mode 100644 extern/glfw/src/glfwConfigVersion.cmake.in rename extern/glfw/src/{config.h => glfw_config.h} (78%) rename extern/glfw/src/{glx_platform.h => glx_context.h} (68%) create mode 100644 extern/glfw/src/iokit_joystick.h rename extern/glfw/src/{cocoa_joystick.m => iokit_joystick.m} (87%) delete mode 100644 extern/glfw/src/joystick.c create mode 100644 extern/glfw/src/libglfw3.a create mode 100644 extern/glfw/src/linux_joystick.c create mode 100644 extern/glfw/src/linux_joystick.h rename extern/glfw/src/{cocoa_time.c => mach_time.c} (85%) create mode 100644 extern/glfw/src/mir_init.c create mode 100644 extern/glfw/src/mir_monitor.c create mode 100644 extern/glfw/src/mir_platform.h create mode 100644 extern/glfw/src/mir_window.c rename extern/glfw/src/{nsgl_platform.h => nsgl_context.h} (59%) rename extern/glfw/src/{x11_time.c => posix_time.c} (84%) rename extern/glfw/src/{time.c => posix_time.h} (71%) create mode 100644 extern/glfw/src/posix_tls.c rename extern/glfw/src/{clipboard.c => posix_tls.h} (58%) rename extern/glfw/src/{wgl_platform.h => wgl_context.h} (71%) delete mode 100644 extern/glfw/src/win32_clipboard.c delete mode 100644 extern/glfw/src/win32_gamma.c rename extern/glfw/src/{cocoa_clipboard.m => win32_tls.c} (56%) create mode 100644 extern/glfw/src/win32_tls.h rename extern/glfw/src/{win32_joystick.c => winmm_joystick.c} (83%) create mode 100644 extern/glfw/src/winmm_joystick.h create mode 100644 extern/glfw/src/wl_init.c create mode 100644 extern/glfw/src/wl_monitor.c create mode 100644 extern/glfw/src/wl_platform.h create mode 100644 extern/glfw/src/wl_window.c delete mode 100644 extern/glfw/src/x11_clipboard.c delete mode 100644 extern/glfw/src/x11_gamma.c delete mode 100644 extern/glfw/src/x11_joystick.c rename extern/glfw/src/{x11_unicode.c => xkb_unicode.c} (96%) create mode 100644 extern/glfw/src/xkb_unicode.h create mode 100644 extern/glfw/tests/cursor.c create mode 100644 extern/glfw/tests/cursoranim.c create mode 100644 extern/glfw/tests/empty.c diff --git a/CMakeLists.txt b/CMakeLists.txt index f6881e7..4ba59fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,10 @@ INCLUDE(${CMAKE_SOURCE_DIR}/extern/acgl/CMakeListsStaticInclude.txt) # GLFW (and some other linker flags) # +OPTION(GLFW_BUILD_DOCS OFF) +OPTION(GLFW_BUILD_TESTS OFF) +OPTION(GLFW_BUILD_EXAMPLES OFF) + FILE(GLOB_RECURSE HEADER_FILES_GLFW "${CMAKE_SOURCE_DIR}/extern/glfw/include/*.h") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extern/glfw/include) SET(HEADER_FILES ${HEADER_FILES} ${HEADER_FILES_GLFW}) diff --git a/extern/glfw/CMake/modules/FindEGL.cmake b/extern/glfw/CMake/modules/FindEGL.cmake index 0929c92..796eef9 100644 --- a/extern/glfw/CMake/modules/FindEGL.cmake +++ b/extern/glfw/CMake/modules/FindEGL.cmake @@ -4,10 +4,10 @@ # EGL_LIBRARY # EGL_FOUND -find_path(EGL_INCLUDE_DIR NAMES EGL/egl.h) +find_path(EGL_INCLUDE_DIR NAMES EGL/egl.h PATHS /opt/vc/include) set(EGL_NAMES ${EGL_NAMES} egl EGL) -find_library(EGL_LIBRARY NAMES ${EGL_NAMES}) +find_library(EGL_LIBRARY NAMES ${EGL_NAMES} PATHS /opt/vc/lib) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR) diff --git a/extern/glfw/CMake/modules/FindGLESv1.cmake b/extern/glfw/CMake/modules/FindGLESv1.cmake index 3c77929..6ab0414 100644 --- a/extern/glfw/CMake/modules/FindGLESv1.cmake +++ b/extern/glfw/CMake/modules/FindGLESv1.cmake @@ -4,10 +4,10 @@ # GLESv1_LIBRARY # GLESv1_FOUND -find_path(GLESv1_INCLUDE_DIR NAMES GLES/gl.h) +find_path(GLESv1_INCLUDE_DIR NAMES GLES/gl.h PATHS /opt/vc/include) set(GLESv1_NAMES ${GLESv1_NAMES} GLESv1_CM) -find_library(GLESv1_LIBRARY NAMES ${GLESv1_NAMES}) +find_library(GLESv1_LIBRARY NAMES ${GLESv1_NAMES} PATHS /opt/vc/lib) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GLESv1 DEFAULT_MSG GLESv1_LIBRARY GLESv1_INCLUDE_DIR) diff --git a/extern/glfw/CMake/modules/FindGLESv2.cmake b/extern/glfw/CMake/modules/FindGLESv2.cmake index 0a2f810..12c4d06 100644 --- a/extern/glfw/CMake/modules/FindGLESv2.cmake +++ b/extern/glfw/CMake/modules/FindGLESv2.cmake @@ -4,10 +4,10 @@ # GLESv2_LIBRARY # GLESv2_FOUND -find_path(GLESv2_INCLUDE_DIR NAMES GLES2/gl2.h) +find_path(GLESv2_INCLUDE_DIR NAMES GLES2/gl2.h PATHS /opt/vc/include) set(GLESv2_NAMES ${GLESv2_NAMES} GLESv2) -find_library(GLESv2_LIBRARY NAMES ${GLESv2_NAMES}) +find_library(GLESv2_LIBRARY NAMES ${GLESv2_NAMES} PATHS /opt/vc/lib) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARY GLESv2_INCLUDE_DIR) diff --git a/extern/glfw/CMake/modules/FindMir.cmake b/extern/glfw/CMake/modules/FindMir.cmake new file mode 100644 index 0000000..b1a495b --- /dev/null +++ b/extern/glfw/CMake/modules/FindMir.cmake @@ -0,0 +1,18 @@ +# Try to find Mir on a Unix system +# +# This will define: +# +# MIR_LIBRARIES - Link these to use Wayland +# MIR_INCLUDE_DIR - Include directory for Wayland +# +# Copyright (c) 2014 Brandon Schaefer + +if (NOT WIN32) + + find_package (PkgConfig) + pkg_check_modules (PKG_MIR QUIET mirclient) + + set (MIR_INCLUDE_DIR ${PKG_MIR_INCLUDE_DIRS}) + set (MIR_LIBRARIES ${PKG_MIR_LIBRARIES}) + +endif () diff --git a/extern/glfw/CMake/modules/FindWayland.cmake b/extern/glfw/CMake/modules/FindWayland.cmake new file mode 100644 index 0000000..f93218b --- /dev/null +++ b/extern/glfw/CMake/modules/FindWayland.cmake @@ -0,0 +1,66 @@ +# Try to find Wayland on a Unix system +# +# This will define: +# +# WAYLAND_FOUND - True if Wayland is found +# WAYLAND_LIBRARIES - Link these to use Wayland +# WAYLAND_INCLUDE_DIR - Include directory for Wayland +# WAYLAND_DEFINITIONS - Compiler flags for using Wayland +# +# In addition the following more fine grained variables will be defined: +# +# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES +# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES +# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES +# +# Copyright (c) 2013 Martin Gräßlin +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +IF (NOT WIN32) + IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES) + # In the cache already + SET(WAYLAND_FIND_QUIETLY TRUE) + ENDIF () + + # Use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor) + + SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS}) + + FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) + FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) + FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) + FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) + + FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) + FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) + FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) + FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) + + set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR}) + + set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES}) + + list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR) + + include(FindPackageHandleStandardArgs) + + FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR) + + MARK_AS_ADVANCED( + WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES + WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES + WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES + WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES + WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES + ) + +ENDIF () diff --git a/extern/glfw/CMake/modules/FindXKBCommon.cmake b/extern/glfw/CMake/modules/FindXKBCommon.cmake new file mode 100644 index 0000000..0f571ee --- /dev/null +++ b/extern/glfw/CMake/modules/FindXKBCommon.cmake @@ -0,0 +1,34 @@ +# - Try to find XKBCommon +# Once done, this will define +# +# XKBCOMMON_FOUND - System has XKBCommon +# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories +# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon +# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon + +find_package(PkgConfig) +pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) +set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) + +find_path(XKBCOMMON_INCLUDE_DIR + NAMES xkbcommon/xkbcommon.h + HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS} +) + +find_library(XKBCOMMON_LIBRARY + NAMES xkbcommon + HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS} +) + +set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) +set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS}) +set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(XKBCommon DEFAULT_MSG + XKBCOMMON_LIBRARY + XKBCOMMON_INCLUDE_DIR +) + +mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) + diff --git a/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets-release.cmake b/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets-release.cmake new file mode 100644 index 0000000..32f734b --- /dev/null +++ b/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets-release.cmake @@ -0,0 +1,19 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Release". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "glfw" for configuration "Release" +set_property(TARGET glfw APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(glfw PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libglfw3.a" + ) + +list(APPEND _IMPORT_CHECK_TARGETS glfw ) +list(APPEND _IMPORT_CHECK_FILES_FOR_glfw "${_IMPORT_PREFIX}/lib/libglfw3.a" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets.cmake b/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets.cmake new file mode 100644 index 0000000..e3c3a48 --- /dev/null +++ b/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets.cmake @@ -0,0 +1,84 @@ +# Generated by CMake 3.1.3 + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget glfw) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) + +# Create imported target glfw +add_library(glfw STATIC IMPORTED) + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/glfwTargets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/extern/glfw/CMakeLists.txt b/extern/glfw/CMakeLists.txt index 0a80900..731f09f 100644 --- a/extern/glfw/CMakeLists.txt +++ b/extern/glfw/CMakeLists.txt @@ -1,15 +1,23 @@ project(GLFW C) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.9) + +if (CMAKE_VERSION VERSION_EQUAL "3.0" OR CMAKE_VERSION VERSION_GREATER "3.0") + # Until all major package systems have moved to CMake 3, + # we stick with the older INSTALL_NAME_DIR mechanism + cmake_policy(SET CMP0042 OLD) +endif() set(GLFW_VERSION_MAJOR "3") -set(GLFW_VERSION_MINOR "0") -set(GLFW_VERSION_PATCH "4") +set(GLFW_VERSION_MINOR "1") +set(GLFW_VERSION_PATCH "0") 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}") set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib will be installed: lib or lib64") +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON) option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON) @@ -26,10 +34,16 @@ 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) else() option(GLFW_USE_EGL "Use EGL for context creation" OFF) endif() +if (UNIX AND NOT APPLE) + option(GLFW_USE_WAYLAND "Use Wayland for context creation (implies EGL as well)" OFF) + option(GLFW_USE_MIR "Use Mir for context creation (implies EGL as well)" OFF) +endif() + if (MSVC) option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON) endif() @@ -38,6 +52,12 @@ if (BUILD_SHARED_LIBS) set(_GLFW_BUILD_DLL 1) endif() +if (GLFW_USE_WAYLAND) + set(GLFW_USE_EGL ON) +elseif (GLFW_USE_MIR) + set(GLFW_USE_EGL ON) +endif() + if (GLFW_USE_EGL) set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING "The client library to use; one of opengl, glesv1 or glesv2") @@ -52,7 +72,7 @@ if (GLFW_USE_EGL) message(FATAL_ERROR "Unsupported client library") endif() - set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/modules) + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake/modules") find_package(EGL REQUIRED) if (NOT _GLFW_USE_OPENGL) @@ -115,12 +135,39 @@ if (MSVC) endif() endif() +if (MINGW) + # Enable link-time exploit mitigation features enabled by default on MSVC + + include(CheckCCompilerFlag) + + # Compatibility with data execution prevention (DEP) + set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") + check_c_compiler_flag("" _GLFW_HAS_DEP) + if (_GLFW_HAS_DEP) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat ${CMAKE_SHARED_LINKER_FLAGS}") + endif() + + # Compatibility with address space layout randomization (ASLR) + set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase") + check_c_compiler_flag("" _GLFW_HAS_ASLR) + if (_GLFW_HAS_ASLR) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}") + endif() + + # Compatibility with 64-bit address space layout randomization (ASLR) + set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va") + check_c_compiler_flag("" _GLFW_HAS_64ASLR) + if (_GLFW_HAS_64ASLR) + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}") + endif() +endif() + #-------------------------------------------------------------------- # Detect and select backend APIs #-------------------------------------------------------------------- if (WIN32) set(_GLFW_WIN32 1) - message(STATUS "Using Win32 for window creation") + message(STATUS "Using Win32 for window creation") if (GLFW_USE_EGL) set(_GLFW_EGL 1) @@ -135,8 +182,16 @@ elseif (APPLE) set(_GLFW_NSGL 1) message(STATUS "Using NSGL for context creation") elseif (UNIX) - set(_GLFW_X11 1) - message(STATUS "Using X11 for window creation") + if (GLFW_USE_WAYLAND) + set(_GLFW_WAYLAND 1) + message(STATUS "Using Wayland for window creation") + elseif (GLFW_USE_MIR) + set(_GLFW_MIR 1) + message(STATUS "Using Mir for window creation") + else() + set(_GLFW_X11 1) + message(STATUS "Using X11 for window creation") + endif() if (GLFW_USE_EGL) set(_GLFW_EGL 1) @@ -153,12 +208,8 @@ endif() # Use Win32 for window creation #-------------------------------------------------------------------- if (_GLFW_WIN32) - # The DLL links against winmm; the static library loads it - # That way, both code paths receive testing - if (BUILD_SHARED_LIBS) - set(_GLFW_NO_DLOAD_WINMM 1) - list(APPEND glfw_LIBRARIES winmm) - endif() + + list(APPEND glfw_PKG_LIBS "-lgdi32") if (GLFW_USE_DWM_SWAP_INTERVAL) set(_GLFW_USE_DWM_SWAP_INTERVAL 1) @@ -171,16 +222,20 @@ if (_GLFW_WIN32) # the inclusion of stddef.h (by glfw3.h), which is itself included before # win32_platform.h. We define them here until a saner solution can be found # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. - add_definitions(-DUNICODE) - add_definitions(-DWINVER=0x0501) + if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") + add_definitions(-DUNICODE -DWINVER=0x0501) + endif() endif() #-------------------------------------------------------------------- # Use WGL for context creation #-------------------------------------------------------------------- if (_GLFW_WGL) - list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + + list(APPEND glfw_PKG_LIBS "-lopengl32") + + list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") endif() #-------------------------------------------------------------------- @@ -190,13 +245,13 @@ if (_GLFW_X11) find_package(X11 REQUIRED) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} x11") + list(APPEND glfw_PKG_DEPS "x11") # Set up library and include paths - list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH}) - list(APPEND glfw_LIBRARIES ${X11_X11_LIB} ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") if (UNIX AND NOT APPLE) - list(APPEND glfw_LIBRARIES ${RT_LIBRARY}) + list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") endif() # Check for XRandR (modern resolution switching and gamma control) @@ -204,35 +259,44 @@ if (_GLFW_X11) message(FATAL_ERROR "The RandR library and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH}) - list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr") + list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_Xrandr_LIB}") + list(APPEND glfw_PKG_DEPS "xrandr") + + # Check for Xinerama (legacy multi-monitor support) + if (NOT X11_Xinerama_FOUND) + message(FATAL_ERROR "The Xinerama library and headers were not found") + endif() + + list(APPEND glfw_INCLUDE_DIRS "${X11_Xinerama_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_Xinerama_LIB}") + list(APPEND glfw_PKG_DEPS "xinerama") # Check for XInput (high-resolution cursor motion) if (NOT X11_Xinput_FOUND) message(FATAL_ERROR "The XInput library and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH}) + list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}") if (X11_Xinput_LIB) - list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB}) + list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}") else() # Backwards compatibility (bug in CMake 2.8.7) list(APPEND glfw_LIBRARIES Xi) endif() - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi") + list(APPEND glfw_PKG_DEPS "xi") # Check for Xf86VidMode (fallback gamma control) if (NOT X11_xf86vmode_FOUND) message(FATAL_ERROR "The Xf86VidMode library and headers were not found") endif() - list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm") + list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}") + list(APPEND glfw_PKG_DEPS "xxf86vm") if (X11_Xxf86vm_LIB) - list(APPEND glfw_LIBRARIES ${X11_Xxf86vm_LIB}) + list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}") else() # Backwards compatibility (see CMake bug 0006976) list(APPEND glfw_LIBRARIES Xxf86vm) @@ -241,24 +305,79 @@ if (_GLFW_X11) # Check for Xkb (X keyboard extension) if (NOT X11_Xkb_FOUND) message(FATAL_ERROR "The X keyboard extension headers were not found") - endif() + endif() - list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH}) + list(APPEND glfw_INCLUDE_DIR "${X11_Xkb_INCLUDE_PATH}") find_library(RT_LIBRARY rt) mark_as_advanced(RT_LIBRARY) if (RT_LIBRARY) - list(APPEND glfw_LIBRARIES ${RT_LIBRARY}) - set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lrt") + list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") + list(APPEND glfw_PKG_LIBS "-lrt") endif() find_library(MATH_LIBRARY m) mark_as_advanced(MATH_LIBRARY) if (MATH_LIBRARY) - list(APPEND glfw_LIBRARIES ${MATH_LIBRARY}) - set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm") + list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") + list(APPEND glfw_PKG_LIBS "-lm") endif() + # Check for Xcursor + if (NOT X11_Xcursor_FOUND) + message(FATAL_ERROR "The Xcursor libraries and headers were not found") + endif() + + list(APPEND glfw_INCLUDE_DIR "${X11_Xcursor_INCLUDE_PATH}") + list(APPEND glfw_LIBRARIES "${X11_Xcursor_LIB}") + list(APPEND glfw_PKG_DEPS "xcursor") + +endif() + +#-------------------------------------------------------------------- +# Use Wayland for window creation +#-------------------------------------------------------------------- +if (_GLFW_WAYLAND) + find_package(Wayland REQUIRED) + list(APPEND glfw_PKG_DEPS "wayland-egl") + + list(APPEND glfw_INCLUDE_DIRS "${WAYLAND_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${WAYLAND_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") + + find_package(XKBCommon REQUIRED) + list(APPEND glfw_PKG_DEPS "xkbcommon") + list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") + list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}") + + find_library(MATH_LIBRARY m) + mark_as_advanced(MATH_LIBRARY) + if (MATH_LIBRARY) + list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") + list(APPEND glfw_PKG_LIBS "-lm") + endif() +endif() + +#-------------------------------------------------------------------- +# Use Mir for window creation +#-------------------------------------------------------------------- +if (_GLFW_MIR) + find_package(Mir REQUIRED) + list(APPEND glfw_PKG_DEPS "mirclient") + + list(APPEND glfw_INCLUDE_DIRS "${MIR_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${MIR_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") + + find_package(XKBCommon REQUIRED) + list(APPEND glfw_PKG_DEPS "xkbcommon") + list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") + list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}") + + find_library(MATH_LIBRARY m) + mark_as_advanced(MATH_LIBRARY) + if (MATH_LIBRARY) + list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") + list(APPEND glfw_PKG_LIBS "-lm") + endif() endif() #-------------------------------------------------------------------- @@ -266,14 +385,14 @@ endif() #-------------------------------------------------------------------- if (_GLFW_GLX) - list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) + list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl") + list(APPEND glfw_PKG_DEPS "gl") include(CheckFunctionExists) - set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY}) + set(CMAKE_REQUIRED_LIBRARIES "${OPENGL_gl_LIBRARY}") check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS) check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB) check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT) @@ -285,15 +404,15 @@ if (_GLFW_GLX) # Check for dlopen support as a fallback - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) + set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_DL_LIBS}") check_function_exists(dlopen _GLFW_HAS_DLOPEN) if (NOT _GLFW_HAS_DLOPEN) message(FATAL_ERROR "No entry point retrieval mechanism found") endif() if (CMAKE_DL_LIBS) - list(APPEND glfw_LIBRARIES ${CMAKE_DL_LIBS}) - set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -l${CMAKE_DL_LIBS}") + list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}") + list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}") endif() endif() @@ -304,25 +423,23 @@ endif() #-------------------------------------------------------------------- if (_GLFW_EGL) - list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) - list(APPEND glfw_LIBRARIES ${EGL_LIBRARY}) + list(APPEND glfw_INCLUDE_DIRS "${EGL_INCLUDE_DIR}") + list(APPEND glfw_LIBRARIES "${EGL_LIBRARY}") - if (UNIX) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl") - endif() + 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}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl") + 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}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv1_cm") + 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}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv2") + list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}") + list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}") + list(APPEND glfw_PKG_DEPS "glesv2") endif() endif() @@ -331,7 +448,7 @@ endif() # Use Cocoa for window creation and NSOpenGL for context creation #-------------------------------------------------------------------- if (_GLFW_COCOA AND _GLFW_NSGL) - + if (GLFW_USE_MENUBAR) set(_GLFW_USE_MENUBAR 1) endif() @@ -340,32 +457,46 @@ if (_GLFW_COCOA AND _GLFW_NSGL) set(_GLFW_USE_CHDIR 1) endif() + if (GLFW_USE_RETINA) + 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) - list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK} - ${OPENGL_gl_LIBRARY} - ${IOKIT_FRAMEWORK} - ${CORE_FOUNDATION_FRAMEWORK} - ${CORE_VIDEO_FRAMEWORK}) + mark_as_advanced(COCOA_FRAMEWORK + IOKIT_FRAMEWORK + CORE_FOUNDATION_FRAMEWORK + CORE_VIDEO_FRAMEWORK) + list(APPEND glfw_LIBRARIES "${COCOA_FRAMEWORK}" + "${OPENGL_gl_LIBRARY}" + "${IOKIT_FRAMEWORK}" + "${CORE_FOUNDATION_FRAMEWORK}" + "${CORE_VIDEO_FRAMEWORK}") - set(GLFW_PKG_DEPS "") - set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo") + set(glfw_PKG_DEPS "") + set(glfw_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo") endif() #-------------------------------------------------------------------- # Export GLFW library dependencies #-------------------------------------------------------------------- set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW") +foreach(arg ${glfw_PKG_DEPS}) + set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}") +endforeach() +foreach(arg ${glfw_PKG_LIBS}) + set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}") +endforeach() #-------------------------------------------------------------------- # Choose library output name @@ -380,23 +511,35 @@ endif() #-------------------------------------------------------------------- # Create generated files #-------------------------------------------------------------------- -configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in - ${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY) - -configure_file(${GLFW_SOURCE_DIR}/src/glfw_config.h.in - ${GLFW_BINARY_DIR}/src/glfw_config.h @ONLY) - -configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in - ${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY) - -configure_file(${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in - ${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake @ONLY) +include(CMakePackageConfigHelpers) if (UNIX) - configure_file(${GLFW_SOURCE_DIR}/src/glfw3.pc.in - ${GLFW_BINARY_DIR}/src/glfw3.pc @ONLY) + set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw3/") +else() + set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/") endif() +configure_package_config_file("${GLFW_SOURCE_DIR}/src/glfw3Config.cmake.in" + "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" + INSTALL_DESTINATION "${GLFW_CONFIG_PATH}" + PATH_VARS CMAKE_INSTALL_PREFIX + NO_CHECK_REQUIRED_COMPONENTS_MACRO) + +write_basic_package_version_file("${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" + VERSION ${GLFW_VERSION_FULL} + COMPATIBILITY SameMajorVersion) + +if (GLFW_BUILD_DOCS) + configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in" + "${GLFW_BINARY_DIR}/docs/Doxyfile" @ONLY) +endif() + +configure_file("${GLFW_SOURCE_DIR}/src/glfw_config.h.in" + "${GLFW_BINARY_DIR}/src/glfw_config.h" @ONLY) + +configure_file("${GLFW_SOURCE_DIR}/src/glfw3.pc.in" + "${GLFW_BINARY_DIR}/src/glfw3.pc" @ONLY) + #-------------------------------------------------------------------- # Add subdirectories #-------------------------------------------------------------------- @@ -419,27 +562,25 @@ endif() # The library is installed by src/CMakeLists.txt #-------------------------------------------------------------------- if (GLFW_INSTALL) - install(DIRECTORY include/GLFW DESTINATION include + install(DIRECTORY include/GLFW DESTINATION include FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) - install(FILES ${GLFW_BINARY_DIR}/src/glfwConfig.cmake - ${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake + install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" + "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake" DESTINATION lib${LIB_SUFFIX}/cmake/glfw) - if (UNIX) - install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw) - install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc - DESTINATION lib${LIB_SUFFIX}/pkgconfig) - endif() + install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw) + install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" + DESTINATION lib${LIB_SUFFIX}/pkgconfig) # Only generate this target if no higher-level project already has if (NOT TARGET uninstall) - configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in - ${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) + configure_file("${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${GLFW_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall - ${CMAKE_COMMAND} -P - ${GLFW_BINARY_DIR}/cmake_uninstall.cmake) + "${CMAKE_COMMAND}" -P + "${GLFW_BINARY_DIR}/cmake_uninstall.cmake") endif() endif() diff --git a/extern/glfw/README.md b/extern/glfw/README.md index 830d494..91b3ae5 100644 --- a/extern/glfw/README.md +++ b/extern/glfw/README.md @@ -2,13 +2,14 @@ ## Introduction -GLFW is a free, Open Source, portable library for OpenGL and OpenGL ES +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.0.4 adds better support for custom build environments and fixes for -a large number of bugs that together affect all supported platforms. As this is -a patch release, there are no API changes. +Version 3.1 adds improved documentation, support for custom system cursors, file +drop events, main thread wake-up, window frame size retrieval, floating windows, +character input with modifier keys, single buffered windows, build improvements +and fixes for a large number of bugs. If you are new to GLFW, you may find the [introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW @@ -16,6 +17,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 @@ -30,58 +34,141 @@ See the guide in the GLFW documentation. +## Reporting bugs + +Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues). +Please always include the name and version of the OS where the bug occurs and +the version of GLFW used. If you have cloned it, include the commit ID used. + +If it's a build issue, please also include the build log and the name and +version of your development environment. + +If it's a context creation issue, please also include the make and model of your +graphics card and the version of your driver. + +This will help both us and other people experiencing the same bug. + + +## Dependencies + +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 + examples + - An OpenGL 3.2 core loader generated by + [glad](https://github.com/Dav1dde/glad) for examples using modern OpenGL + + ## Changelog - - Added the `GLFW_BUILD_DOCS` CMake option for controlling whether the - documentation is built - - Added the `_GLFW_USE_CONFIG_H` configuration macro for controlling whether to - include the configuration header - - Moved version number macro to `internal.h` for easier manual compilation - - Renamed configuration header to `glfw_config.h` to avoid conflicts - - Bugfix: The `glfw3.pc` file did not respect the `LIB_SUFFIX` CMake option - - Bugfix: The `joysticks` test would segfault if a controller had no axes - - [Win32] Allowed swap interval to be explicitly set to zero on DWM systems - - [Win32] Bugfix: Removed joystick axis value negation left over from GLFW 2 - - [Win32] Bugfix: Restoring windows using the Win+D hot key did not trigger the - focus callback - - [Win32] Bugfix: The disabled cursor mode clip rectangle was updated for - unfocused windows - - [Win32] Bugfix: Cursor was not properly re-centered over odd-sized windows - - [Win32] Bugfix: Negative window positions were reported incorrectly - - [Win32] Bugfix: The iconify callback was not triggered when switching away - from a full screen window using Alt+Tab - - [Win32] Bugfix: Resizing a window with `glfwSetWindowSize` gave it focus - - [Cocoa] Added dependency on CoreVideo framework for refresh rate retrieval - - [Cocoa] Enabled Lion full screen for resizable windowed mode windows - - [Cocoa] Moved to Cocoa API for application transformation and activation - - [Cocoa] Bugfix: The `GLFW_KEY_GRAVE_ACCENT` key was reported as - `GLFW_KEY_WORLD_1` and vice versa - - [Cocoa] Bugfix: The `GLFW_KEY_F13` key was reported as - `GLFW_KEY_PRINT_SCREEN` - - [Cocoa] Bugfix: Implicit conversion from `NSUInteger` to int caused warnings - with Xcode 5 - - [Cocoa] Bugfix: Use of undeclared selectors with `@selector` caused warnings - with Xcode 5 - - [Cocoa] Bugfix: The cursor remained visible if moved onto client area after - having been set to hidden outside it - - [Cocoa] Bugfix: The refresh rate was zero for all modes of certain monitors - - [Cocoa] Bugfix: The `install_name` field of the dynamic library was not set - - [Cocoa] Bugfix: Full screen windows were never reported as having focus - - [Cocoa] Bugfix: A superfluous I/O flag test prevented video modes from being - listed for Thunderbolt monitor - - [Cocoa] Bugfix: Retrieving the name of some external displays caused segfault - - [Cocoa] Bugfix: The 10.9 SDK defines `GLintptrARB` and `GLsizeiptrARB` - differently from the Khronos `glext.h` - - [Cocoa] Bugfix: Creating hidden windows would steal application focus - - [Cocoa] Bugfix: Controllers were reported as having zero buttons and axes - - [Cocoa] Bugfix: Removed joystick axis value negation left over from GLFW 2 - - [X11] Added setting of the `WM_CLASS` property to the initial window title - - [X11] Added support for `_NET_WM_BYPASS_COMPOSITOR` - - [X11] Bugfix: Removed joystick axis value negation left over from GLFW 2 - - [X11] Bugfix: The position of hidden windows was ignored by Metacity - and Compiz - - [X11] Bugfix: The `pthread.h` header was not included by the GLX platform - header. + - Added `GLFWcursor` custom system cursor handle + - Added `glfwCreateCursor`, `glfwCreateStandardCursor`, `glfwDestroyCursor` and + `glfwSetCursor` for managing system cursor images + - Added `GLFWimage` struct for passing 32-bit RGBA images + - Added monitor and adapter identifier access to native API + - Added `glfwSetDropCallback` and `GLFWdropfun` for receiving dropped files + - Added `glfwPostEmptyEvent` for allowing secondary threads to cause + `glfwWaitEvents` to return + - Added `empty` test program for verifying posting of empty events + - Added `glfwSetCharModsCallback` for receiving character events with modifiers + - Added `glfwGetWindowFrameSize` for retrieving the size of the frame around + the client area of a window + - Added `GLFW_AUTO_ICONIFY` for controlling whether full screen windows + automatically iconify (and restore the previous video mode) on focus loss + - Added `GLFW_DONT_CARE` for indicating that any value is acceptable + - Added `GLFW_DOUBLEBUFFER` for controlling whether to use double buffering + - Added `GLFW_CONTEXT_RELEASE_BEHAVIOR` and values + `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` and + `GLFW_RELEASE_BEHAVIOR_NONE` for `GL_KHR_context_flush_control` support + - Added `GLFW_INCLUDE_ES31` for including the OpenGL ES 3.1 header + - Added `GLFW_FLOATING` for creating always-on-top windowed mode windows + - Added `GLFW_FOCUSED` window hint for controlling initial input focus + - Added *partial and experimental* support for Wayland + - Added *partial and experimental* support for Mir + - Changed the window state attributes (focused, iconified and visible) to query + the system directly + - Changed the default of `GLFW_REFRESH_RATE` to `GLFW_DONT_CARE` to maintain + the default behavior + - Changed static library to build as position independent code for easier use + from the Rust language + - Changed `glfwGetCursorPos` to query the system directly for all cursor modes + except captured mode + - Bugfix: The debug context attribute was set from `GL_ARB_debug_output` even + when a debug context had not been requested + - Bugfix: The particles example was not linked against the threading library + - Bugfix: The cursor was not positioned over newly created full screen windows + - Bugfix: The queried cursor position was not always up-to-date + - Bugfix: `glfwExtensionSupported` always failed for OpenGL ES 3.0 and later if + the library was compiled for OpenGL ES + - [Cocoa] Added `_GLFW_USE_RETINA` to control whether windows will use the full + resolution on Retina displays + - [Cocoa] Made content view subclass of `NSOpenGLView` + - [Cocoa] Bugfix: Using a 1x1 cursor for hidden mode caused some screen + recorders to fail + - [Cocoa] Bugfix: Some Core Foundation objects were leaked during joystick + enumeration and termination + - [Cocoa] Bugfix: One copy of each display name string was leaked + - [Cocoa] Bugfix: Monitor enumeration caused a segfault if no `NSScreen` was + found for a given `CGDisplay` + - [Cocoa] Bugfix: Modifier key events were lost if the corresponding modifier + bit field was unchanged + - [Cocoa] Bugfix: Joystick enumeration took hundreds of ms on some systems + - [Cocoa] Bugfix: The cursor was hidden when the user resized a GLFW window + - [Cocoa] Bugfix: The 10.10 Yosemite OpenGL 4.1 profile token was not used + - [Cocoa] Bugfix: The generic software OpenGL renderer could be selected under + certain conditions + - [Cocoa] Bugfix: The virtual cursor jumped unpredictably when entering + disabled cursor mode + - [Win32] Enabled generation of pkg-config file for MinGW + - [Win32] Removed option to require explicitly linking against `winmm.dll` + - [Win32] Bugfix: Failure to load winmm or its functions was not reported to + the error callback + - [Win32] Bugfix: Some keys were reported based on the current layout instead + of their physical location + - [Win32] Bugfix: Maximized hidden windows were restored by `glfwShowWindow` + - [Win32] Bugfix: Context re-creation was not triggered by sRGB hint + - [Win32] Bugfix: Full screen windows were incorrectly sized and placed on some + systems + - [Win32] Bugfix: Gamma ramp functions acted on entire desktop instead of the + specified monitor + - [Win32] Bugfix: The wrong incorrect physical size was returned for + non-primary monitors + - [Win32] Bugfix: X-axis scroll offsets were inverted + - [Win32] Bugfix: The Optimus HPG forcing variable was not correctly exported + - [Win32] Bugfix: The iconified window state attribute was not always updated + - [Win32] Bugfix: Previously focused windows with disabled cursor mode and that + had been iconified by Win+D were not visible when restored + - [Win32] Bugfix: The virtual cursor jumped unpredictably when entering + disabled cursor mode + - [X11] Added run-time support for systems lacking the XKB extension + - [X11] Made GLX 1.3 the minimum supported version + - [X11] Replaced `XRRGetScreenResources` with `XRRGetScreenResourcesCurrent` + for monitor property retrieval + - [X11] Bugfix: The case of finding no usable CRTCs was not detected + - [X11] Bugfix: Detection of broken Nvidia RandR gamma support did not verify + that at least one CRTC was present + - [X11] Bugfix: A stale `_NET_SUPPORTING_WM_CHECK` root window property would + cause an uncaught `BadWindow` error + - [X11] Bugfix: No check was made for the presence of GLX 1.3 when + `GLX_SGIX_fbconfig` was unavailable + - [X11] Bugfix: The message type of ICCCM protocol events was not checked + - [X11] Bugfix: `glfwDestroyWindow` did not flush the output buffer + - [X11] Bugfix: Window frame interactions were reported as focus events + - [X11] Bugfix: Workaround for legacy Compiz caused flickering during resize + - [X11] Bugfix: The name pointer of joysticks were not cleared on disconnection + - [X11] Bugfix: Video mode resolutions and monitor physical sizes were not + corrected for rotated CRTCs + - [X11] Bugfix: Unicode character input ignored dead keys + - [X11] Bugfix: X-axis scroll offsets were inverted + - [X11] Bugfix: Full screen override redirect windows were not always + positioned over the specified monitor + - [X11] Bugfix: Character input did not work for the default `"C"` locale + - [X11] Bugfix: Joysticks connected after `glfwInit` were not detected + (temporary inotify solution until proper libudev solution) ## Contact @@ -119,23 +206,29 @@ skills. - Niklas Bergström - Doug Binks - blanco + - Martin Capitanio - Lambert Clara - Andrew Corrigan - Noel Cower - Jarrod Davis - Olivier Delannoy - Paul R. Deppe + - Michael Dickens - Jonathan Dummer - Ralph Eastwood - Michael Fogleman - Gerald Franz - GeO4d - Marcus Geelnard + - Eloi Marín Gratacós - Stefan Gustavson - Sylvain Hellegouarch + - Matthew Henry - heromyth + - Lucas Hinderberger - Paul Holden - Toni Jovanoski + - Arseny Kapoulkine - Osman Keskin - Cameron King - Peter Knut @@ -163,10 +256,12 @@ skills. - Peoro - Braden Pellett - Arturo J. Pérez + - Cyril Pichard - Pieroman - Jorge Rodriguez - Ed Ropple - Riku Salminen + - Brandon Schaefer - Sebastian Schuberth - Matt Sealey - SephiRok @@ -184,12 +279,15 @@ skills. - Samuli Tuomola - urraka - Jari Vetoniemi + - Ricardo Vieira - Simon Voordouw - Torsten Walluhn + - Patrick Walton - Jay Weisskopf - Frank Wille - yuriks - Santi Zupancic + - Jonas Ådahl - Lasse Öörni - All the unmentioned and anonymous contributors in the GLFW community, for bug reports, patches, feedback, testing and encouragement diff --git a/extern/glfw/cmake_install.cmake b/extern/glfw/cmake_install.cmake new file mode 100644 index 0000000..08a3964 --- /dev/null +++ b/extern/glfw/cmake_install.cmake @@ -0,0 +1,74 @@ +# Install script for directory: /home/fab/swp/swp/extern/glfw + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Release") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified") + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include" TYPE DIRECTORY FILES "/home/fab/swp/swp/extern/glfw/include/GLFW" FILES_MATCHING REGEX "/glfw3\\.h$" REGEX "/glfw3native\\.h$") +endif() + +if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified") + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw" TYPE FILE FILES + "/home/fab/swp/swp/extern/glfw/src/glfw3Config.cmake" + "/home/fab/swp/swp/extern/glfw/src/glfw3ConfigVersion.cmake" + ) +endif() + +if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified") + if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw/glfwTargets.cmake") + file(DIFFERENT EXPORT_FILE_CHANGED FILES + "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw/glfwTargets.cmake" + "/home/fab/swp/swp/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets.cmake") + if(EXPORT_FILE_CHANGED) + file(GLOB OLD_CONFIG_FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw/glfwTargets-*.cmake") + if(OLD_CONFIG_FILES) + message(STATUS "Old export file \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw/glfwTargets.cmake\" will be replaced. Removing files [${OLD_CONFIG_FILES}].") + file(REMOVE ${OLD_CONFIG_FILES}) + endif() + endif() + endif() + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw" TYPE FILE FILES "/home/fab/swp/swp/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets.cmake") + if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$") + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/glfw" TYPE FILE FILES "/home/fab/swp/swp/extern/glfw/CMakeFiles/Export/lib/cmake/glfw/glfwTargets-release.cmake") + endif() +endif() + +if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified") + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" TYPE FILE FILES "/home/fab/swp/swp/extern/glfw/src/glfw3.pc") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/home/fab/swp/swp/extern/glfw/src/cmake_install.cmake") + +endif() + diff --git a/extern/glfw/cmake_uninstall.cmake b/extern/glfw/cmake_uninstall.cmake new file mode 100644 index 0000000..01bbd87 --- /dev/null +++ b/extern/glfw/cmake_uninstall.cmake @@ -0,0 +1,29 @@ + +if (NOT EXISTS "/home/fab/swp/swp/extern/glfw/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"/home/fab/swp/swp/extern/glfw/install_manifest.txt\"") +endif() + +file(READ "/home/fab/swp/swp/extern/glfw/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") + +foreach (file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if (EXISTS "$ENV{DESTDIR}${file}") + exec_program("/usr/bin/cmake" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) + if (NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif() + elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") + EXEC_PROGRAM("/usr/bin/cmake" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) + if (NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") + endif() + else() + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif() +endforeach() + diff --git a/extern/glfw/deps/GL/glext.h b/extern/glfw/deps/GL/glext.h index 4edeae9..e619fa3 100644 --- a/extern/glfw/deps/GL/glext.h +++ b/extern/glfw/deps/GL/glext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013 The Khronos Group Inc. +** 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 @@ -33,7 +33,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 23695 $ on $Date: 2013-10-24 12:37:40 -0700 (Thu, 24 Oct 2013) $ +** 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__) @@ -53,7 +53,7 @@ extern "C" { #define GLAPI extern #endif -#define GL_GLEXT_VERSION 20131024 +#define GL_GLEXT_VERSION 20140810 /* Generated C header for: * API: gl @@ -1308,11 +1308,13 @@ GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 @@ -1331,6 +1333,7 @@ GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #define GL_INVALID_INDEX 0xFFFFFFFFu typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); @@ -1477,7 +1480,7 @@ typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); @@ -1485,7 +1488,7 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum atta typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); @@ -1497,7 +1500,7 @@ GLAPI GLboolean APIENTRY glIsSync (GLsync sync); GLAPI void APIENTRY glDeleteSync (GLsync sync); GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); @@ -1505,7 +1508,7 @@ GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLui GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); -GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask); +GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); #endif #endif /* GL_VERSION_3_2 */ @@ -2144,6 +2147,10 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) #define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD #define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE #define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F #define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); @@ -2208,6 +2215,7 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED #define GL_DISPATCH_INDIRECT_BUFFER 0x90EE #define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 @@ -2432,6 +2440,7 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum #define GL_VERTEX_BINDING_STRIDE 0x82D8 #define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 #define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_VERTEX_BINDING_BUFFER 0x8F4F #define GL_DISPLAY_LIST 0x82E7 typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); @@ -2566,10 +2575,279 @@ GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLui #endif #endif /* GL_VERSION_4_4 */ +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 +#define GL_CONTEXT_LOST 0x0507 +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA +#define GL_TEXTURE_BINDING 0x82EB +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); +typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizei size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizei size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizei size, const void *data); +typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizei length); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizei size, void *data); +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil); +typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); +typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNMAPDVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLGETNMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); +GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizei size); +GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); +GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizei size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizei size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizei size, const void *data); +GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizei size); +GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data); +GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); +GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizei length, GLbitfield access); +GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); +GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizei length); +GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizei size, void *data); +GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); +GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); +GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, const GLfloat depth, GLint stencil); +GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); +GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size); +GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); +GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); +GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); +GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); +GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); +GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); +GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); +GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); +GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); +GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnMapdv (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfv (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapiv (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfv (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuiv (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusv (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStipple (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTable (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI void APIENTRY glGetnConvolutionFilter (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI void APIENTRY glGetnSeparableFilter (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI void APIENTRY glGetnHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glGetnMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glTextureBarrier (void); +#endif +#endif /* GL_VERSION_4_5 */ + #ifndef GL_ARB_ES2_compatibility #define GL_ARB_ES2_compatibility 1 #endif /* GL_ARB_ES2_compatibility */ +#ifndef GL_ARB_ES3_1_compatibility +#define GL_ARB_ES3_1_compatibility 1 +#endif /* GL_ARB_ES3_1_compatibility */ + #ifndef GL_ARB_ES3_compatibility #define GL_ARB_ES3_compatibility 1 #endif /* GL_ARB_ES3_compatibility */ @@ -2650,6 +2928,10 @@ GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, s #define GL_ARB_clear_texture 1 #endif /* GL_ARB_clear_texture */ +#ifndef GL_ARB_clip_control +#define GL_ARB_clip_control 1 +#endif /* GL_ARB_clip_control */ + #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #define GL_RGBA_FLOAT_MODE_ARB 0x8820 @@ -2673,7 +2955,6 @@ GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); #ifndef GL_ARB_compute_shader #define GL_ARB_compute_shader 1 -#define GL_COMPUTE_SHADER_BIT 0x00000020 #endif /* GL_ARB_compute_shader */ #ifndef GL_ARB_compute_variable_group_size @@ -2688,6 +2969,10 @@ GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint n #endif #endif /* GL_ARB_compute_variable_group_size */ +#ifndef GL_ARB_conditional_render_inverted +#define GL_ARB_conditional_render_inverted 1 +#endif /* GL_ARB_conditional_render_inverted */ + #ifndef GL_ARB_conservative_depth #define GL_ARB_conservative_depth 1 #endif /* GL_ARB_conservative_depth */ @@ -2702,6 +2987,10 @@ GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint n #define GL_ARB_copy_image 1 #endif /* GL_ARB_copy_image */ +#ifndef GL_ARB_cull_distance +#define GL_ARB_cull_distance 1 +#endif /* GL_ARB_cull_distance */ + #ifndef GL_ARB_debug_output #define GL_ARB_debug_output 1 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); @@ -2756,6 +3045,14 @@ GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GL #define GL_DEPTH_TEXTURE_MODE_ARB 0x884B #endif /* GL_ARB_depth_texture */ +#ifndef GL_ARB_derivative_control +#define GL_ARB_derivative_control 1 +#endif /* GL_ARB_derivative_control */ + +#ifndef GL_ARB_direct_state_access +#define GL_ARB_direct_state_access 1 +#endif /* GL_ARB_direct_state_access */ + #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers 1 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 @@ -3014,6 +3311,10 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen #define GL_ARB_get_program_binary 1 #endif /* GL_ARB_get_program_binary */ +#ifndef GL_ARB_get_texture_sub_image +#define GL_ARB_get_texture_sub_image 1 +#endif /* GL_ARB_get_texture_sub_image */ + #ifndef GL_ARB_gpu_shader5 #define GL_ARB_gpu_shader5 1 #endif /* GL_ARB_gpu_shader5 */ @@ -3401,6 +3702,20 @@ GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *par #define GL_ARB_occlusion_query2 1 #endif /* GL_ARB_occlusion_query2 */ +#ifndef GL_ARB_pipeline_statistics_query +#define GL_ARB_pipeline_statistics_query 1 +#define GL_VERTICES_SUBMITTED_ARB 0x82EE +#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 +#endif /* GL_ARB_pipeline_statistics_query */ + #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object 1 #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB @@ -3692,6 +4007,10 @@ GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GL #define GL_ARB_shader_subroutine 1 #endif /* GL_ARB_shader_subroutine */ +#ifndef GL_ARB_shader_texture_image_samples +#define GL_ARB_shader_texture_image_samples 1 +#endif /* GL_ARB_shader_texture_image_samples */ + #ifndef GL_ARB_shader_texture_lod #define GL_ARB_shader_texture_lod 1 #endif /* GL_ARB_shader_texture_lod */ @@ -3742,6 +4061,20 @@ GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GL #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #endif /* GL_ARB_shadow_ambient */ +#ifndef GL_ARB_sparse_buffer +#define GL_ARB_sparse_buffer 1 +#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 +#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizei size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizei size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizei size, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_buffer */ + #ifndef GL_ARB_sparse_texture #define GL_ARB_sparse_texture 1 #define GL_TEXTURE_SPARSE_ARB 0x91A6 @@ -3773,6 +4106,10 @@ GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xo #define GL_ARB_tessellation_shader 1 #endif /* GL_ARB_tessellation_shader */ +#ifndef GL_ARB_texture_barrier +#define GL_ARB_texture_barrier 1 +#endif /* GL_ARB_texture_barrier */ + #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp 1 #define GL_CLAMP_TO_BORDER_ARB 0x812D @@ -4019,6 +4356,12 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #define GL_ARB_transform_feedback_instanced 1 #endif /* GL_ARB_transform_feedback_instanced */ +#ifndef GL_ARB_transform_feedback_overflow_query +#define GL_ARB_transform_feedback_overflow_query 1 +#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED +#endif /* GL_ARB_transform_feedback_overflow_query */ + #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 @@ -4039,9 +4382,6 @@ GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object 1 -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #endif /* GL_ARB_uniform_buffer_object */ #ifndef GL_ARB_vertex_array_bgra @@ -4374,10 +4714,51 @@ GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); #endif #endif /* GL_ARB_window_pos */ +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#endif /* GL_KHR_context_flush_control */ + #ifndef GL_KHR_debug #define GL_KHR_debug 1 #endif /* GL_KHR_debug */ +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 +#endif /* GL_KHR_robustness */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -4432,11 +4813,11 @@ typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords); typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x); +typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x, GLbyte y); typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y); +typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y, GLbyte z); typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z, GLbyte w); typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s); @@ -4455,11 +4836,11 @@ GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r); GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords); GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q); GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex2bOES (GLbyte x); +GLAPI void APIENTRY glVertex2bOES (GLbyte x, GLbyte y); GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y); +GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y, GLbyte z); GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z, GLbyte w); GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); #endif #endif /* GL_OES_byte_coordinates */ @@ -4807,6 +5188,113 @@ GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRG #endif #endif /* GL_AMD_draw_buffers_blend */ +#ifndef GL_AMD_gcn_shader +#define GL_AMD_gcn_shader 1 +#endif /* GL_AMD_gcn_shader */ + +#ifndef GL_AMD_gpu_shader_int64 +#define GL_AMD_gpu_shader_int64 1 +typedef int64_t GLint64EXT; +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); +GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_AMD_gpu_shader_int64 */ + #ifndef GL_AMD_interleaved_elements #define GL_AMD_interleaved_elements 1 #define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4 @@ -4844,6 +5332,20 @@ GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); #endif #endif /* GL_AMD_name_gen_delete */ +#ifndef GL_AMD_occlusion_query_event +#define GL_AMD_occlusion_query_event 1 +#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F +#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001 +#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002 +#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004 +#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008 +#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF +typedef void (APIENTRYP PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glQueryObjectParameteruiAMD (GLenum target, GLuint id, GLenum pname, GLuint param); +#endif +#endif /* GL_AMD_occlusion_query_event */ + #ifndef GL_AMD_performance_monitor #define GL_AMD_performance_monitor 1 #define GL_COUNTER_TYPE_AMD 0x8BC0 @@ -4955,6 +5457,11 @@ GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value); #define GL_AMD_transform_feedback3_lines_triangles 1 #endif /* GL_AMD_transform_feedback3_lines_triangles */ +#ifndef GL_AMD_transform_feedback4 +#define GL_AMD_transform_feedback4 1 +#define GL_STREAM_RASTERIZATION_AMD 0x91A0 +#endif /* GL_AMD_transform_feedback4 */ + #ifndef GL_AMD_vertex_shader_layer #define GL_AMD_vertex_shader_layer 1 #endif /* GL_AMD_vertex_shader_layer */ @@ -5908,6 +6415,34 @@ GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params); #endif #endif /* GL_EXT_cull_vertex */ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_EXT_debug_label */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GLAPI void APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif /* GL_EXT_debug_marker */ + #ifndef GL_EXT_depth_bounds_test #define GL_EXT_depth_bounds_test 1 #define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 @@ -6143,7 +6678,7 @@ typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintp typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); @@ -6399,7 +6934,7 @@ GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, G GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); -GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); @@ -7042,6 +7577,10 @@ GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *strin #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA #endif /* GL_EXT_separate_specular_color */ +#ifndef GL_EXT_shader_image_load_formatted +#define GL_EXT_shader_image_load_formatted 1 +#endif /* GL_EXT_shader_image_load_formatted */ + #ifndef GL_EXT_shader_image_load_store #define GL_EXT_shader_image_load_store 1 #define GL_MAX_IMAGE_UNITS_EXT 0x8F38 @@ -7232,6 +7771,10 @@ GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffse #define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D #define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF #define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif #endif /* GL_EXT_texture_array */ #ifndef GL_EXT_texture_buffer_object @@ -8049,6 +8592,10 @@ GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRG #define GL_INTERLACE_READ_INGR 0x8568 #endif /* GL_INGR_interlace_read */ +#ifndef GL_INTEL_fragment_shader_ordering +#define GL_INTEL_fragment_shader_ordering 1 +#endif /* GL_INTEL_fragment_shader_ordering */ + #ifndef GL_INTEL_map_texture #define GL_INTEL_map_texture 1 #define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF @@ -8084,6 +8631,52 @@ GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void #endif #endif /* GL_INTEL_parallel_arrays */ +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + #ifndef GL_MESAX_texture_stack #define GL_MESAX_texture_stack 1 #define GL_TEXTURE_1D_STACK_MESAX 0x8759 @@ -8178,6 +8771,15 @@ GLAPI void APIENTRY glEndConditionalRenderNVX (void); #endif #endif /* GL_NVX_conditional_render */ +#ifndef GL_NVX_gpu_memory_info +#define GL_NVX_gpu_memory_info 1 +#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 +#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 +#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 +#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A +#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B +#endif /* GL_NVX_gpu_memory_info */ + #ifndef GL_NV_bindless_multi_draw_indirect #define GL_NV_bindless_multi_draw_indirect 1 typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); @@ -8188,6 +8790,16 @@ GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum t #endif #endif /* GL_NV_bindless_multi_draw_indirect */ +#ifndef GL_NV_bindless_multi_draw_indirect_count +#define GL_NV_bindless_multi_draw_indirect_count 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#endif +#endif /* GL_NV_bindless_multi_draw_indirect_count */ + #ifndef GL_NV_bindless_texture #define GL_NV_bindless_texture 1 typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); @@ -8224,6 +8836,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); #define GL_NV_blend_equation_advanced 1 #define GL_BLEND_OVERLAP_NV 0x9281 #define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 #define GL_COLORBURN_NV 0x929A #define GL_COLORDODGE_NV 0x9299 #define GL_CONJOINT_NV 0x9284 @@ -8237,6 +8850,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); #define GL_DST_OUT_NV 0x928D #define GL_DST_OVER_NV 0x9289 #define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 #define GL_HARDLIGHT_NV 0x929B #define GL_HARDMIX_NV 0x92A9 #define GL_HSL_COLOR_NV 0x92AF @@ -8258,6 +8872,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); #define GL_PLUS_CLAMPED_NV 0x92B1 #define GL_PLUS_DARKER_NV 0x9292 #define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 #define GL_SCREEN_NV 0x9295 #define GL_SOFTLIGHT_NV 0x929C #define GL_SRC_ATOP_NV 0x928E @@ -8267,6 +8882,7 @@ GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); #define GL_SRC_OVER_NV 0x9288 #define GL_UNCORRELATED_NV 0x9282 #define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); #ifdef GL_GLEXT_PROTOTYPES @@ -8532,12 +9148,10 @@ GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, G #define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); #endif #endif /* GL_NV_geometry_program4 */ @@ -8616,103 +9230,6 @@ GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint #ifndef GL_NV_gpu_shader5 #define GL_NV_gpu_shader5 1 -typedef int64_t GLint64EXT; -#define GL_INT64_NV 0x140E -#define GL_UNSIGNED_INT64_NV 0x140F -#define GL_INT8_NV 0x8FE0 -#define GL_INT8_VEC2_NV 0x8FE1 -#define GL_INT8_VEC3_NV 0x8FE2 -#define GL_INT8_VEC4_NV 0x8FE3 -#define GL_INT16_NV 0x8FE4 -#define GL_INT16_VEC2_NV 0x8FE5 -#define GL_INT16_VEC3_NV 0x8FE6 -#define GL_INT16_VEC4_NV 0x8FE7 -#define GL_INT64_VEC2_NV 0x8FE9 -#define GL_INT64_VEC3_NV 0x8FEA -#define GL_INT64_VEC4_NV 0x8FEB -#define GL_UNSIGNED_INT8_NV 0x8FEC -#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED -#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE -#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF -#define GL_UNSIGNED_INT16_NV 0x8FF0 -#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 -#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 -#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 -#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB -typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); -typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); -typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); -GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); -GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); -GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); -GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); -GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); -GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); -GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); -GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); -GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); -GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); -GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); -GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); -#endif #endif /* GL_NV_gpu_shader5 */ #ifndef GL_NV_half_float @@ -9013,6 +9530,40 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_2_BYTES_NV 0x1407 +#define GL_3_BYTES_NV 0x1408 +#define GL_4_BYTES_NV 0x1409 +#define GL_EYE_LINEAR_NV 0x2400 +#define GL_OBJECT_LINEAR_NV 0x2401 +#define GL_CONSTANT_NV 0x8576 +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); @@ -9062,6 +9613,21 @@ typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); @@ -9112,6 +9678,21 @@ GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloa GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); #endif #endif /* GL_NV_path_rendering */ @@ -9280,6 +9861,10 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #define GL_NV_shader_atomic_float 1 #endif /* GL_NV_shader_atomic_float */ +#ifndef GL_NV_shader_atomic_int64 +#define GL_NV_shader_atomic_int64 1 +#endif /* GL_NV_shader_atomic_int64 */ + #ifndef GL_NV_shader_buffer_load #define GL_NV_shader_buffer_load 1 #define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D @@ -9296,7 +9881,6 @@ typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result); typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); -typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); #ifdef GL_GLEXT_PROTOTYPES @@ -9311,7 +9895,6 @@ GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pnam GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result); GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value); GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); -GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value); GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); #endif @@ -9326,6 +9909,17 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs #define GL_NV_shader_storage_buffer_object 1 #endif /* GL_NV_shader_storage_buffer_object */ +#ifndef GL_NV_shader_thread_group +#define GL_NV_shader_thread_group 1 +#define GL_WARP_SIZE_NV 0x9339 +#define GL_WARPS_PER_SM_NV 0x933A +#define GL_SM_COUNT_NV 0x933B +#endif /* GL_NV_shader_thread_group */ + +#ifndef GL_NV_shader_thread_shuffle +#define GL_NV_shader_thread_shuffle 1 +#endif /* GL_NV_shader_thread_shuffle */ + #ifndef GL_NV_tessellation_program5 #define GL_NV_tessellation_program5 1 #define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 @@ -9540,7 +10134,7 @@ GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenu #define GL_SKIP_COMPONENTS1_NV -6 typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLenum bufferMode); typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); @@ -9553,7 +10147,7 @@ typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei coun #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); GLAPI void APIENTRY glEndTransformFeedbackNV (void); -GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLsizei count, const GLint *attribs, GLenum bufferMode); GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); @@ -9601,7 +10195,7 @@ typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); @@ -9612,7 +10206,7 @@ GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAdd GLAPI void APIENTRY glVDPAUFiniNV (void); GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); -GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); diff --git a/extern/glfw/deps/GL/glxext.h b/extern/glfw/deps/GL/glxext.h index 40aa2c3..174fc21 100644 --- a/extern/glfw/deps/GL/glxext.h +++ b/extern/glfw/deps/GL/glxext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013 The Khronos Group Inc. +** 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 @@ -33,10 +33,10 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 23649 $ on $Date: 2013-10-23 00:21:49 -0700 (Wed, 23 Oct 2013) $ +** Khronos $Revision: 27684 $ on $Date: 2014-08-11 01:21:35 -0700 (Mon, 11 Aug 2014) $ */ -#define GLX_GLXEXT_VERSION 20131008 +#define GLX_GLXEXT_VERSION 20140810 /* Generated C header for: * API: glx @@ -49,6 +49,7 @@ extern "C" { #ifndef GLX_VERSION_1_3 #define GLX_VERSION_1_3 1 +typedef XID GLXContextID; typedef struct __GLXFBConfigRec *GLXFBConfig; typedef XID GLXWindow; typedef XID GLXPbuffer; @@ -157,6 +158,13 @@ __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 @@ -272,7 +280,6 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); #ifndef GLX_EXT_import_context #define GLX_EXT_import_context 1 -typedef XID GLXContextID; #define GLX_SHARE_CONTEXT_EXT 0x800A #define GLX_VISUAL_ID_EXT 0x800B #define GLX_SCREEN_EXT 0x800C @@ -290,6 +297,23 @@ 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 @@ -407,6 +431,32 @@ GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixm #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); @@ -425,6 +475,16 @@ 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); @@ -433,6 +493,14 @@ void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLe #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 @@ -493,8 +561,8 @@ void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV devic #endif #endif /* GLX_NV_video_capture */ -#ifndef GLX_NV_video_output -#define GLX_NV_video_output 1 +#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 @@ -520,7 +588,7 @@ 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_output */ +#endif /* GLX_NV_video_out */ #ifndef GLX_OML_swap_method #define GLX_OML_swap_method 1 diff --git a/extern/glfw/deps/GL/wglext.h b/extern/glfw/deps/GL/wglext.h index dc73a01..daba410 100644 --- a/extern/glfw/deps/GL/wglext.h +++ b/extern/glfw/deps/GL/wglext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013 The Khronos Group Inc. +** 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 @@ -33,7 +33,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 23649 $ on $Date: 2013-10-23 00:21:49 -0700 (Wed, 23 Oct 2013) $ +** 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__) @@ -41,7 +41,7 @@ extern "C" { #include #endif -#define WGL_WGLEXT_VERSION 20130916 +#define WGL_WGLEXT_VERSION 20140810 /* Generated C header for: * API: wgl @@ -70,6 +70,13 @@ BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, #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 diff --git a/extern/glfw/deps/KHR/khrplatform.h b/extern/glfw/deps/KHR/khrplatform.h new file mode 100644 index 0000000..c9e6f17 --- /dev/null +++ b/extern/glfw/deps/KHR/khrplatform.h @@ -0,0 +1,282 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 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. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/extern/glfw/deps/getopt.c b/extern/glfw/deps/getopt.c index 7b3decd..9743046 100644 --- a/extern/glfw/deps/getopt.c +++ b/extern/glfw/deps/getopt.c @@ -1,267 +1,230 @@ -/***************************************************************************** -* getopt.c - competent and free getopt library. -* $Header: /cvsroot/freegetopt/freegetopt/getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $ -* -* Copyright (c)2002-2003 Mark K. Kim -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* -* * Neither the original author of this software nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -* DAMAGE. -*/ -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif +/* Copyright (c) 2012, Kim Gräsman + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Kim Gräsman nor the names of contributors may be used + * to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -#include -#include -#include #include "getopt.h" -/* 2013-01-06 Camilla Berglund - * - * Only define _CRT_SECURE_NO_WARNINGS if not already defined. - */ -/* 2012-08-12 Lambert Clara - * - * Constify third argument of getopt. - */ -/* 2011-07-27 Camilla Berglund - * - * Added _CRT_SECURE_NO_WARNINGS macro. - */ -/* 2009-10-12 Camilla Berglund - * - * Removed unused global static variable 'ID'. - */ +#include +#include -char* optarg = NULL; -int optind = 0; -int opterr = 1; -int optopt = '?'; +const int no_argument = 0; +const int required_argument = 1; +const int optional_argument = 2; +char* optarg; +int optopt; +/* The variable optind [...] shall be initialized to 1 by the system. */ +int optind = 1; +int opterr; -static char** prev_argv = NULL; /* Keep a copy of argv and argc to */ -static int prev_argc = 0; /* tell if getopt params change */ -static int argv_index = 0; /* Option we're checking */ -static int argv_index2 = 0; /* Option argument we're checking */ -static int opt_offset = 0; /* Index into compounded "-option" */ -static int dashdash = 0; /* True if "--" option reached */ -static int nonopt = 0; /* How many nonopts we've found */ +static char* optcursor = NULL; -static void increment_index() -{ - /* Move onto the next option */ - if(argv_index < argv_index2) - { - while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-' - && argv_index < argv_index2+1); - } - else argv_index++; - opt_offset = 1; -} +/* Implemented based on [1] and [2] for optional arguments. + optopt is handled FreeBSD-style, per [3]. + Other GNU and FreeBSD extensions are purely accidental. - -/* -* Permutes argv[] so that the argument currently being processed is moved -* to the end. +[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html +[2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html +[3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE */ -static int permute_argv_once() -{ - /* Movability check */ - if(argv_index + nonopt >= prev_argc) return 1; - /* Move the current option to the end, bring the others to front */ - else - { - char* tmp = prev_argv[argv_index]; +int getopt(int argc, char* const argv[], const char* optstring) { + int optchar = -1; + const char* optdecl = NULL; - /* Move the data */ - memmove(&prev_argv[argv_index], &prev_argv[argv_index+1], - sizeof(char**) * (prev_argc - argv_index - 1)); - prev_argv[prev_argc - 1] = tmp; + optarg = NULL; + opterr = 0; + optopt = 0; - nonopt++; - return 0; - } + /* Unspecified, but we need it to avoid overrunning the argv bounds. */ + if (optind >= argc) + goto no_more_optchars; + + /* If, when getopt() is called argv[optind] is a null pointer, getopt() + shall return -1 without changing optind. */ + if (argv[optind] == NULL) + goto no_more_optchars; + + /* If, when getopt() is called *argv[optind] is not the character '-', + getopt() shall return -1 without changing optind. */ + if (*argv[optind] != '-') + goto no_more_optchars; + + /* If, when getopt() is called argv[optind] points to the string "-", + getopt() shall return -1 without changing optind. */ + if (strcmp(argv[optind], "-") == 0) + goto no_more_optchars; + + /* If, when getopt() is called argv[optind] points to the string "--", + getopt() shall return -1 after incrementing optind. */ + if (strcmp(argv[optind], "--") == 0) { + ++optind; + goto no_more_optchars; + } + + if (optcursor == NULL || *optcursor == '\0') + optcursor = argv[optind] + 1; + + optchar = *optcursor; + + /* FreeBSD: The variable optopt saves the last known option character + returned by getopt(). */ + optopt = optchar; + + /* The getopt() function shall return the next option character (if one is + found) from argv that matches a character in optstring, if there is + one that matches. */ + optdecl = strchr(optstring, optchar); + if (optdecl) { + /* [I]f a character is followed by a colon, the option takes an + argument. */ + if (optdecl[1] == ':') { + optarg = ++optcursor; + if (*optarg == '\0') { + /* GNU extension: Two colons mean an option takes an + optional arg; if there is text in the current argv-element + (i.e., in the same word as the option name itself, for example, + "-oarg"), then it is returned in optarg, otherwise optarg is set + to zero. */ + if (optdecl[2] != ':') { + /* If the option was the last character in the string pointed to by + an element of argv, then optarg shall contain the next element + of argv, and optind shall be incremented by 2. If the resulting + value of optind is greater than argc, this indicates a missing + option-argument, and getopt() shall return an error indication. + + Otherwise, optarg shall point to the string following the + option character in that element of argv, and optind shall be + incremented by 1. + */ + if (++optind < argc) { + optarg = argv[optind]; + } else { + /* If it detects a missing option-argument, it shall return the + colon character ( ':' ) if the first character of optstring + was a colon, or a question-mark character ( '?' ) otherwise. + */ + optarg = NULL; + optchar = (optstring[0] == ':') ? ':' : '?'; + } + } else { + optarg = NULL; + } + } + + optcursor = NULL; + } + } else { + /* If getopt() encounters an option character that is not contained in + optstring, it shall return the question-mark ( '?' ) character. */ + optchar = '?'; + } + + if (optcursor == NULL || *++optcursor == '\0') + ++optind; + + return optchar; + +no_more_optchars: + optcursor = NULL; + return -1; } +/* Implementation based on [1]. -int getopt(int argc, char** argv, const char* optstr) -{ - int c = 0; - - /* If we have new argv, reinitialize */ - if(prev_argv != argv || prev_argc != argc) - { - /* Initialize variables */ - prev_argv = argv; - prev_argc = argc; - argv_index = 1; - argv_index2 = 1; - opt_offset = 1; - dashdash = 0; - nonopt = 0; - } - - /* Jump point in case we want to ignore the current argv_index */ - getopt_top: - - /* Misc. initializations */ - optarg = NULL; - - /* Dash-dash check */ - if(argv[argv_index] && !strcmp(argv[argv_index], "--")) - { - dashdash = 1; - increment_index(); - } - - /* If we're at the end of argv, that's it. */ - if(argv[argv_index] == NULL) - { - c = -1; - } - /* Are we looking at a string? Single dash is also a string */ - else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-")) - { - /* If we want a string... */ - if(optstr[0] == '-') - { - c = 1; - optarg = argv[argv_index]; - increment_index(); - } - /* If we really don't want it (we're in POSIX mode), we're done */ - else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT")) - { - c = -1; - - /* Everything else is a non-opt argument */ - nonopt = argc - argv_index; - } - /* If we mildly don't want it, then move it back */ - else - { - if(!permute_argv_once()) goto getopt_top; - else c = -1; - } - } - /* Otherwise we're looking at an option */ - else - { - char* opt_ptr = NULL; - - /* Grab the option */ - c = argv[argv_index][opt_offset++]; - - /* Is the option in the optstr? */ - if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c); - else opt_ptr = strchr(optstr, c); - /* Invalid argument */ - if(!opt_ptr) - { - if(opterr) - { - fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); - } - - optopt = c; - c = '?'; - - /* Move onto the next option */ - increment_index(); - } - /* Option takes argument */ - else if(opt_ptr[1] == ':') - { - /* ie, -oARGUMENT, -xxxoARGUMENT, etc. */ - if(argv[argv_index][opt_offset] != '\0') - { - optarg = &argv[argv_index][opt_offset]; - increment_index(); - } - /* ie, -o ARGUMENT (only if it's a required argument) */ - else if(opt_ptr[2] != ':') - { - /* One of those "you're not expected to understand this" moment */ - if(argv_index2 < argv_index) argv_index2 = argv_index; - while(argv[++argv_index2] && argv[argv_index2][0] == '-'); - optarg = argv[argv_index2]; - - /* Don't cross into the non-option argument list */ - if(argv_index2 + nonopt >= prev_argc) optarg = NULL; - - /* Move onto the next option */ - increment_index(); - } - else - { - /* Move onto the next option */ - increment_index(); - } - - /* In case we got no argument for an option with required argument */ - if(optarg == NULL && opt_ptr[2] != ':') - { - optopt = c; - c = '?'; - - if(opterr) - { - fprintf(stderr,"%s: option requires an argument -- %c\n", - argv[0], optopt); - } - } - } - /* Option does not take argument */ - else - { - /* Next argv_index */ - if(argv[argv_index][opt_offset] == '\0') - { - increment_index(); - } - } - } - - /* Calculate optind */ - if(c == -1) - { - optind = argc - nonopt; - } - else - { - optind = argv_index; - } - - return c; -} - - -/* vim:ts=3 +[1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html */ +int getopt_long(int argc, char* const argv[], const char* optstring, + const struct option* longopts, int* longindex) { + const struct option* o = longopts; + const struct option* match = NULL; + int num_matches = 0; + size_t argument_name_length = 0; + const char* current_argument = NULL; + int retval = -1; + + optarg = NULL; + optopt = 0; + + if (optind >= argc) + return -1; + + if (strlen(argv[optind]) < 3 || strncmp(argv[optind], "--", 2) != 0) + return getopt(argc, argv, optstring); + + /* It's an option; starts with -- and is longer than two chars. */ + current_argument = argv[optind] + 2; + argument_name_length = strcspn(current_argument, "="); + for (; o->name; ++o) { + if (strncmp(o->name, current_argument, argument_name_length) == 0) { + match = o; + ++num_matches; + } + } + + if (num_matches == 1) { + /* If longindex is not NULL, it points to a variable which is set to the + index of the long option relative to longopts. */ + if (longindex) + *longindex = (int) (match - longopts); + + /* If flag is NULL, then getopt_long() shall return val. + Otherwise, getopt_long() returns 0, and flag shall point to a variable + which shall be set to val if the option is found, but left unchanged if + the option is not found. */ + if (match->flag) + *(match->flag) = match->val; + + retval = match->flag ? 0 : match->val; + + if (match->has_arg != no_argument) { + optarg = strchr(argv[optind], '='); + if (optarg != NULL) + ++optarg; + + if (match->has_arg == required_argument) { + /* Only scan the next argv for required arguments. Behavior is not + specified, but has been observed with Ubuntu and Mac OSX. */ + if (optarg == NULL && ++optind < argc) { + optarg = argv[optind]; + } + + if (optarg == NULL) + retval = ':'; + } + } else if (strchr(argv[optind], '=')) { + /* An argument was provided to a non-argument option. + I haven't seen this specified explicitly, but both GNU and BSD-based + implementations show this behavior. + */ + retval = '?'; + } + } else { + /* Unknown option or ambiguous match. */ + retval = '?'; + } + + ++optind; + return retval; +} diff --git a/extern/glfw/deps/getopt.h b/extern/glfw/deps/getopt.h index 6d2e4af..e1eb540 100644 --- a/extern/glfw/deps/getopt.h +++ b/extern/glfw/deps/getopt.h @@ -1,63 +1,57 @@ -/***************************************************************************** -* getopt.h - competent and free getopt library. -* $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $ -* -* Copyright (c)2002-2003 Mark K. Kim -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* -* * Neither the original author of this software nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -* DAMAGE. -*/ -#ifndef GETOPT_H_ -#define GETOPT_H_ +/* Copyright (c) 2012, Kim Gräsman + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Kim Gräsman nor the names of contributors may be used + * to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef INCLUDED_GETOPT_PORT_H +#define INCLUDED_GETOPT_PORT_H -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif +extern const int no_argument; +extern const int required_argument; +extern const int optional_argument; extern char* optarg; -extern int optind; -extern int opterr; -extern int optopt; +extern int optind, opterr, optopt; -int getopt(int argc, char** argv, const char* optstr); +struct option { + const char* name; + int has_arg; + int* flag; + int val; +}; +int getopt(int argc, char* const argv[], const char* optstring); -#ifdef __cplusplus +int getopt_long(int argc, char* const argv[], + const char* optstring, const struct option* longopts, int* longindex); + +#if defined(__cplusplus) } #endif - -#endif /* GETOPT_H_ */ - - -/* vim:ts=3 -*/ +#endif // INCLUDED_GETOPT_PORT_H diff --git a/extern/glfw/deps/glad.c b/extern/glfw/deps/glad.c new file mode 100644 index 0000000..da75d08 --- /dev/null +++ b/extern/glfw/deps/glad.c @@ -0,0 +1,728 @@ +#include +#include + +struct gladGLversionStruct GLVersion; + +#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) +#define _GLAD_IS_SOME_NEW_VERSION 1 +#endif + +int GLAD_GL_VERSION_1_0; +int GLAD_GL_VERSION_1_1; +int GLAD_GL_VERSION_1_2; +int GLAD_GL_VERSION_1_3; +int GLAD_GL_VERSION_1_4; +int GLAD_GL_VERSION_1_5; +int GLAD_GL_VERSION_2_0; +int GLAD_GL_VERSION_2_1; +int GLAD_GL_VERSION_3_0; +int GLAD_GL_VERSION_3_1; +int GLAD_GL_VERSION_3_2; +PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; +PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; +PFNGLFLUSHPROC glad_glFlush; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +PFNGLCLEARCOLORPROC glad_glClearColor; +PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; +PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; +PFNGLLINKPROGRAMPROC glad_glLinkProgram; +PFNGLBINDTEXTUREPROC glad_glBindTexture; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; +PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; +PFNGLFENCESYNCPROC glad_glFenceSync; +PFNGLUNIFORM3UIPROC glad_glUniform3ui; +PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; +PFNGLGETSTRINGPROC glad_glGetString; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +PFNGLDETACHSHADERPROC glad_glDetachShader; +PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; +PFNGLGENBUFFERSPROC glad_glGenBuffers; +PFNGLENDQUERYPROC glad_glEndQuery; +PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +PFNGLLINEWIDTHPROC glad_glLineWidth; +PFNGLUNIFORM2FVPROC glad_glUniform2fv; +PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; +PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +PFNGLCOMPILESHADERPROC glad_glCompileShader; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +PFNGLPOLYGONMODEPROC glad_glPolygonMode; +PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; +PFNGLISSYNCPROC glad_glIsSync; +PFNGLCLAMPCOLORPROC glad_glClampColor; +PFNGLUNIFORM4IVPROC glad_glUniform4iv; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +PFNGLCLEARSTENCILPROC glad_glClearStencil; +PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; +PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; +PFNGLENABLEIPROC glad_glEnablei; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +PFNGLGENTEXTURESPROC glad_glGenTextures; +PFNGLDEPTHFUNCPROC glad_glDepthFunc; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +PFNGLUNIFORM1FPROC glad_glUniform1f; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; +PFNGLCREATESHADERPROC glad_glCreateShader; +PFNGLISBUFFERPROC glad_glIsBuffer; +PFNGLUNIFORM1IPROC glad_glUniform1i; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +PFNGLDISABLEPROC glad_glDisable; +PFNGLUNIFORM2IPROC glad_glUniform2i; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +PFNGLLOGICOPPROC glad_glLogicOp; +PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +PFNGLCOLORMASKPROC glad_glColorMask; +PFNGLHINTPROC glad_glHint; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; +PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +PFNGLSAMPLEMASKIPROC glad_glSampleMaski; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; +PFNGLCULLFACEPROC glad_glCullFace; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +PFNGLUNIFORM4FVPROC glad_glUniform4fv; +PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; +PFNGLPOINTSIZEPROC glad_glPointSize; +PFNGLGETSTRINGIPROC glad_glGetStringi; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +PFNGLGENQUERIESPROC glad_glGenQueries; +PFNGLWAITSYNCPROC glad_glWaitSync; +PFNGLATTACHSHADERPROC glad_glAttachShader; +PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +PFNGLUNIFORM3IPROC glad_glUniform3i; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; +PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; +PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +PFNGLUNIFORM3FPROC glad_glUniform3f; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; +PFNGLDRAWELEMENTSPROC glad_glDrawElements; +PFNGLCOLORMASKIPROC glad_glColorMaski; +PFNGLISENABLEDIPROC glad_glIsEnabledi; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; +PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +PFNGLUNIFORM1IVPROC glad_glUniform1iv; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; +PFNGLREADBUFFERPROC glad_glReadBuffer; +PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; +PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; +PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; +PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; +PFNGLGETSHADERIVPROC glad_glGetShaderiv; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +PFNGLBLENDCOLORPROC glad_glBlendColor; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +PFNGLDEPTHMASKPROC glad_glDepthMask; +PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +PFNGLDISABLEIPROC glad_glDisablei; +PFNGLGETDOUBLEVPROC glad_glGetDoublev; +PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +PFNGLSHADERSOURCEPROC glad_glShaderSource; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; +PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; +PFNGLDRAWARRAYSPROC glad_glDrawArrays; +PFNGLUNIFORM1UIPROC glad_glUniform1ui; +PFNGLISPROGRAMPROC glad_glIsProgram; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; +PFNGLGETSYNCIVPROC glad_glGetSynciv; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; +PFNGLUNIFORM4IPROC glad_glUniform4i; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +PFNGLCLEARPROC glad_glClear; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; +PFNGLUNIFORM2FPROC glad_glUniform2f; +PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; +PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +PFNGLBEGINQUERYPROC glad_glBeginQuery; +PFNGLUNIFORM2IVPROC glad_glUniform2iv; +PFNGLBINDBUFFERPROC glad_glBindBuffer; +PFNGLISENABLEDPROC glad_glIsEnabled; +PFNGLSTENCILOPPROC glad_glStencilOp; +PFNGLREADPIXELSPROC glad_glReadPixels; +PFNGLCLEARDEPTHPROC glad_glClearDepth; +PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; +PFNGLUNIFORM4FPROC glad_glUniform4f; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +PFNGLMAPBUFFERPROC glad_glMapBuffer; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +PFNGLUNIFORM3FVPROC glad_glUniform3fv; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +PFNGLBUFFERDATAPROC glad_glBufferData; +PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +PFNGLDELETESYNCPROC glad_glDeleteSync; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +PFNGLGETERRORPROC glad_glGetError; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +PFNGLGETFLOATVPROC glad_glGetFloatv; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +PFNGLUNIFORM3IVPROC glad_glUniform3iv; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +PFNGLUSEPROGRAMPROC glad_glUseProgram; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; +PFNGLSTENCILFUNCPROC glad_glStencilFunc; +PFNGLGETINTEGERVPROC glad_glGetIntegerv; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; +PFNGLUNIFORM1FVPROC glad_glUniform1fv; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; +PFNGLISQUERYPROC glad_glIsQuery; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +PFNGLGETQUERYIVPROC glad_glGetQueryiv; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +PFNGLSTENCILMASKPROC glad_glStencilMask; +PFNGLUNIFORM4UIPROC glad_glUniform4ui; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +PFNGLISTEXTUREPROC glad_glIsTexture; +PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; +PFNGLISSHADERPROC glad_glIsShader; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +PFNGLGETINTEGER64VPROC glad_glGetInteger64v; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; +PFNGLENABLEPROC glad_glEnable; +PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; +PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; +PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +PFNGLFINISHPROC glad_glFinish; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +PFNGLDELETESHADERPROC glad_glDeleteShader; +PFNGLBLENDFUNCPROC glad_glBlendFunc; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; +PFNGLVIEWPORTPROC glad_glViewport; +PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; +PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; +PFNGLUNIFORM2UIPROC glad_glUniform2ui; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; +PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +PFNGLDEPTHRANGEPROC glad_glDepthRange; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +PFNGLFRONTFACEPROC glad_glFrontFace; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +PFNGLSCISSORPROC glad_glScissor; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +PFNGLTEXBUFFERPROC glad_glTexBuffer; +PFNGLPIXELSTOREIPROC glad_glPixelStorei; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +PFNGLPIXELSTOREFPROC glad_glPixelStoref; +PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; +PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; +PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; +static void load_GL_VERSION_1_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_0) return; + glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); + glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); + glad_glHint = (PFNGLHINTPROC)load("glHint"); + glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); + glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); + glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); + glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); + glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); + glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); + glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); + glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); + glad_glClear = (PFNGLCLEARPROC)load("glClear"); + glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); + glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); + glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); + glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); + glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); + glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); + glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); + glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); + glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); + glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); + glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); + glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); + glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); + glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); + glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); + glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); + glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); + glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); + glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); + glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); + glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); + glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); + glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); +} +static void load_GL_VERSION_1_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_1) return; + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); + glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); + glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); + glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); + glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); + glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); +} +static void load_GL_VERSION_1_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_2) return; + glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); + glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); + glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); + glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); +} +static void load_GL_VERSION_1_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_3) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); + glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); + glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); + glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); + glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); + glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); +} +static void load_GL_VERSION_1_4(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_4) return; + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); + glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); + glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); + glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); + glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); + glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); + glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); + glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); +} +static void load_GL_VERSION_1_5(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_5) return; + glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); + glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); + glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); + glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); + glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); + glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); + glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); + glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); + glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); + glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); + glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); + glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); + glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); + glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); +} +static void load_GL_VERSION_2_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_0) return; + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); + glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); + glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); + glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); + glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); + glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); + glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); + glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); + glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); + glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); + glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); + glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); + glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); + glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); + glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); + glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); + glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); + glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); + glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); + glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); + glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); + glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); + glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); + glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); + glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); + glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); + glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); + glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); + glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); + glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); + glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); + glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); + glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); + glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); +} +static void load_GL_VERSION_2_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_1) return; + glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); + glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); + glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); + glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); + glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); + glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); +} +static void load_GL_VERSION_3_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_0) return; + glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski"); + glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); + glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei"); + glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei"); + glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi"); + glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); + glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); + glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); + glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); + glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor"); + glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender"); + glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender"); + glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); + glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); + glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); + glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i"); + glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i"); + glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i"); + glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); + glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui"); + glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui"); + glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui"); + glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); + glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv"); + glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv"); + glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv"); + glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); + glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv"); + glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv"); + glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv"); + glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); + glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv"); + glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv"); + glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv"); + glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv"); + glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); + glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation"); + glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); + glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); + glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); + glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); + glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); + glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); + glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); + glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); + glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); + glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv"); + glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv"); + glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv"); + glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv"); + glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); + glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); + glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); + glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); + glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); + glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); + glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); + glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); + glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); + glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); + glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); + glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); + glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); + glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); + glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); + glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); + glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D"); + glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); + glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D"); + glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); + glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); + glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); + glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); + glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); + glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); + glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); + glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); + glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); + glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); + glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); + glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); +} +static void load_GL_VERSION_3_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_1) return; + glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); + glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); + glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer"); + glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex"); + glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); + glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); + glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); + glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName"); + glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); + glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); + glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); + glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); +} +static void load_GL_VERSION_3_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_2) return; + glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex"); + glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex"); + glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex"); + glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex"); + glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex"); + glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); + glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); + glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); + glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); + glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); + glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); + glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); + glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); + glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); + glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture"); + glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample"); + glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample"); + glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv"); + glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski"); +} +static void find_extensionsGL(void) { +} + +static void find_coreGL(void) { + const char *v = (const char *)glGetString(GL_VERSION); + int major = v[0] - '0'; + int minor = v[2] - '0'; + GLVersion.major = major; GLVersion.minor = minor; + GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; + GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; + GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; + GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; + GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; + GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; + GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; + GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; +} + +void gladLoadGLLoader(GLADloadproc load) { + GLVersion.major = 0; GLVersion.minor = 0; + glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + if(glGetString == NULL) return; + find_coreGL(); + load_GL_VERSION_1_0(load); + load_GL_VERSION_1_1(load); + load_GL_VERSION_1_2(load); + load_GL_VERSION_1_3(load); + load_GL_VERSION_1_4(load); + load_GL_VERSION_1_5(load); + load_GL_VERSION_2_0(load); + load_GL_VERSION_2_1(load); + load_GL_VERSION_3_0(load); + load_GL_VERSION_3_1(load); + load_GL_VERSION_3_2(load); + + find_extensionsGL(); + + return; +} + diff --git a/extern/glfw/deps/glad/glad.h b/extern/glfw/deps/glad/glad.h new file mode 100644 index 0000000..e5de4ef --- /dev/null +++ b/extern/glfw/deps/glad/glad.h @@ -0,0 +1,1925 @@ + +#ifndef __glad_h_ + +#ifdef __gl_h_ +#error OpenGL header already included, remove this include, glad already provides it +#endif + +#define __glad_h_ +#define __gl_h_ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +extern struct gladGLversionStruct { + int major; + int minor; +} GLVersion; + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* (* GLADloadproc)(const char *name); + +#ifndef GLAPI +# if defined(GLAD_GLAPI_EXPORT) +# if defined(WIN32) || defined(__CYGWIN__) +# if defined(GLAD_GLAPI_EXPORT_BUILD) +# if defined(__GNUC__) +# define GLAPI __attribute__ ((dllexport)) extern +# else +# define GLAPI __declspec(dllexport) extern +# endif +# else +# if defined(__GNUC__) +# define GLAPI __attribute__ ((dllimport)) extern +# else +# define GLAPI __declspec(dllimport) extern +# endif +# endif +# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) +# define GLAPI __attribute__ ((visibility ("default"))) extern +# else +# define GLAPI extern +# endif +# else +# define GLAPI extern +# endif +#endif +GLAPI void gladLoadGLLoader(GLADloadproc); + +#include +#include +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.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 GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#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 +#elif defined(__SCO__) || defined(__USLC__) +#include +#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 +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLclampx; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef int GLsizei; +typedef float GLfloat; +typedef float GLclampf; +typedef double GLdouble; +typedef double GLclampd; +typedef void *GLeglImageOES; +typedef char GLchar; +typedef char GLcharARB; +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif +typedef unsigned short GLhalfARB; +typedef unsigned short GLhalf; +typedef GLint GLfixed; +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +typedef int64_t GLint64; +typedef uint64_t GLuint64; +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +typedef int64_t GLint64EXT; +typedef uint64_t GLuint64EXT; +typedef struct __GLsync *GLsync; +struct _cl_context; +struct _cl_event; +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); +typedef unsigned short GLhalfNV; +typedef GLintptr GLvdpauSurfaceNV; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_VIEWPORT 0x0BA2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F +#define GL_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_REPEAT 0x2901 +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SRC1_ALPHA 0x8589 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_INDEX 0x8222 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_HALF_FLOAT 0x140B +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFF +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_DEPTH_CLAMP 0x864F +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#ifndef GL_VERSION_1_0 +#define GL_VERSION_1_0 1 +GLAPI int GLAD_GL_VERSION_1_0; +typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum); +GLAPI PFNGLCULLFACEPROC glad_glCullFace; +#define glCullFace glad_glCullFace +typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum); +GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; +#define glFrontFace glad_glFrontFace +typedef void (APIENTRYP PFNGLHINTPROC)(GLenum, GLenum); +GLAPI PFNGLHINTPROC glad_glHint; +#define glHint glad_glHint +typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat); +GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; +#define glLineWidth glad_glLineWidth +typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat); +GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; +#define glPointSize glad_glPointSize +typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum, GLenum); +GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; +#define glPolygonMode glad_glPolygonMode +typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint, GLint, GLsizei, GLsizei); +GLAPI PFNGLSCISSORPROC glad_glScissor; +#define glScissor glad_glScissor +typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum, GLenum, GLfloat); +GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +#define glTexParameterf glad_glTexParameterf +typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum, GLenum, const GLfloat*); +GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +#define glTexParameterfv glad_glTexParameterfv +typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum, GLenum, GLint); +GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +#define glTexParameteri glad_glTexParameteri +typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum, GLenum, const GLint*); +GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +#define glTexParameteriv glad_glTexParameteriv +typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void*); +GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +#define glTexImage1D glad_glTexImage1D +typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); +GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +#define glTexImage2D glad_glTexImage2D +typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum); +GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +#define glDrawBuffer glad_glDrawBuffer +typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield); +GLAPI PFNGLCLEARPROC glad_glClear; +#define glClear glad_glClear +typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; +#define glClearColor glad_glClearColor +typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint); +GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; +#define glClearStencil glad_glClearStencil +typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble); +GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; +#define glClearDepth glad_glClearDepth +typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint); +GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; +#define glStencilMask glad_glStencilMask +typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean, GLboolean, GLboolean, GLboolean); +GLAPI PFNGLCOLORMASKPROC glad_glColorMask; +#define glColorMask glad_glColorMask +typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean); +GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; +#define glDepthMask glad_glDepthMask +typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum); +GLAPI PFNGLDISABLEPROC glad_glDisable; +#define glDisable glad_glDisable +typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum); +GLAPI PFNGLENABLEPROC glad_glEnable; +#define glEnable glad_glEnable +typedef void (APIENTRYP PFNGLFINISHPROC)(); +GLAPI PFNGLFINISHPROC glad_glFinish; +#define glFinish glad_glFinish +typedef void (APIENTRYP PFNGLFLUSHPROC)(); +GLAPI PFNGLFLUSHPROC glad_glFlush; +#define glFlush glad_glFlush +typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum, GLenum); +GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; +#define glBlendFunc glad_glBlendFunc +typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum); +GLAPI PFNGLLOGICOPPROC glad_glLogicOp; +#define glLogicOp glad_glLogicOp +typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum, GLint, GLuint); +GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; +#define glStencilFunc glad_glStencilFunc +typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum, GLenum, GLenum); +GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; +#define glStencilOp glad_glStencilOp +typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum); +GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; +#define glDepthFunc glad_glDepthFunc +typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum, GLfloat); +GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; +#define glPixelStoref glad_glPixelStoref +typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum, GLint); +GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; +#define glPixelStorei glad_glPixelStorei +typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum); +GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; +#define glReadBuffer glad_glReadBuffer +typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*); +GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; +#define glReadPixels glad_glReadPixels +typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum, GLboolean*); +GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +#define glGetBooleanv glad_glGetBooleanv +typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum, GLdouble*); +GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; +#define glGetDoublev glad_glGetDoublev +typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(); +GLAPI PFNGLGETERRORPROC glad_glGetError; +#define glGetError glad_glGetError +typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum, GLfloat*); +GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; +#define glGetFloatv glad_glGetFloatv +typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum, GLint*); +GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; +#define glGetIntegerv glad_glGetIntegerv +typedef const GLubyte* (APIENTRYP PFNGLGETSTRINGPROC)(GLenum); +GLAPI PFNGLGETSTRINGPROC glad_glGetString; +#define glGetString glad_glGetString +typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum, GLint, GLenum, GLenum, void*); +GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +#define glGetTexImage glad_glGetTexImage +typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum, GLenum, GLfloat*); +GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +#define glGetTexParameterfv glad_glGetTexParameterfv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum, GLenum, GLint*); +GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +#define glGetTexParameteriv glad_glGetTexParameteriv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum, GLint, GLenum, GLfloat*); +GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum, GLint, GLenum, GLint*); +GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv +typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum); +GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; +#define glIsEnabled glad_glIsEnabled +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble, GLdouble); +GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; +#define glDepthRange glad_glDepthRange +typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint, GLint, GLsizei, GLsizei); +GLAPI PFNGLVIEWPORTPROC glad_glViewport; +#define glViewport glad_glViewport +#endif +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 +GLAPI int GLAD_GL_VERSION_1_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum, GLint, GLsizei); +GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; +#define glDrawArrays glad_glDrawArrays +typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum, GLsizei, GLenum, const void*); +GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; +#define glDrawElements glad_glDrawElements +typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat, GLfloat); +GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +#define glPolygonOffset glad_glPolygonOffset +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +#define glCopyTexImage1D glad_glCopyTexImage1D +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +#define glCopyTexImage2D glad_glCopyTexImage2D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +#define glCopyTexSubImage1D glad_glCopyTexSubImage1D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +#define glCopyTexSubImage2D glad_glCopyTexSubImage2D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void*); +GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +#define glTexSubImage1D glad_glTexSubImage1D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void*); +GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +#define glTexSubImage2D glad_glTexSubImage2D +typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum, GLuint); +GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; +#define glBindTexture glad_glBindTexture +typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei, const GLuint*); +GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +#define glDeleteTextures glad_glDeleteTextures +typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei, GLuint*); +GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; +#define glGenTextures glad_glGenTextures +typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint); +GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; +#define glIsTexture glad_glIsTexture +#endif +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +GLAPI int GLAD_GL_VERSION_1_2; +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void*); +GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +#define glDrawRangeElements glad_glDrawRangeElements +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); +GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +#define glTexImage3D glad_glTexImage3D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*); +GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +#define glTexSubImage3D glad_glTexSubImage3D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +#define glCopyTexSubImage3D glad_glCopyTexSubImage3D +#endif +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +GLAPI int GLAD_GL_VERSION_1_3; +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum); +GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +#define glActiveTexture glad_glActiveTexture +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat, GLboolean); +GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +#define glSampleCoverage glad_glSampleCoverage +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void*); +GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +#define glCompressedTexImage3D glad_glCompressedTexImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*); +GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +#define glCompressedTexImage2D glad_glCompressedTexImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void*); +GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +#define glCompressedTexImage1D glad_glCompressedTexImage1D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void*); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void*); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void*); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum, GLint, void*); +GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +#define glGetCompressedTexImage glad_glGetCompressedTexImage +#endif +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +GLAPI int GLAD_GL_VERSION_1_4; +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum, GLenum, GLenum, GLenum); +GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +#define glBlendFuncSeparate glad_glBlendFuncSeparate +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum, const GLint*, const GLsizei*, GLsizei); +GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +#define glMultiDrawArrays glad_glMultiDrawArrays +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum, const GLsizei*, GLenum, const void**, GLsizei); +GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +#define glMultiDrawElements glad_glMultiDrawElements +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum, GLfloat); +GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +#define glPointParameterf glad_glPointParameterf +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum, const GLfloat*); +GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +#define glPointParameterfv glad_glPointParameterfv +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum, GLint); +GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +#define glPointParameteri glad_glPointParameteri +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum, const GLint*); +GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +#define glPointParameteriv glad_glPointParameteriv +typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; +#define glBlendColor glad_glBlendColor +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum); +GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +#define glBlendEquation glad_glBlendEquation +#endif +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +GLAPI int GLAD_GL_VERSION_1_5; +typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei, GLuint*); +GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; +#define glGenQueries glad_glGenQueries +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei, const GLuint*); +GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +#define glDeleteQueries glad_glDeleteQueries +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint); +GLAPI PFNGLISQUERYPROC glad_glIsQuery; +#define glIsQuery glad_glIsQuery +typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum, GLuint); +GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; +#define glBeginQuery glad_glBeginQuery +typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum); +GLAPI PFNGLENDQUERYPROC glad_glEndQuery; +#define glEndQuery glad_glEndQuery +typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum, GLenum, GLint*); +GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; +#define glGetQueryiv glad_glGetQueryiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint, GLenum, GLint*); +GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +#define glGetQueryObjectiv glad_glGetQueryObjectiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint, GLenum, GLuint*); +GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +#define glGetQueryObjectuiv glad_glGetQueryObjectuiv +typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum, GLuint); +GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; +#define glBindBuffer glad_glBindBuffer +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei, const GLuint*); +GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +#define glDeleteBuffers glad_glDeleteBuffers +typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei, GLuint*); +GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; +#define glGenBuffers glad_glGenBuffers +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint); +GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; +#define glIsBuffer glad_glIsBuffer +typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum, GLsizeiptr, const void*, GLenum); +GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; +#define glBufferData glad_glBufferData +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum, GLintptr, GLsizeiptr, const void*); +GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +#define glBufferSubData glad_glBufferSubData +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum, GLintptr, GLsizeiptr, void*); +GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +#define glGetBufferSubData glad_glGetBufferSubData +typedef void* (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum, GLenum); +GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; +#define glMapBuffer glad_glMapBuffer +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum); +GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +#define glUnmapBuffer glad_glUnmapBuffer +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum, GLenum, GLint*); +GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +#define glGetBufferParameteriv glad_glGetBufferParameteriv +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum, GLenum, void**); +GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +#define glGetBufferPointerv glad_glGetBufferPointerv +#endif +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +GLAPI int GLAD_GL_VERSION_2_0; +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum, GLenum); +GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +#define glBlendEquationSeparate glad_glBlendEquationSeparate +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei, const GLenum*); +GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +#define glDrawBuffers glad_glDrawBuffers +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum, GLenum, GLenum, GLenum); +GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +#define glStencilOpSeparate glad_glStencilOpSeparate +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum, GLenum, GLint, GLuint); +GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +#define glStencilFuncSeparate glad_glStencilFuncSeparate +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum, GLuint); +GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +#define glStencilMaskSeparate glad_glStencilMaskSeparate +typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint, GLuint); +GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; +#define glAttachShader glad_glAttachShader +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint, GLuint, const GLchar*); +GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +#define glBindAttribLocation glad_glBindAttribLocation +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint); +GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; +#define glCompileShader glad_glCompileShader +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(); +GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +#define glCreateProgram glad_glCreateProgram +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum); +GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; +#define glCreateShader glad_glCreateShader +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint); +GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +#define glDeleteProgram glad_glDeleteProgram +typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint); +GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; +#define glDeleteShader glad_glDeleteShader +typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint, GLuint); +GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; +#define glDetachShader glad_glDetachShader +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint); +GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +#define glDisableVertexAttribArray glad_glDisableVertexAttribArray +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint); +GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +#define glEnableVertexAttribArray glad_glEnableVertexAttribArray +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*); +GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +#define glGetActiveAttrib glad_glGetActiveAttrib +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*); +GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +#define glGetActiveUniform glad_glGetActiveUniform +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint, GLsizei, GLsizei*, GLuint*); +GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +#define glGetAttachedShaders glad_glGetAttachedShaders +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint, const GLchar*); +GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +#define glGetAttribLocation glad_glGetAttribLocation +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint, GLenum, GLint*); +GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +#define glGetProgramiv glad_glGetProgramiv +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint, GLsizei, GLsizei*, GLchar*); +GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +#define glGetProgramInfoLog glad_glGetProgramInfoLog +typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint, GLenum, GLint*); +GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; +#define glGetShaderiv glad_glGetShaderiv +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint, GLsizei, GLsizei*, GLchar*); +GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +#define glGetShaderInfoLog glad_glGetShaderInfoLog +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint, GLsizei, GLsizei*, GLchar*); +GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +#define glGetShaderSource glad_glGetShaderSource +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint, const GLchar*); +GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +#define glGetUniformLocation glad_glGetUniformLocation +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint, GLint, GLfloat*); +GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +#define glGetUniformfv glad_glGetUniformfv +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint, GLint, GLint*); +GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +#define glGetUniformiv glad_glGetUniformiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint, GLenum, GLdouble*); +GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +#define glGetVertexAttribdv glad_glGetVertexAttribdv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint, GLenum, GLfloat*); +GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +#define glGetVertexAttribfv glad_glGetVertexAttribfv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint, GLenum, GLint*); +GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +#define glGetVertexAttribiv glad_glGetVertexAttribiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint, GLenum, void**); +GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint); +GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; +#define glIsProgram glad_glIsProgram +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint); +GLAPI PFNGLISSHADERPROC glad_glIsShader; +#define glIsShader glad_glIsShader +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint); +GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; +#define glLinkProgram glad_glLinkProgram +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint, GLsizei, const GLchar**, const GLint*); +GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; +#define glShaderSource glad_glShaderSource +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint); +GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; +#define glUseProgram glad_glUseProgram +typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint, GLfloat); +GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; +#define glUniform1f glad_glUniform1f +typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint, GLfloat, GLfloat); +GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; +#define glUniform2f glad_glUniform2f +typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint, GLfloat, GLfloat, GLfloat); +GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; +#define glUniform3f glad_glUniform3f +typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; +#define glUniform4f glad_glUniform4f +typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint, GLint); +GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; +#define glUniform1i glad_glUniform1i +typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint, GLint, GLint); +GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; +#define glUniform2i glad_glUniform2i +typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint, GLint, GLint, GLint); +GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; +#define glUniform3i glad_glUniform3i +typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint, GLint, GLint, GLint, GLint); +GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; +#define glUniform4i glad_glUniform4i +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint, GLsizei, const GLfloat*); +GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; +#define glUniform1fv glad_glUniform1fv +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint, GLsizei, const GLfloat*); +GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; +#define glUniform2fv glad_glUniform2fv +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint, GLsizei, const GLfloat*); +GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; +#define glUniform3fv glad_glUniform3fv +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint, GLsizei, const GLfloat*); +GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; +#define glUniform4fv glad_glUniform4fv +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint, GLsizei, const GLint*); +GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; +#define glUniform1iv glad_glUniform1iv +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint, GLsizei, const GLint*); +GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; +#define glUniform2iv glad_glUniform2iv +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint, GLsizei, const GLint*); +GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; +#define glUniform3iv glad_glUniform3iv +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint, GLsizei, const GLint*); +GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; +#define glUniform4iv glad_glUniform4iv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +#define glUniformMatrix2fv glad_glUniformMatrix2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +#define glUniformMatrix3fv glad_glUniformMatrix3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +#define glUniformMatrix4fv glad_glUniformMatrix4fv +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint); +GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +#define glValidateProgram glad_glValidateProgram +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint, GLdouble); +GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +#define glVertexAttrib1d glad_glVertexAttrib1d +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint, const GLdouble*); +GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +#define glVertexAttrib1dv glad_glVertexAttrib1dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint, GLfloat); +GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +#define glVertexAttrib1f glad_glVertexAttrib1f +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint, const GLfloat*); +GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +#define glVertexAttrib1fv glad_glVertexAttrib1fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint, GLshort); +GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +#define glVertexAttrib1s glad_glVertexAttrib1s +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint, const GLshort*); +GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +#define glVertexAttrib1sv glad_glVertexAttrib1sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint, GLdouble, GLdouble); +GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +#define glVertexAttrib2d glad_glVertexAttrib2d +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint, const GLdouble*); +GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +#define glVertexAttrib2dv glad_glVertexAttrib2dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint, GLfloat, GLfloat); +GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +#define glVertexAttrib2f glad_glVertexAttrib2f +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint, const GLfloat*); +GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +#define glVertexAttrib2fv glad_glVertexAttrib2fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint, GLshort, GLshort); +GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +#define glVertexAttrib2s glad_glVertexAttrib2s +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint, const GLshort*); +GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +#define glVertexAttrib2sv glad_glVertexAttrib2sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint, GLdouble, GLdouble, GLdouble); +GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +#define glVertexAttrib3d glad_glVertexAttrib3d +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint, const GLdouble*); +GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +#define glVertexAttrib3dv glad_glVertexAttrib3dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint, GLfloat, GLfloat, GLfloat); +GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +#define glVertexAttrib3f glad_glVertexAttrib3f +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint, const GLfloat*); +GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +#define glVertexAttrib3fv glad_glVertexAttrib3fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint, GLshort, GLshort, GLshort); +GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +#define glVertexAttrib3s glad_glVertexAttrib3s +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint, const GLshort*); +GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +#define glVertexAttrib3sv glad_glVertexAttrib3sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint, const GLbyte*); +GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint, const GLint*); +GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +#define glVertexAttrib4Niv glad_glVertexAttrib4Niv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint, const GLshort*); +GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +#define glVertexAttrib4Nub glad_glVertexAttrib4Nub +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint, const GLubyte*); +GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint, const GLuint*); +GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint, const GLushort*); +GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint, const GLbyte*); +GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +#define glVertexAttrib4bv glad_glVertexAttrib4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +#define glVertexAttrib4d glad_glVertexAttrib4d +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint, const GLdouble*); +GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +#define glVertexAttrib4dv glad_glVertexAttrib4dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +#define glVertexAttrib4f glad_glVertexAttrib4f +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint, const GLfloat*); +GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +#define glVertexAttrib4fv glad_glVertexAttrib4fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint, const GLint*); +GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +#define glVertexAttrib4iv glad_glVertexAttrib4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +#define glVertexAttrib4s glad_glVertexAttrib4s +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint, const GLshort*); +GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +#define glVertexAttrib4sv glad_glVertexAttrib4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint, const GLubyte*); +GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +#define glVertexAttrib4ubv glad_glVertexAttrib4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint, const GLuint*); +GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +#define glVertexAttrib4uiv glad_glVertexAttrib4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint, const GLushort*); +GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +#define glVertexAttrib4usv glad_glVertexAttrib4usv +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void*); +GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +#define glVertexAttribPointer glad_glVertexAttribPointer +#endif +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +GLAPI int GLAD_GL_VERSION_2_1; +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint, GLsizei, GLboolean, const GLfloat*); +GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv +#endif +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +GLAPI int GLAD_GL_VERSION_3_0; +typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean); +GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; +#define glColorMaski glad_glColorMaski +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum, GLuint, GLboolean*); +GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; +#define glGetBooleani_v glad_glGetBooleani_v +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum, GLuint, GLint*); +GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; +#define glGetIntegeri_v glad_glGetIntegeri_v +typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum, GLuint); +GLAPI PFNGLENABLEIPROC glad_glEnablei; +#define glEnablei glad_glEnablei +typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum, GLuint); +GLAPI PFNGLDISABLEIPROC glad_glDisablei; +#define glDisablei glad_glDisablei +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum, GLuint); +GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; +#define glIsEnabledi glad_glIsEnabledi +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum); +GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; +#define glBeginTransformFeedback glad_glBeginTransformFeedback +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(); +GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; +#define glEndTransformFeedback glad_glEndTransformFeedback +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); +GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; +#define glBindBufferRange glad_glBindBufferRange +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum, GLuint, GLuint); +GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; +#define glBindBufferBase glad_glBindBufferBase +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint, GLsizei, const GLchar**, GLenum); +GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; +#define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*); +GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; +#define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum, GLenum); +GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; +#define glClampColor glad_glClampColor +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint, GLenum); +GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; +#define glBeginConditionalRender glad_glBeginConditionalRender +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(); +GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; +#define glEndConditionalRender glad_glEndConditionalRender +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint, GLint, GLenum, GLsizei, const void*); +GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; +#define glVertexAttribIPointer glad_glVertexAttribIPointer +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint, GLenum, GLint*); +GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; +#define glGetVertexAttribIiv glad_glGetVertexAttribIiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint, GLenum, GLuint*); +GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; +#define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint, GLint); +GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; +#define glVertexAttribI1i glad_glVertexAttribI1i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint, GLint, GLint); +GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; +#define glVertexAttribI2i glad_glVertexAttribI2i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint, GLint, GLint, GLint); +GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; +#define glVertexAttribI3i glad_glVertexAttribI3i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint, GLint, GLint, GLint, GLint); +GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; +#define glVertexAttribI4i glad_glVertexAttribI4i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint, GLuint); +GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; +#define glVertexAttribI1ui glad_glVertexAttribI1ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint, GLuint, GLuint); +GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; +#define glVertexAttribI2ui glad_glVertexAttribI2ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint, GLuint, GLuint, GLuint); +GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; +#define glVertexAttribI3ui glad_glVertexAttribI3ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; +#define glVertexAttribI4ui glad_glVertexAttribI4ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint, const GLint*); +GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; +#define glVertexAttribI1iv glad_glVertexAttribI1iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint, const GLint*); +GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; +#define glVertexAttribI2iv glad_glVertexAttribI2iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint, const GLint*); +GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; +#define glVertexAttribI3iv glad_glVertexAttribI3iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint, const GLint*); +GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; +#define glVertexAttribI4iv glad_glVertexAttribI4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint, const GLuint*); +GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; +#define glVertexAttribI1uiv glad_glVertexAttribI1uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint, const GLuint*); +GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; +#define glVertexAttribI2uiv glad_glVertexAttribI2uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint, const GLuint*); +GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; +#define glVertexAttribI3uiv glad_glVertexAttribI3uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint, const GLuint*); +GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; +#define glVertexAttribI4uiv glad_glVertexAttribI4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint, const GLbyte*); +GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; +#define glVertexAttribI4bv glad_glVertexAttribI4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint, const GLshort*); +GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; +#define glVertexAttribI4sv glad_glVertexAttribI4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint, const GLubyte*); +GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; +#define glVertexAttribI4ubv glad_glVertexAttribI4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint, const GLushort*); +GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; +#define glVertexAttribI4usv glad_glVertexAttribI4usv +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint, GLint, GLuint*); +GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; +#define glGetUniformuiv glad_glGetUniformuiv +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint, GLuint, const GLchar*); +GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; +#define glBindFragDataLocation glad_glBindFragDataLocation +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint, const GLchar*); +GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; +#define glGetFragDataLocation glad_glGetFragDataLocation +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint, GLuint); +GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; +#define glUniform1ui glad_glUniform1ui +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint, GLuint, GLuint); +GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; +#define glUniform2ui glad_glUniform2ui +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint, GLuint, GLuint, GLuint); +GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; +#define glUniform3ui glad_glUniform3ui +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint, GLuint, GLuint, GLuint, GLuint); +GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; +#define glUniform4ui glad_glUniform4ui +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint, GLsizei, const GLuint*); +GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; +#define glUniform1uiv glad_glUniform1uiv +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint, GLsizei, const GLuint*); +GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; +#define glUniform2uiv glad_glUniform2uiv +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint, GLsizei, const GLuint*); +GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; +#define glUniform3uiv glad_glUniform3uiv +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint, GLsizei, const GLuint*); +GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; +#define glUniform4uiv glad_glUniform4uiv +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum, GLenum, const GLint*); +GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; +#define glTexParameterIiv glad_glTexParameterIiv +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum, GLenum, const GLuint*); +GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; +#define glTexParameterIuiv glad_glTexParameterIuiv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum, GLenum, GLint*); +GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; +#define glGetTexParameterIiv glad_glGetTexParameterIiv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum, GLenum, GLuint*); +GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; +#define glGetTexParameterIuiv glad_glGetTexParameterIuiv +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum, GLint, const GLint*); +GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; +#define glClearBufferiv glad_glClearBufferiv +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum, GLint, const GLuint*); +GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +#define glClearBufferuiv glad_glClearBufferuiv +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum, GLint, const GLfloat*); +GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; +#define glClearBufferfv glad_glClearBufferfv +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum, GLint, GLfloat, GLint); +GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; +#define glClearBufferfi glad_glClearBufferfi +typedef const GLubyte* (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum, GLuint); +GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; +#define glGetStringi glad_glGetStringi +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint); +GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +#define glIsRenderbuffer glad_glIsRenderbuffer +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum, GLuint); +GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +#define glBindRenderbuffer glad_glBindRenderbuffer +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei, const GLuint*); +GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +#define glDeleteRenderbuffers glad_glDeleteRenderbuffers +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei, GLuint*); +GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +#define glGenRenderbuffers glad_glGenRenderbuffers +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum, GLenum, GLsizei, GLsizei); +GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +#define glRenderbufferStorage glad_glRenderbufferStorage +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum, GLenum, GLint*); +GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint); +GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +#define glIsFramebuffer glad_glIsFramebuffer +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum, GLuint); +GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +#define glBindFramebuffer glad_glBindFramebuffer +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei, const GLuint*); +GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +#define glDeleteFramebuffers glad_glDeleteFramebuffers +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei, GLuint*); +GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +#define glGenFramebuffers glad_glGenFramebuffers +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum); +GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +#define glCheckFramebufferStatus glad_glCheckFramebufferStatus +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; +#define glFramebufferTexture1D glad_glFramebufferTexture1D +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +#define glFramebufferTexture2D glad_glFramebufferTexture2D +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; +#define glFramebufferTexture3D glad_glFramebufferTexture3D +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum, GLenum, GLenum, GLuint); +GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum, GLenum, GLenum, GLint*); +GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum); +GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +#define glGenerateMipmap glad_glGenerateMipmap +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); +GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; +#define glBlitFramebuffer glad_glBlitFramebuffer +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +#define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum, GLenum, GLuint, GLint, GLint); +GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; +#define glFramebufferTextureLayer glad_glFramebufferTextureLayer +typedef void* (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum, GLintptr, GLsizeiptr, GLbitfield); +GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; +#define glMapBufferRange glad_glMapBufferRange +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum, GLintptr, GLsizeiptr); +GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; +#define glFlushMappedBufferRange glad_glFlushMappedBufferRange +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint); +GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; +#define glBindVertexArray glad_glBindVertexArray +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei, const GLuint*); +GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; +#define glDeleteVertexArrays glad_glDeleteVertexArrays +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei, GLuint*); +GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; +#define glGenVertexArrays glad_glGenVertexArrays +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint); +GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; +#define glIsVertexArray glad_glIsVertexArray +#endif +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +GLAPI int GLAD_GL_VERSION_3_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum, GLint, GLsizei, GLsizei); +GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; +#define glDrawArraysInstanced glad_glDrawArraysInstanced +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum, GLsizei, GLenum, const void*, GLsizei); +GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; +#define glDrawElementsInstanced glad_glDrawElementsInstanced +typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum, GLenum, GLuint); +GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; +#define glTexBuffer glad_glTexBuffer +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint); +GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; +#define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); +GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; +#define glCopyBufferSubData glad_glCopyBufferSubData +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint, GLsizei, const GLchar**, GLuint*); +GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; +#define glGetUniformIndices glad_glGetUniformIndices +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint, GLsizei, const GLuint*, GLenum, GLint*); +GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; +#define glGetActiveUniformsiv glad_glGetActiveUniformsiv +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint, GLuint, GLsizei, GLsizei*, GLchar*); +GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; +#define glGetActiveUniformName glad_glGetActiveUniformName +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint, const GLchar*); +GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; +#define glGetUniformBlockIndex glad_glGetUniformBlockIndex +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint, GLuint, GLenum, GLint*); +GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; +#define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint, GLuint, GLsizei, GLsizei*, GLchar*); +GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; +#define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint, GLuint, GLuint); +GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; +#define glUniformBlockBinding glad_glUniformBlockBinding +#endif +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +GLAPI int GLAD_GL_VERSION_3_2; +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum, GLsizei, GLenum, const void*, GLint); +GLAPI PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; +#define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void*, GLint); +GLAPI PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; +#define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum, GLsizei, GLenum, const void*, GLsizei, GLint); +GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +#define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum, const GLsizei*, GLenum, const void**, GLsizei, const GLint*); +GLAPI PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; +#define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum); +GLAPI PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; +#define glProvokingVertex glad_glProvokingVertex +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC)(GLenum, GLbitfield); +GLAPI PFNGLFENCESYNCPROC glad_glFenceSync; +#define glFenceSync glad_glFenceSync +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC)(GLsync); +GLAPI PFNGLISSYNCPROC glad_glIsSync; +#define glIsSync glad_glIsSync +typedef void (APIENTRYP PFNGLDELETESYNCPROC)(GLsync); +GLAPI PFNGLDELETESYNCPROC glad_glDeleteSync; +#define glDeleteSync glad_glDeleteSync +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync, GLbitfield, GLuint64); +GLAPI PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; +#define glClientWaitSync glad_glClientWaitSync +typedef void (APIENTRYP PFNGLWAITSYNCPROC)(GLsync, GLbitfield, GLuint64); +GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; +#define glWaitSync glad_glWaitSync +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum, GLint64*); +GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; +#define glGetInteger64v glad_glGetInteger64v +typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync, GLenum, GLsizei, GLsizei*, GLint*); +GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; +#define glGetSynciv glad_glGetSynciv +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum, GLuint, GLint64*); +GLAPI PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; +#define glGetInteger64i_v glad_glGetInteger64i_v +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum, GLenum, GLint64*); +GLAPI PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; +#define glGetBufferParameteri64v glad_glGetBufferParameteri64v +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum, GLenum, GLuint, GLint); +GLAPI PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; +#define glFramebufferTexture glad_glFramebufferTexture +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); +GLAPI PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; +#define glTexImage2DMultisample glad_glTexImage2DMultisample +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); +GLAPI PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; +#define glTexImage3DMultisample glad_glTexImage3DMultisample +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum, GLuint, GLfloat*); +GLAPI PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; +#define glGetMultisamplefv glad_glGetMultisamplefv +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint, GLbitfield); +GLAPI PFNGLSAMPLEMASKIPROC glad_glSampleMaski; +#define glSampleMaski glad_glSampleMaski +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/extern/glfw/deps/tinycthread.h b/extern/glfw/deps/tinycthread.h index 18451ef..86a9080 100644 --- a/extern/glfw/deps/tinycthread.h +++ b/extern/glfw/deps/tinycthread.h @@ -122,6 +122,7 @@ typedef int _tthread_clockid_t; /* Emulate clock_gettime */ int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts); #define clock_gettime _tthread_clock_gettime +#define CLOCK_REALTIME 0 #endif diff --git a/extern/glfw/docs/CMakeLists.txt b/extern/glfw/docs/CMakeLists.txt deleted file mode 100644 index 45a6162..0000000 --- a/extern/glfw/docs/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ - -add_custom_target(docs ALL ${DOXYGEN_EXECUTABLE} - WORKING_DIRECTORY ${GLFW_BINARY_DIR}/docs - COMMENT "Generating HTML documentation" VERBATIM) - diff --git a/extern/glfw/docs/Doxyfile.in b/extern/glfw/docs/Doxyfile.in deleted file mode 100644 index ed6c658..0000000 --- a/extern/glfw/docs/Doxyfile.in +++ /dev/null @@ -1,1872 +0,0 @@ -# Doxyfile 1.8.3.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = "GLFW" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = @GLFW_VERSION_FULL@ - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "A multi-platform library for OpenGL, window and input" - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = @GLFW_BINARY_DIR@/docs - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = NO - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. - -EXTENSION_MAPPING = - -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented classes, -# or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES (the -# default) will make doxygen replace the get and set methods by a property in -# the documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if section-label ... \endif -# and \cond section-label ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. Do not use -# file names with spaces, bibtex cannot handle them. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = @GLFW_BINARY_DIR@/docs/warnings.txt - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = @GLFW_INTERNAL_DOCS@ \ - @GLFW_SOURCE_DIR@/include/GLFW/glfw3.h \ - @GLFW_SOURCE_DIR@/include/GLFW/glfw3native.h \ - @GLFW_SOURCE_DIR@/docs/main.dox \ - @GLFW_SOURCE_DIR@/docs/news.dox \ - @GLFW_SOURCE_DIR@/docs/quick.dox \ - @GLFW_SOURCE_DIR@/docs/moving.dox \ - @GLFW_SOURCE_DIR@/docs/compile.dox \ - @GLFW_SOURCE_DIR@/docs/build.dox \ - @GLFW_SOURCE_DIR@/docs/context.dox \ - @GLFW_SOURCE_DIR@/docs/monitor.dox \ - @GLFW_SOURCE_DIR@/docs/window.dox \ - @GLFW_SOURCE_DIR@/docs/compat.dox - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.h *.dox - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = APIENTRY GLFWAPI - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = @GLFW_SOURCE_DIR@/examples - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page (index.html). -# This can be useful if you have a project on for instance GitHub and want reuse -# the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = glfw GLFW_ - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = @GLFW_SOURCE_DIR@/docs/header.html - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = @GLFW_SOURCE_DIR@/docs/footer.html - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. - -HTML_EXTRA_STYLESHEET = @GLFW_SOURCE_DIR@/docs/extra.css - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 300 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and -# SVG. The default value is HTML-CSS, which is slower, but has the best -# compatibility. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. -# However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. -# There are two flavours of web server based search depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. -# See the manual for details. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain -# the search results. Doxygen ships with an example indexer (doxyindexer) and -# search engine (doxysearch.cgi) which are based on the open source search engine -# library Xapian. See the manual for configuration details. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will returned the search results when EXTERNAL_SEARCH is enabled. -# Doxygen ships with an example search engine (doxysearch) which is based on -# the open source search engine library Xapian. See the manual for configuration -# details. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id -# of to a relative location where the documentation can be found. -# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# 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_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 -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. For each -# tag file the location of the external documentation should be added. The -# format of a tag file without this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths -# or URLs. Note that each tag file must have a unique name (where the name does -# NOT include the path). If a tag file is not located in the directory in which -# doxygen is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside -# the class node. If there are many fields or methods and many nodes the -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS -# threshold limits the number of items for each type to make the size more -# managable. Set this to 0 for no limit. Note that the threshold may be -# exceeded by 50% before the limit is enforced. - -UML_LIMIT_NUM_FIELDS = 10 - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/extern/glfw/docs/build.dox b/extern/glfw/docs/build.dox deleted file mode 100644 index c4594cd..0000000 --- a/extern/glfw/docs/build.dox +++ /dev/null @@ -1,217 +0,0 @@ -/*! - -@page build Building programs that use GLFW - -@tableofcontents - -This is about compiling and linking programs that use GLFW. For information on -how to write such programs, start with the [introductory tutorial](@ref quick). -For information on how to compile the GLFW library itself, see the @ref compile -guide. - - -@section build_include Including the GLFW header file - -In the files of your program where you use OpenGL or GLFW, you should include -the GLFW 3 header file, i.e.: - -@code -#include -@endcode - -This defines all the constants, types and function prototypes of the GLFW API. -It also includes the chosen client API header files (by default OpenGL), and -defines all the constants and types necessary for those headers to work on that -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 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 directly - - If you *do* need to include such headers, do it *before* including - the GLFW one and it will detect this - -If you are using an OpenGL extension loading library such as -[GLEW](http://glew.sourceforge.net/), the GLEW header should also be included -*before* the GLFW one. The GLEW header defines macros that disable any OpenGL -header that the GLFW header includes and GLEW will work as expected. - - -@subsection build_macros GLFW header option macros - -These macros may be defined before the inclusion of the GLFW header and affect -the behavior of the header. Note that GLFW does not provide any of the OpenGL -or OpenGL ES headers mentioned below. These are provided by your development -environment or your OpenGL or OpenGL ES SDK. - -`GLFW_INCLUDE_GLCOREARB` makes the header include the modern `GL/glcorearb.h` -header (`OpenGL/gl3.h` on OS X) instead of the regular OpenGL header. - -`GLFW_INCLUDE_ES1` makes the header include the OpenGL ES 1.x `GLES/gl.h` header -instead of the regular OpenGL header. - -`GLFW_INCLUDE_ES2` makes the header include the OpenGL ES 2.0 `GLES2/gl2.h` -header instead of the regular OpenGL header. - -`GLFW_INCLUDE_ES3` makes the header include the OpenGL ES 3.0 `GLES3/gl3.h` -header instead of the regular OpenGL header. - -`GLFW_INCLUDE_NONE` makes the header not include any client API header. - -`GLFW_INCLUDE_GLU` makes the header include the GLU header *in addition to* the -OpenGL header. This should only be used with the default `GL/gl.h` header -(`OpenGL/gl.h` on OS X), i.e. if you are not using any of the above macros. - -`GLFW_DLL` is necessary when using the GLFW DLL on Windows, in order to explain -to the compiler that the GLFW functions will be coming from another executable. -It has no function on other platforms. - - -@section build_link Link with the right libraries - -@subsection build_link_win32 With MinGW or Visual C++ on Windows - -The static version of the GLFW library is named `glfw3`. When using this -version, it is also necessary to link with some libraries that GLFW uses. - -When linking a program under Windows that uses the static version of GLFW, you -must link with `opengl32`. On some versions of MinGW, you must also explicitly -link with `gdi32`, while other versions of MinGW include it in the set of -default libraries along with other dependencies like `user32` and `kernel32`. -If you are using GLU, you must also link with `glu32`. - -The link library for the GLFW DLL is named `glfw3dll`. When compiling a program -that uses the DLL version of GLFW, you need to define the `GLFW_DLL` macro -*before* any inclusion of the GLFW header. This can be done either with -a compiler switch or by defining it in your source code. - -A program using the GLFW DLL does not need to link against any of its -dependencies, but you still have to link against `opengl32` if your program uses -OpenGL and `glu32` if it uses GLU. - - -@subsection build_link_cmake_source With CMake and GLFW source - -You can use the GLFW source tree directly from a project that uses CMake. This -way, GLFW will be built along with your application as needed. - -Firstly, add the root directory of the GLFW source tree to your project. This -will add the `glfw` target and the necessary cache variables to your project. - - add_subdirectory(path/to/glfw) - -To be able to include the GLFW header from your code, you need to tell the -compiler where to find it. - - include_directories(path/to/glfw/include) - -Once GLFW has been added to the project, the `GLFW_LIBRARIES` cache variable -contains all link-time dependencies of GLFW as it is currently configured. To -link against GLFW, link against them and the `glfw` target. - - target_link_libraries(myapp glfw ${GLFW_LIBRARIES}) - -Note that `GLFW_LIBRARIES` does not include GLU, as GLFW does not use it. If -your application needs GLU, you can add it to the list of dependencies with the -`OPENGL_glu_LIBRARY` cache variable, which is implicitly created when the GLFW -CMake files look for OpenGL. - - target_link_libraries(myapp glfw ${OPENGL_glu_LIBRARY} ${GLFW_LIBRARIES}) - - -@subsection build_link_cmake_pkgconfig With CMake on Unix and installed GLFW binaries - -CMake can import settings from pkg-config, which GLFW supports. When you -installed GLFW, the pkg-config file `glfw3.pc` was installed along with it. - -First you need to find the PkgConfig package. If this fails, you may need to -install the pkg-config package for your distribution. - - find_package(PkgConfig REQUIRED) - -This creates the CMake commands to find pkg-config packages. Then you need to -find the GLFW package. - - pkg_search_module(GLFW REQUIRED glfw3) - -This creates the CMake variables you need to use GLFW. To be able to include -the GLFW header, you need to tell your compiler where it is. - - include_directories(${GLFW_INCLUDE_DIRS}) - -You also need to link against the correct libraries. If you are using the -shared library version of GLFW, use the `GLFW_LIBRARIES` variable. - - target_link_libraries(simple ${GLFW_LIBRARIES}) - - -If you are using the static library version of GLFW, use the -`GLFW_STATIC_LIBRARIES` variable instead. - - target_link_libraries(simple ${GLFW_STATIC_LIBRARIES}) - - -@subsection build_link_pkgconfig With pkg-config on OS X or other Unix - -GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/), -and the `glfw3.pc` file is generated when the GLFW library is built and installed -along with it. - -A typical compile and link command-line when using the static may look like this: - - cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3` - -If you are using the shared library, simply omit the `--static` flag. - - cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --libs glfw3` - -You can also use the `glfw3.pc` file without installing it first, by using the -`PKG_CONFIG_PATH` environment variable. - - env PKG_CONFIG_PATH=path/to/glfw/src cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3` - -The dependencies do not include GLU, as GLFW does not need it. On OS X, GLU is -built into the OpenGL framework, so if you need GLU you don't need to do -anything extra. If you need GLU and are using Linux or BSD, you should add -`-lGLU` to your link flags. - -See the manpage and other documentation for pkg-config and your compiler and -linker for more information on how to link programs. - - -@subsection build_link_xcode With Xcode on OS X - -If you are using the dynamic library version of GLFW, simply add it to the -project dependencies. - -If you are using the static library version of GLFW, add it and the Cocoa, -OpenGL, IOKit and CoreVideo frameworks to the project as dependencies. - - -@subsection build_link_osx With command-line on OS X - -If you do not wish to use pkg-config, you need to add the required frameworks -and libraries to your command-line using the `-l` and `-framework` switches, -i.e.: - - cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo - -Note that you do not add the `.framework` extension to a framework when adding -it from the command-line. - -The OpenGL framework contains both the OpenGL and GLU APIs, so there is nothing -special to do when using GLU. Also note that even though your machine may have -`libGL`-style OpenGL libraries, they are for use with the X Window System and -will *not* work with the OS X native version of GLFW. - -*/ diff --git a/extern/glfw/docs/compat.dox b/extern/glfw/docs/compat.dox deleted file mode 100644 index e14263f..0000000 --- a/extern/glfw/docs/compat.dox +++ /dev/null @@ -1,137 +0,0 @@ -/*! - -@page compat Standards conformance - -@tableofcontents - -This chapter describes the various API extensions used by this version of GLFW. -It lists what are essentially implementation details, but which are nonetheless -vital knowledge for developers wishing to deploy their applications on machines -with varied specifications. - -Note that the information in this appendix is not a part of the API -specification but merely list some of the preconditions for certain parts of the -API to function on a given machine. As such, any part of it may change in -future versions without this being considered a breaking API change. - -@section compat_wm ICCCM and EWMH conformance - -As GLFW uses Xlib, directly, without any intervening toolkit -library, it has sole responsibility for interacting well with the many and -varied window managers in use on Unix-like systems. In order for applications -and window managers to work well together, a number of standards and -conventions have been developed that regulate behavior outside the scope of the -X11 API; most importantly the -[Inter-Client Communication Conventions Manual](http://www.tronche.com/gui/x/icccm/) -(ICCCM) and -[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html) -(EWMH) standards. - -GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user -attempting to close the GLFW window. If the running window manager does not -support this protocol, the close callback will never be called. - -GLFW uses the EWMH `_NET_WM_PING` protocol, allowing the window manager notify -the user when the application has stopped responding, i.e. when it has ceased to -process events. If the running window manager does not support this protocol, -the user will not be notified if the application locks up. - -GLFW uses the EWMH `_NET_WM_STATE` protocol to tell the window manager to make -the GLFW window full screen. If the running window manager does not support this -protocol, full screen windows may not work properly. GLFW has a fallback code -path in case this protocol is unavailable, but every window manager behaves -slightly differently in this regard. - -GLFW uses the -[clipboard manager protocol](http://www.freedesktop.org/wiki/ClipboardManager/) -to push a clipboard string (i.e. selection) owned by a GLFW window about to be -destroyed to the clipboard manager. If there is no running clipboard manager, -the clipboard string will be unavailable once the window has been destroyed. - -@section compat_glx GLX extensions - -The GLX API is the default API used to create OpenGL contexts on Unix-like -systems using the X Window System. - -GLFW uses the `GLXFBConfig` API to enumerate and select framebuffer pixel -formats. This requires either GLX 1.3 or greater, or the `GLX_SGIX_fbconfig` -extension. Where both are available, the SGIX extension is preferred. If -neither is available, GLFW will be unable to create windows. - -GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and -`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization -(or "vsync"), in that order of preference. Where none of these extension are -available, calling @ref glfwSwapInterval will have no effect. - -GLFW uses the `GLX_ARB_multisample` extension to create contexts with -multisampling anti-aliasing. Where this extension is unavailable, the -`GLFW_SAMPLES` hint will have no effect. - -GLFW uses the `GLX_ARB_create_context` extension when available, even when -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 a non-zero value 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 zero, or setting `GLFW_CLIENT_API` to -anything but `GLFW_OPENGL_API` will cause @ref glfwCreateWindow to fail. - -@section compat_wgl WGL extensions - -The WGL API is used to create OpenGL contexts on Microsoft Windows and other -implementations of the Win32 API, such as Wine. - -GLFW uses either the `WGL_EXT_extension_string` or the -`WGL_ARB_extension_string` extension to check for the presence of all other WGL -extensions listed below. If both are available, the EXT one is preferred. If -neither is available, no other extensions are used and many GLFW features -related to context creation will have no effect or cause errors when used. - -GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace -synchronization (or 'vsync'). Where this extension is unavailable, calling @ref -glfwSwapInterval will have no effect. - -GLFW uses the `WGL_ARB_pixel_format` and `WGL_ARB_multisample` extensions to -create contexts with multisampling anti-aliasing. Where these extensions are -unavailable, the `GLFW_SAMPLES` hint will have no effect. - -GLFW uses the `WGL_ARB_create_context` extension when available, even when -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 a non-zero value will cause @ref -glfwCreateWindow to fail. - -GLFW uses the `WGL_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 zero will cause @ref glfwCreateWindow -to fail. - -@section compat_osx OpenGL 3.2 and later on OS X - -Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then -only forward-compatible, core profile contexts are supported. Support for -OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible, -core profile contexts. There is also still no mechanism for requesting debug -contexts. Versions of Mac OS X earlier than 10.7 support at most OpenGL -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 -non-zero 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. - -Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and -`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, -setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to -a non-default value will cause @ref glfwCreateWindow to fail and the -`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored. - -*/ diff --git a/extern/glfw/docs/compile.dox b/extern/glfw/docs/compile.dox deleted file mode 100644 index ef6c3b9..0000000 --- a/extern/glfw/docs/compile.dox +++ /dev/null @@ -1,261 +0,0 @@ -/*! - -@page compile Compiling GLFW - -@tableofcontents - -This is about compiling the GLFW library itself. For information on how to -build programs that use GLFW, see the @ref build guide. - - -@section compile_deps Dependencies - -To compile GLFW and the accompanying example programs, you will need **CMake**, -which will generate the project files or makefiles for your particular -development environment. If you are on a Unix-like system such as Linux or -FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you -can simply install its CMake package. If not, you can get installers for -Windows and OS X from the [CMake website](http://www.cmake.org/). - -Additional dependencies are listed below. - -If you wish to compile GLFW without CMake, see @ref compile_manual. - - -@subsection compile_deps_msvc Dependencies using Visual C++ on Windows - -The Microsoft Platform SDK that is installed along with Visual C++ contains all -the necessary headers, link libraries and tools except for CMake. - - -@subsection compile_deps_mingw Dependencies with MinGW or MinGW-w64 on Windows - -Both the MinGW and the MinGW-w64 packages contain all the necessary headers, -link libraries and tools except for CMake. - - -@subsection compile_deps_mingw_cross Dependencies using MinGW or MinGW-w64 cross-compilation - -Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For -example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages -for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives -like Ubuntu have the `mingw-w64` package for both. - -GLFW has CMake toolchain files in the `CMake/` directory that allow for easy -cross-compilation of Windows binaries. To use these files you need to add a -special parameter when generating the project files or makefiles: - - cmake -DCMAKE_TOOLCHAIN_FILE= . - -The exact toolchain file to use depends on the prefix used by the MinGW or -MinGW-w64 binaries on your system. You can usually see this in the /usr -directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages -have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct -invocation would be: - - cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake . - -For more details see the article -[CMake Cross Compiling](http://www.paraview.org/Wiki/CMake_Cross_Compiling) on -the CMake wiki. - - -@subsection compile_deps_xcode Dependencies using Xcode on OS X - -Xcode contains all necessary tools except for CMake. The necessary headers and -libraries are included in the core OS frameworks. Xcode can be downloaded from -the Mac App Store or from the ADC Member Center. - - -@subsection compile_deps_x11 Dependencies using Linux and X11 - -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` and `libglu1-mesa-dev` packages. The former pulls in -all X.org header packages and the latter pulls in the Mesa OpenGL and GLU -packages. GLFW itself doesn't need or use GLU, but some of the examples do. -Note that using header files and libraries from Mesa during compilation *will -not* tie your binaries to the Mesa implementation of OpenGL. - - -@section compile_cmake Generating files with CMake - -Once you have all necessary dependencies it is time to generate the project -files or makefiles for your development environment. CMake needs to know two -paths for this: the path to the *root* directory of the GLFW source tree (i.e. -*not* the `src` subdirectory) and the target path for the generated files and -compiled binaries. If these are the same, it is called an in-tree build, -otherwise it is called an out-of-tree build. - -One of several advantages of out-of-tree builds is that you can generate files -and compile for different development environments using a single source tree. - - -@subsection compile_cmake_cli Generating files with the CMake command-line tool - -To make an in-tree build, enter the *root* directory of the GLFW source tree -(i.e. *not* the `src` subdirectory) and run CMake. The current directory is -used as target path, while the path provided as an argument is used to find the -source tree. - - cd - cmake . - -To make an out-of-tree build, make another directory, enter it and run CMake -with the (relative or absolute) path to the root of the source tree as an -argument. - - cd - mkdir build - cd build - cmake .. - - -@subsection compile_cmake_gui Generating files with the CMake GUI - -If you are using the GUI version, choose the root of the GLFW source tree as -source location and the same directory or another, empty directory as the -destination for binaries. Choose *Configure*, change any options you wish to, -*Configure* again to let the changes take effect and then *Generate*. - - -@section compile_options CMake options - -The CMake files for GLFW provide a number of options, although not all are -available on all supported platforms. Some of these are de facto standards -among CMake users and so have no `GLFW_` prefix. - -If you are using the GUI version of CMake, these are listed and can be changed -from there. If you are using the command-line version, use the `ccmake` tool. -Some package systems like Ubuntu and other distributions based on Debian -GNU/Linux have this tool in a separate `cmake-curses-gui` package. - - -@subsection compile_options_shared Shared CMake options - -`BUILD_SHARED_LIBS` determines whether GLFW is built as a static -library or as a DLL / shared library / dynamic library. - -`LIB_SUFFIX` affects where the GLFW shared /dynamic library is installed. If it -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. - -`GLFW_BUILD_TESTS` determines whether the GLFW test programs are -built along with the library. - -`GLFW_BUILD_DOCS` determines whether the GLFW documentation is built along with -the library. - - -@subsection compile_options_osx OS X specific CMake options - -`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current -directory of bundled applications to the `Contents/Resources` directory. - -`GLFW_USE_MENUBAR` determines whether the first call to -`glfwCreateWindow` sets up a minimal menu bar. - -`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries. - - -@subsection compile_options_win32 Windows specific CMake options - -`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the -static library version of the Visual C++ runtime library. If set to `ON`, the -DLL version of the Visual C++ library is used. It is recommended to set this to -`ON`, as this keeps the executable smaller and benefits from security and bug -fix updates of the Visual C++ runtime. - -`GLFW_USE_DWM_SWAP_INTERVAL` determines whether the swap interval is set even -when DWM compositing is enabled. If this is `ON`, the swap interval is set even -if DWM is enabled. It is recommended to set this to `OFF`, as doing otherwise -can lead to severe jitter. - -`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement` -symbol, which forces the use of the high-performance GPU on nVidia Optimus -systems. - - -@subsection compile_options_egl EGL specific CMake options - -`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific -context creation API. Note that EGL is not yet provided on all supported -platforms. - - -@section compile_manual Compiling GLFW manually - -If you wish to compile GLFW without its CMake build environment then you will -have to do at least some of the platform detection yourself. GLFW needs -a number of configuration macros to be defined in order to know what it's being -compiled for and has many optional, platform-specific ones for various features. - -When building with CMake, the `glfw_config.h` configuration header is generated -based on the current platform and CMake options. The GLFW CMake environment -defines `_GLFW_USE_CONFIG_H`, which causes this header to be included by -`internal.h`. Without this macro, GLFW will expect the necessary configuration -macros to be defined on the command-line. - -Three macros *must* be defined when compiling GLFW: one for selecting the window -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: - - - `_GLFW_COCOA` to use the Cocoa frameworks - - `_GLFW_WIN32` to use the Win32 API - - `_GLFW_X11` to use the X Window System - -The context creation API is used to enumerate pixel formats / framebuffer -configurations and to create contexts. The options are: - - - `_GLFW_NSGL` to use the Cocoa OpenGL framework - - `_GLFW_WGL` to use the Win32 WGL API - - `_GLFW_GLX` to use the X11 GLX API - - `_GLFW_EGL` to use the EGL API (experimental) - -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. - -If you are using the X11 window creation API then you *must* also select an entry -point retrieval mechanism. - - - `_GLFW_HAS_GLXGETPROCADDRESS` to use `glXGetProcAddress` (recommended) - - `_GLFW_HAS_GLXGETPROCADDRESSARB` to use `glXGetProcAddressARB` (legacy) - - `_GLFW_HAS_GLXGETPROCADDRESSEXT` to use `glXGetProcAddressEXT` (legacy) - - `_GLFW_HAS_DLOPEN` to do manual retrieval with `dlopen` (fallback) - -If you are using the Cocoa window creation API, the following options are -available: - - - `_GLFW_USE_CHDIR` to `chdir` to the `Resources` subdirectory of the - application bundle during @ref glfwInit (recommended) - - `_GLFW_USE_MENUBAR` to create and populate the menu bar when the first window - is created (recommended) - -*/ diff --git a/extern/glfw/docs/context.dox b/extern/glfw/docs/context.dox deleted file mode 100644 index 8057cc7..0000000 --- a/extern/glfw/docs/context.dox +++ /dev/null @@ -1,174 +0,0 @@ -/*! - -@page context Context handling guide - -@tableofcontents - -The primary purpose of GLFW is to provide a simple interface to window -management and OpenGL and OpenGL ES context creation. GLFW supports -multiple windows, each of which has its own context. - - -@section context_object Context handles - -The @ref GLFWwindow object encapsulates both a window and a context. They are -created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow (or -@ref glfwTerminate, if any remain). As the window and context are inseparably -linked, the object pointer is used as both a context and window handle. - - -@section context_hints Context creation hints - -There are a number of hints, specified using @ref glfwWindowHint, related to -what kind of context is created. See -[context related hints](@ref window_hints_ctx) in the window handling guide. - - -@section context_sharing Context object sharing - -When creating a window and context with @ref glfwCreateWindow, you can specify -another window whose context the new one should share its objects with. OpenGL -object sharing is implemented by the operating system and graphics driver and is -described in the OpenGL documentation. On platforms where it is possible to -choose which types of objects are shared, GLFW requests that all are shared. - - -@section context_current Current context - -Before you can use the OpenGL or OpenGL ES APIs, you need to have a current -context of the proper type. The context encapsulates all render state and all -objects like textures and shaders. - -Note that a context can only be current for a single thread at a time, and -a thread can only have a single context at a time. - -A context is made current with @ref glfwMakeContextCurrent. - -@code -glfwMakeContextCurrent(window); -@endcode - -The current context is returned by @ref glfwGetCurrentContext. - -@code -GLFWwindow* window = glfwGetCurrentContext(); -@endcode - - -@section context_swap Swapping buffers - -See [swapping buffers](@ref window_swap) in the window handling guide. - - -@section context_glext OpenGL extension handling - -One of the benefits of OpenGL is its extensibility. Independent hardware -vendors (IHVs) may include functionality in their OpenGL implementations that -expand upon the OpenGL standard before that functionality is included in a new -version of the OpenGL specification. - -An extension is defined by: - -- An extension name (e.g. `GL_ARB_debug_output`) -- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`) -- New OpenGL functions (e.g. `glGetDebugMessageLogARB`) - -Note the `ARB` affix, which stands for Architecture Review Board and is used -for official extensions. There are many different affixes, depending on who -wrote the extension. A list of extensions, together with their specifications, -can be found at the [OpenGL Registry](http://www.opengl.org/registry/). - -To use a certain extension, you must first check whether the context supports -that extension and then, if it introduces new functions, retrieve the pointers -to those functions. - -This can be done with GLFW, as will be described in this section, but usually -you will instead want to use a dedicated extension loading library such as -[GLEW](http://glew.sourceforge.net/). This kind of library greatly reduces the -amount of work necessary to use both OpenGL extensions and modern versions of -the OpenGL API. GLEW in particular has been extensively tested with and works -well with GLFW. - - -@subsection context_glext_header The glext.h header - -The `glext.h` header is a continually updated file that defines the interfaces -for all OpenGL extensions. The latest version of this can always be found at -the [OpenGL Registry](http://www.opengl.org/registry/). It it strongly -recommended that you use your own copy, as the one shipped with your development -environment may be several years out of date and may not include the extensions -you wish to use. - -The header defines function pointer types for all functions of all extensions it -supports. These have names like `PFNGLGETDEBUGMESSAGELOGARB` (for -`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` and `PROC` -are added to the ends. - - -@subsection context_glext_string Checking for extensions - -A given machine may not actually support the extension (it may have older -drivers or a graphics card that lacks the necessary hardware features), so it -is necessary to check whether the context supports the extension. This is done -with @ref glfwExtensionSupported. - -@code -if (glfwExtensionSupported("GL_ARB_debug_output")) -{ - // The extension is supported by the current context -} -@endcode - -The argument is a null terminated ASCII string with the extension name. If the -extension is supported, @ref glfwExtensionSupported returns non-zero, otherwise -it returns zero. - - -@subsection context_glext_proc Fetching function pointers - -Many extensions, though not all, require the use of new OpenGL functions. -These entry points are often not exposed by your link libraries, making -it necessary to fetch them at run time. With @ref glfwGetProcAddress you can -retrieve the address of extension and non-extension OpenGL functions. - -@code -PFNGLGETDEBUGMESSAGELOGARB pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB"); -@endcode - -In general, you should avoid giving the function pointer variables the (exact) -same name as the function, as this may confuse your linker. Instead, you can -use a different prefix, like above, or some other naming scheme. - -Now that all the pieces have been introduced, here is what they might look like -when used together. - -@code -#include "glext.h" - -#define glGetDebugMessageLogARB pfnGetDebugMessageLog -PFNGLGETDEBUGMESSAGELOGARB pfnGetDebugMessageLog; - -// Flag indicating whether the extension is supported -int has_debug_output = 0; - -void load_extensions(void) -{ - if (glfwExtensionSupported("GL_ARB_debug_output")) - { - pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARB) glfwGetProcAddress("glGetDebugMessageLogARB"); - if (pfnGetDebugMessageLog) - { - // Both the extension name and the function pointer are present - has_debug_output = 1; - } - } -} - -void some_function(void) -{ - // Now the extension function can be called as usual - glGetDebugMessageLogARB(...); -} -@endcode - -*/ diff --git a/extern/glfw/docs/extra.css b/extern/glfw/docs/extra.css deleted file mode 100644 index 639c4e7..0000000 --- a/extern/glfw/docs/extra.css +++ /dev/null @@ -1,312 +0,0 @@ -html { - background-color:hsl(0,0%,95%); -} - -.glfwheader { - font-size:16px; - height:64px; - max-width:920px; - margin:0em auto; -} - -.glfwheader a#glfwhome { - line-height:64px; - padding-right:48px; - float:left; - color:hsl(0,0%,40%); - font-size:2.5em; - background-image:url("http://www.glfw.org/css/arrow.png"); - background-position:right top; - background-repeat:no-repeat; -} - -.glfwnavbar { - list-style-type:none; - margin-top:0px; - float:right; -} - -.glfwnavbar li { - float:left; -} - -.glfwnavbar a,.glfwnavbar a:visited { - line-height:64px; - margin-left:2em; - display:block; - color:hsl(0,0%,40%); -} - -.glfwheader a#glfwhome,.glfwnavbar a,.glfwnavbar a:visited { - transition:all 0.35s ease 0s; -} - -#titlearea,address.footer { - color:hsl(0,0%,40%); - background-color:hsl(0,0%,95%); - border-bottom:none; -} - -address.footer { - text-align:center; - padding:2em; -} - -div#top { - background-color:hsl(0,0%,40%); -} - -div#navrow1,div#navrow2,div#navrow3,div#navrow4 { - background-color:hsl(0,0%,40%); - background-image:none; - max-width:920px; - margin:0em auto; -} - -ul.tablist { - min-width:700px; -} - -.tablist a,.tablist a:hover,.tablist li,.tablist li.current a { - background-image:none; - text-shadow:none; -} - -.tablist a,.tablist a:visited { - color:hsl(0,0%,95%); - text-shadow:none; -} - -.tablist li.current a { - background:linear-gradient(to bottom,hsl(34,100%,60%) 0%,hsl(24,100%,50%) 100%); - box-shadow:inset 0px 0px 32px hsl(24,100%,50%); - text-shadow:0px -1px 1px hsl(24,100%,35%); - color:hsl(0,0%,100%); -} - -div.contents { - min-height:590px; -} - -div.contents,div.header { - max-width:920px; - margin:0em auto; - padding:0em 2em 2em 2em; - background-color:hsl(0,0%,100%); -} - -div.header { - background-image:none; - border-bottom:none; -} - -table.doxtable th,dl.reflist dt,div.levels { - background:linear-gradient(to bottom,hsl(34,100%,60%) 0%,hsl(24,100%,50%) 100%); - box-shadow:inset 0px 0px 32px hsl(24,100%,50%); - text-shadow:0px -1px 1px hsl(24,100%,35%); - color:hsl(0,0%,100%); -} - -dl.reflist dt a.el,div.levels span { - color:hsl(24,100%,50%); - padding:0.2em; - border-radius:4px; - background-color:hsl(24,100%,90%); - text-shadow:none; -} - -div.memproto,div.qindex,div.ah { - background:linear-gradient(to bottom,hsl(34,0%,95%) 0%,hsl(24,0%,90%) 100%); - box-shadow:inset 0px 0px 32px hsl(24,0%,90%); - text-shadow:0px 1px 1px hsl(24,0%,100%); - color:hsl(0,0%,10%); -} - -div.memproto a { - color:hsl(24,100%,50%); -} - -div.memproto td.paramname { - text-shadow:0px 1px 1px hsl(24,0%,100%); -} - -div.memproto,div.qindex,div.ah { - border:2px solid hsl(24,0%,90%); - border-radius:4px; -} - -div.memdoc { - background:none; - box-shadow:none; - border:none; -} - -td.paramname { - color:hsl(24,100%,25%); -} - -dl.reflist dt { - border:2px solid hsl(24,100%,50%); - border-top-left-radius:4px; - border-top-right-radius:4px; - border-bottom:none; -} - -dl.reflist dd { - border:2px solid hsl(24,100%,50%); - border-bottom-right-radius:4px; - border-bottom-left-radius:4px; - border-top:none; - background:none; - box-shadow:none; -} - -table.doxtable { - border-collapse:inherit; - border-spacing:0px; - border:2px solid hsl(24,100%,50%); - border-radius:4px; -} - -table.doxtable td,table.doxtable th { - border:none; -} - -tr.even,.directory tr.even,table.doxtable tr:nth-child(even) { - background-color:hsl(0,0%,95%); -} - -body { - color:hsl(0,0%,30%); -} - -h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em { - color:hsl(0,0%,10%); - border-bottom:none; -} - -a,a:hover,a:visited,a:visited:hover,a.el,a.el:visited,.glfwheader a#glfwhome:hover,.tablist a:hover { - color:hsl(24,100%,50%); - text-decoration:none; -} - -.mdescLeft,.mdescRight,.memItemLeft,.memItemRight { - background-color:hsl(0,0%,95%); -} - -div.directory { - border-collapse:inherit; - border-spacing:0px; - border:2px solid hsl(24,100%,50%); - border-radius:4px; -} - -.directory .levels span { - color:hsl(24,100%,50%); - padding:0.1em 0.5em; - margin:auto 0.25em; - border-radius:2px; - background-color:hsl(24,100%,90%); - text-shadow:none; -} - -td.memSeparator { - height:2px; - border:0px; - background:linear-gradient(to right,hsl(0,0%,95%) 0%,hsl(0,0%,85%) 50%,hsl(0,0%,95%) 100%); -} - -dl.note,dl.pre,dl.post,dl.invariant { - background:linear-gradient(to bottom,hsl(103,80%,90%) 0%,hsl(103,80%,85%) 100%); - box-shadow:inset 0px 0px 32px hsl(103,40%,80%); - color:hsl(103,80%,10%); - border:2px solid hsl(103,40%,75%); -} - -dl.warning,dl.attention { - background:linear-gradient(to bottom,hsl(34,80%,90%) 0%,hsl(34,80%,85%) 100%); - box-shadow:inset 0px 0px 32px hsl(34,40%,80%); - color:hsl(34,80%,10%); - border:2px solid hsl(34,40%,75%); -} - -dl.deprecated,dl.bug { - background:linear-gradient(to bottom,hsl(333,80%,90%) 0%,hsl(333,80%,85%) 100%); - box-shadow:inset 0px 0px 32px hsl(333,40%,80%); - color:hsl(333,80%,10%); - border:2px solid hsl(333,40%,75%); -} - -dl.todo,dl.test { - background:linear-gradient(to bottom,hsl(200,80%,90%) 0%,hsl(200,80%,85%) 100%); - box-shadow:inset 0px 0px 32px hsl(200,40%,80%); - color:hsl(200,80%,10%); - border:2px solid hsl(200,40%,75%); -} - -dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test { - border-radius:4px; - padding:1em; - text-shadow:0px 1px 1px hsl(0,0%,100%); -} - -div.toc { - background:linear-gradient(to bottom,hsl(34,0%,95%) 0%,hsl(24,0%,90%) 100%); - box-shadow:inset 0px 0px 32px hsl(24,0%,90%); - text-shadow:0px 1px 1px hsl(24,0%,100%); - color:hsl(0,0%,10%); - border:2px solid hsl(24,0%,90%); - border-radius:4px; - float:none; - width:auto; -} - -div.toc h3 { - font-size:1.17em; -} - -div.toc ul { - padding-left:1.5em; -} - -div.toc li { - background:none; - font-size:1em; - padding-left:0em; - list-style-type:disc; -} - -div.ah { - background-image:none; -} - -div.fragment,pre.fragment { - background-color:hsl(0,0%,20%); - border-radius:4px; - border-width:0px; - padding:0.5em 2em; - overflow:auto; - border-left:4px solid hsl(0,0%,80%); -} - -div.line,pre.fragment { - color:hsl(60,30%,96%); -} - -a.code,a.code:visited,span.preprocessor,span.comment { - color:hsl(80,76%,53%); -} - -span.keyword,span.keywordtype,span.keywordflow { - color:hsl(190,81%,67%); -} - -span.stringliteral { - color:hsl(54,70%,68%); -} - -code { - background-color:hsl(0,0%,95%); - padding:0.1em; - border-radius: 4px; -} diff --git a/extern/glfw/docs/footer.html b/extern/glfw/docs/footer.html deleted file mode 100644 index b0434ca..0000000 --- a/extern/glfw/docs/footer.html +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/extern/glfw/docs/header.html b/extern/glfw/docs/header.html deleted file mode 100644 index 9759d8b..0000000 --- a/extern/glfw/docs/header.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - -$projectname: $title -$title - - - -$treeview -$search -$mathjax - -$extrastylesheet - - -
- - - - - diff --git a/extern/glfw/docs/internal.dox b/extern/glfw/docs/internal.dox deleted file mode 100644 index a2653fe..0000000 --- a/extern/glfw/docs/internal.dox +++ /dev/null @@ -1,116 +0,0 @@ -/*! - -@page internals Internal structure - -@tableofcontents - -There are several interfaces inside GLFW. Each interface has its own area of -responsibility and its own naming conventions. - - -@section internals_public Public interface - -The most well-known is the public interface, described in the glfw3.h header -file. This is implemented in source files shared by all platforms and these -files contain no platform-specific code. This code usually ends up calling the -platform and internal interfaces to do the actual work. - -The public interface uses the OpenGL naming conventions except with GLFW and -glfw instead of GL and gl. For struct members, where OpenGL sets no precedent, -it use headless camel case. - -Examples: @ref glfwCreateWindow, @ref GLFWwindow, @ref GLFWvidmode.redBits, -`GLFW_RED_BITS` - - -@section internals_native Native interface - -The [native interface](@ref native) is a small set of publicly available -but platform-specific functions, described in the glfw3native.h header file and -used to gain access to the underlying window, context and (on some platforms) -display handles used by the platform interface. - -The function names of the native interface are similar to those of the public -interface, but embeds the name of the interface that the returned handle is -from. - -Examples: @ref glfwGetX11Window, @ref glfwGetWGLContext - - -@section internals_internal Internal interface - -The internal interface consists of utility functions used by all other -interfaces. It is shared code implemented in the same shared source files as -the public and event interfaces. The internal interface is described in the -internal.h header file. - -The internal interface is in charge of GLFW's global data, which it stores in -a `_GLFWlibrary` struct named `_glfw`. - -The internal interface uses the same style as the public interface, except all -global names have a leading underscore. - -Examples: @ref _glfwIsValidContextConfig, @ref _GLFWwindow, `_glfw.currentRamp` - - -@section internals_platform Platform interface - -The platform interface implements all platform-specific operations as a service -to the public interface. This includes event processing. The platform -interface is never directly called by users of GLFW and never directly calls the -user's code. It is also prohibited from modifying the platform-independent part -of the internal structs. Instead, it calls the event interface when events -interesting to GLFW are received. - -The platform interface mirrors those parts of the public interface that needs to -perform platform-specific operations on some or all platforms. The are also -named the same except that the glfw function prefix is replaced by -_glfwPlatform. - -Examples: @ref _glfwPlatformCreateWindow - -The platform interface also defines structs that contain platform-specific -global and per-object state. Their names mirror those of the internal -interface, except that an interface-specific suffix is added. - -Examples: `_GLFWwindowX11`, `_GLFWcontextWGL` - -These structs are incorporated as members into the internal interface structs -using special macros that name them after the specific interface used. This -prevents shared code from accidentally using these members. - -Examples: `window.win32.handle`, `_glfw.x11.display` - - -@section internals_event Event interface - -The event interface is implemented in the same shared source files as the public -interface and is responsible for delivering the events it receives to the user, -either via callbacks, via window state changes or both. - -The function names of the event interface use a `_glfwInput` prefix and the -ObjectEvent pattern. - -Examples: @ref _glfwInputWindowFocus, @ref _glfwInputCursorMotion - - -@section internals_static Static functions - -Static functions may be used by any interface and have no prefixes or suffixes. -These use headless camel case. - -Examples: `clearScrollOffsets` - - -@section internals_config Configuration macros - -GLFW uses a number of configuration macros to select at compile time which -interfaces and code paths to use. They are defined in the glfw_config.h header file, -which is generated from the `glfw_config.h.in` file by CMake. - -Configuration macros the same style as tokens in the public interface, except -with a leading underscore. - -Examples: `_GLFW_HAS_GLXGETPROCADDRESS` - -*/ diff --git a/extern/glfw/docs/main.dox b/extern/glfw/docs/main.dox deleted file mode 100644 index 1898079..0000000 --- a/extern/glfw/docs/main.dox +++ /dev/null @@ -1,22 +0,0 @@ -/*! - -@mainpage notitle - -@section main_intro Introduction - -GLFW is a free, Open Source, multi-platform library for opening a window, -creating an OpenGL context and managing input. It is easy to integrate into -existing applications and does not lay claim to the main loop. - -This is the documentation for version 3.0, which has [many new features](@ref news). - -There is a [quick tutorial](@ref quick) for people new to GLFW, which shows how -to write a small but complete program, and guides for -[compiling GLFW](@ref compile) and -[building programs that use GLFW](@ref build). - -If you have used GLFW 2.x in the past, there is a -[transition guide](@ref moving) that explains what has changed and how to update -existing code to use the new API. - -*/ diff --git a/extern/glfw/docs/monitor.dox b/extern/glfw/docs/monitor.dox deleted file mode 100644 index a3ada5a..0000000 --- a/extern/glfw/docs/monitor.dox +++ /dev/null @@ -1,105 +0,0 @@ -/*! - -@page monitor Multi-monitor guide - -@tableofcontents - - -@section monitor_objects Monitor objects - -The @ref GLFWmonitor object represents a currently connected monitor. - - -@section monitor_monitors Retrieving monitors - -The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is usually -the user's preferred monitor and the one with global UI elements like task bar -or menu bar. - -@code -GLFWmonitor* primary = glfwGetPrimaryMonitor(); -@endcode - -You can retrieve all currently connected monitors with @ref glfwGetMonitors. - -@code -int count; -GLFWmonitor** monitors = glfwGetMonitors(&count); -@endcode - - -@section monitor_modes Retrieving video modes - -Although GLFW generally does a good job at selecting a suitable video -mode for you when you open a full screen window, it is sometimes useful to -know exactly which modes are available on a certain system. For example, -you may want to present the user with a list of video modes to select -from. To get a list of available video modes, you can use the function -@ref glfwGetVideoModes. - -@code -int count; -GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); -@endcode - -To get the current video mode of a monitor call @ref glfwGetVideoMode. - -@code -const GLFWvidmode* mode = glfwGetVideoMode(monitor); -@endcode - - -@section monitor_size Monitor physical size - -The physical size in millimetres of a monitor, or an approximation of it, can be -retrieved with @ref glfwGetMonitorPhysicalSize. - -@code -int widthMM, heightMM; -glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM); -@endcode - -This can, for example, be used together with the current video mode to calculate -the DPI of a monitor. - -@code -const double dpi = mode->width / (widthMM / 25.4); -@endcode - - -@section monitor_name Monitor name - -The name of a monitor is returned by @ref glfwGetMonitorName. - -@code -const char* name = glfwGetMonitorName(monitor); -@endcode - -The monitor name is a regular C string using the UTF-8 encoding. Note that -monitor names are not guaranteed to be unique. - - -@section monitor_gamma Monitor gamma ramp - -The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts -a monitor handle and a pointer to a @ref GLFWgammaramp structure. - -@code -glfwSetGammaRamp(monitor, &ramp); -@endcode - -The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp. - -@code -const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor); -@endcode - -If you wish to set a regular gamma ramp, you can have GLFW calculate it for you -from the desired exponent with @ref glfwSetGamma, which in turn calls @ref -glfwSetGammaRamp with the resulting ramp. - -@code -glfwSetGamma(monitor, 1.0); -@endcode - -*/ diff --git a/extern/glfw/docs/moving.dox b/extern/glfw/docs/moving.dox deleted file mode 100644 index 8d5c2e8..0000000 --- a/extern/glfw/docs/moving.dox +++ /dev/null @@ -1,327 +0,0 @@ -/*! - -@page moving Moving from GLFW 2 to 3 - -@tableofcontents - -This is a transition guide for moving from GLFW 2 to 3. It describes what has -changed or been removed, but does *not* include -[new features](@ref news) unless they are required when moving an existing code -base onto the new API. For example, use of the new multi-monitor functions are -required to create full screen windows with GLFW 3. - - -@section moving_removed Removed features - -@subsection moving_threads Threading functions - -The threading functions have been removed, including the sleep function. They -were fairly primitive, under-used, poorly integrated and took time away from the -focus of GLFW (i.e. context, input and window). There are better threading -libraries available and native threading support is available in both C++11 and -C11, both of which are gaining traction. - -If you wish to use the C++11 or C11 facilities but your compiler doesn't yet -support them, see the -[TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and -[TinyCThread](https://gitorious.org/tinythread/tinycthread) projects created by -the original author of GLFW. These libraries implement a usable subset of the -threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use -TinyCThread. - -However, GLFW 3 has better support for *use from multiple threads* than GLFW -2 had. Contexts can be made current on and rendered with from secondary -threads, and the documentation explicitly states which functions may be used -from secondary threads and which may only be used from the main thread, i.e. the -thread that calls main. - - -@subsection moving_image Image and texture loading - -The image and texture loading functions have been removed. They only supported -the Targa image format, making them mostly useful for beginner level examples. -To become of sufficiently high quality to warrant keeping them in GLFW 3, they -would need not only to support other formats, but also modern extensions to the -OpenGL texturing facilities. This would either add a number of external -dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions -of these libraries. - -As there already are libraries doing this, it seems unnecessary both to -duplicate this work and to tie this duplicate to GLFW. Projects similar to -GLFW, such as freeglut, could also gain from such a library. Also, would be no -platform-specific part of such a library, as both OpenGL and stdio are available -wherever GLFW is. - - -@subsection moving_char_up Character actions - -The action parameter of the [character callback](@ref GLFWcharfun) has been -removed. This was an artefact of the origin of GLFW, i.e. being developed in -English by a Swede. However, many keyboard layouts require more than one key to -produce characters with diacritical marks. Even the Swedish keyboard layout -requires this for uncommon cases like ü. - -Note that this is only the removal of the *action parameter* of the character -callback, *not* the removal of the character callback itself. - - -@subsection moving_wheel Mouse wheel position - -The `glfwGetMouseWheel` function has been removed. Scroll events do not -represent an absolute state, but is instead an interpretation of a relative -change in state, like character input. So, like character input, there is no -sane 'current state' to return. The mouse wheel callback has been replaced by -a [scroll callback](@ref GLFWscrollfun) that receives two-dimensional scroll -offsets. - - -@subsection moving_stdcall GLFWCALL macro - -The `GLFWCALL` macro, which made callback functions use -[__stdcall](http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows, -has been removed. GLFW is written in C, not Pascal. Removing this macro means -there's one less thing for users of GLFW to remember, i.e. the requirement to -mark all callback functions with `GLFWCALL`. It also simplifies the creation of -DLLs and DLL link libraries, as there's no need to explicitly disable `@n` entry -point suffixes. - - -@subsection moving_mbcs Win32 MBCS support - -The Win32 port of GLFW 3 will not compile in -[MBCS mode](http://msdn.microsoft.com/en-us/library/5z097dxa.aspx). -However, because the use of the Unicode version of the Win32 API doesn't affect -the process as a whole, but only those windows created using it, it's perfectly -possible to call MBCS functions from other parts of the same application. -Therefore, even if an application using GLFW has MBCS mode code, there's no need -for GLFW itself to support it. - - -@subsection moving_windows Support for versions of Windows older than XP - -All explicit support for version of Windows older than XP has been removed. -There is no code that actively prevents GLFW 3 from running on these earlier -versions, but it uses Win32 functions that those versions lack. - -Windows XP was released in 2001, and by now (2013) it has not only -replaced almost all earlier versions of Windows, but is itself rapidly being -replaced by Windows 7 and 8. The MSDN library doesn't even provide -documentation for version older than Windows 2000, making it difficult to -maintain compatibility with these versions even if it was deemed worth the -effort. - -The Win32 API has also not stood still, and GLFW 3 uses many functions only -present on Windows XP or later. Even supporting an OS as new as XP (new -from the perspective of GLFW 2, which still supports Windows 95) requires -runtime checking for a number of functions that are present only on modern -version of Windows. - - -@subsection moving_syskeys Capture of system-wide hotkeys - -The ability to disable and capture system-wide hotkeys like Alt+Tab has been -removed. Modern applications, whether they're games, scientific visualisations -or something else, are nowadays expected to be good desktop citizens and allow -these hotkeys to function even when running in full screen mode. - - -@subsection moving_opened Window open parameter - -The `GLFW_OPENED` window parameter has been removed. As long as the -[window object](@ref window_object) is around, the window is "open". To detect -when the user attempts to close the window, see @ref glfwWindowShouldClose and -the [close callback](@ref GLFWwindowclosefun). - - -@subsection moving_autopoll Automatic polling of events - -GLFW 3 does not automatically poll for events on @ref glfwSwapBuffers, which -means you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself. -Unlike buffer swap, the event processing functions act on all windows at once. - - -@subsection moving_terminate Automatic termination - -GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization. To -properly release all resources allocated by GLFW, you should therefore call @ref -glfwTerminate yourself before exiting. - - -@subsection moving_glu GLU header inclusion - -GLFW 3 does not include the GLU header by default and GLU itself has been -deprecated, but you can request that the GLFW 3 header includes it by defining -`GLFW_INCLUDE_GLU` before the inclusion of the GLFW 3 header. - - -@section moving_changed Changes to existing features - -@subsection moving_window_handles Window handles - -Because GLFW 3 supports multiple windows, window handle parameters have been -added to all window-related GLFW functions and callbacks. The handle of -a newly created window is returned by @ref glfwCreateWindow (formerly -`glfwOpenWindow`). Window handles are of the `GLFWwindow*` type, i.e. a pointer -to an opaque struct. - - -@subsection moving_monitor Multi-monitor support - -GLFW 3 provides support for multiple monitors, adding the `GLFWmonitor*` handle -type and a set of related functions. To request a full screen mode window, -instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the -window to use. There is @ref glfwGetPrimaryMonitor that provides behaviour -similar to that of GLFW 2. - - -@subsection moving_window_close Window closing - -Window closing initiated by the user is now just an event like any other. -Unlike GLFW 2, windows and contexts created with GLFW 3 will not disappear from -underfoot. Each window now has a close flag, which is set when the user -attempts to close it. By default, nothing else happens and the window stays -open and visible. It is then up to you to either destroy the window, take some -other action or simply ignore the request. You can query the close flag at any -time with @ref glfwWindowShouldClose and set it at any time with @ref -glfwSetWindowShouldClose. - -The close callback no longer returns a value. Instead, it is called after the -close flag has been set so it can override its value, if it chooses to, before -event processing completes. You may however not call @ref glfwDestroyWindow -from the close callback (or any other window related callback). - -GLFW itself never clears the close flag, allowing you to set it for other -reasons for the window to close as well, for example the user choosing Quit from -the main menu. - - -@subsection moving_context Explicit context management - -Each GLFW 3 window has its own OpenGL context and only you, the user, can know -which context should be current on which thread at any given time. Therefore, -GLFW 3 makes no assumptions about when you want a certain context to be current, -leaving that decision to you. - -This means, among other things, that you need to call @ref -glfwMakeContextCurrent after creating a window before you can call any OpenGL -functions. - - -@subsection moving_repeat Key repeat - -The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled -for both keys and characters. A new key action, `GLFW_REPEAT`, has been added -to allow the [key callback](@ref GLFWkeyfun) to distinguish an initial key press -from a repeat. Note that @ref glfwGetKey still returns only `GLFW_PRESS` or -`GLFW_RELEASE`. - - -@subsection moving_keys Physical key input - -GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to -the values generated by the current keyboard layout. The tokens are named -according to the values they would have using the standard US layout, but this -is only a convenience, as most programmers are assumed to know that layout. -This means that (for example) `GLFW_KEY_LEFT_BRACKET` is always a single key and -is the same key in the same place regardless of what keyboard layouts the users -of your program has. - -The key input facility was never meant for text input, although using it that -way worked slightly better in GLFW 2. If you were using it to input text, you -should be using the character callback instead, on both GLFW 2 and 3. This will -give you the characters being input, as opposed to the keys being pressed. - -GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of -having to remember whether to check for `'a'` or `'A'`, you now check for -`GLFW_KEY_A`. - - -@subsection moving_joystick Joystick input - -The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes. - -The `glfwGetJoystickParam` function and the `GLFW_PRESENT`, `GLFW_AXES` and -`GLFW_BUTTONS` tokens have been replaced by the @ref glfwJoystickPresent -function as well as axis and button counts returned by the @ref -glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions. - - -@subsection moving_video_modes Video mode enumeration - -Video mode enumeration is now per-monitor. The @ref glfwGetVideoModes function -now returns all available modes for a specific monitor instead of requiring you -to guess how large an array you need. The `glfwGetDesktopMode` function, which -had poorly defined behavior, has been replaced by @ref glfwGetVideoMode, which -returns the current mode of a monitor. - - -@subsection moving_cursor Cursor positioning - -GLFW 3 only allows you to position the cursor within a window using @ref -glfwSetCursorPos (formerly `glfwSetMousePos`) when that window is active. -Unless the window is active, the function fails silently. - - -@subsection moving_hints Persistent window hints - -Window hints are no longer reset to their default values on window creation, but -instead retain their values until modified by @ref glfwWindowHint (formerly -`glfwOpenWindowHint`) or @ref glfwDefaultWindowHints, or until the library is -terminated and re-initialized. - - -@section moving_renamed Name changes - -@subsection moving_renamed_files Library and header file - -The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to -avoid collisions with the headers of other major versions. Similarly, the GLFW -3 library is named `glfw3,` except when it's installed as a shared library on -Unix-like systems, where it uses the -[soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`. - - -@subsection moving_renamed_functions Functions - -| GLFW 2 | GLFW 3 | Notes | -| --------------------------- | ----------------------------- | ----- | -| `glfwOpenWindow` | @ref glfwCreateWindow | All channel bit depths are now hints -| `glfwCloseWindow` | @ref glfwDestroyWindow | | -| `glfwOpenWindowHint` | @ref glfwWindowHint | Now accepts all `GLFW_*_BITS` tokens | -| `glfwEnable` | @ref glfwSetInputMode | | -| `glfwDisable` | @ref glfwSetInputMode | | -| `glfwGetMousePos` | @ref glfwGetCursorPos | | -| `glfwSetMousePos` | @ref glfwSetCursorPos | | -| `glfwSetMousePosCallback` | @ref glfwSetCursorPosCallback | | -| `glfwSetMouseWheelCallback` | @ref glfwSetScrollCallback | Accepts two-dimensional scroll offsets as doubles | -| `glfwGetJoystickPos` | @ref glfwGetJoystickAxes | | -| `glfwGetWindowParam` | @ref glfwGetWindowAttrib | | -| `glfwGetGLVersion` | @ref glfwGetWindowAttrib | Use `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and `GLFW_CONTEXT_REVISION` | -| `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor | -| `glfwGetJoystickParam` | @ref glfwJoystickPresent | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons | - -@subsection moving_renamed_tokens Tokens - -| GLFW 2 | GLFW 3 | Notes | -| --------------------------- | ---------------------------- | ----- | -| `GLFW_OPENGL_VERSION_MAJOR` | `GLFW_CONTEXT_VERSION_MAJOR` | Renamed as it applies to OpenGL ES as well | -| `GLFW_OPENGL_VERSION_MINOR` | `GLFW_CONTEXT_VERSION_MINOR` | Renamed as it applies to OpenGL ES as well | -| `GLFW_FSAA_SAMPLES` | `GLFW_SAMPLES` | Renamed to match the OpenGL API | -| `GLFW_ACTIVE` | `GLFW_FOCUSED` | Renamed to match the window focus callback | -| `GLFW_WINDOW_NO_RESIZE` | `GLFW_RESIZABLE` | The default has been inverted | -| `GLFW_MOUSE_CURSOR` | `GLFW_CURSOR` | Used with @ref glfwSetInputMode | -| `GLFW_KEY_ESC` | `GLFW_KEY_ESCAPE` | | -| `GLFW_KEY_DEL` | `GLFW_KEY_DELETE` | | -| `GLFW_KEY_PAGEUP` | `GLFW_KEY_PAGE_UP` | | -| `GLFW_KEY_PAGEDOWN` | `GLFW_KEY_PAGE_DOWN` | | -| `GLFW_KEY_KP_NUM_LOCK` | `GLFW_KEY_NUM_LOCK` | | -| `GLFW_KEY_LCTRL` | `GLFW_KEY_LEFT_CONTROL` | | -| `GLFW_KEY_LSHIFT` | `GLFW_KEY_LEFT_SHIFT` | | -| `GLFW_KEY_LALT` | `GLFW_KEY_LEFT_ALT` | | -| `GLFW_KEY_LSUPER` | `GLFW_KEY_LEFT_SUPER` | | -| `GLFW_KEY_RCTRL` | `GLFW_KEY_RIGHT_CONTROL` | | -| `GLFW_KEY_RSHIFT` | `GLFW_KEY_RIGHT_SHIFT` | | -| `GLFW_KEY_RALT` | `GLFW_KEY_RIGHT_ALT` | | -| `GLFW_KEY_RSUPER` | `GLFW_KEY_RIGHT_SUPER` | | - -*/ diff --git a/extern/glfw/docs/news.dox b/extern/glfw/docs/news.dox deleted file mode 100644 index bbce25f..0000000 --- a/extern/glfw/docs/news.dox +++ /dev/null @@ -1,173 +0,0 @@ -/*! - -@page news New features - -@tableofcontents - - -@section news_30 New features in version 3.0 - -@subsection news_30_cmake CMake build system - -GLFW now uses the CMake build system instead of the various makefiles and -project files used by earlier versions. CMake is available for all platforms -supported by GLFW, is present in most package systems and can generate -makefiles and/or project files for most popular development environments. - -For more information on how to use CMake, see the -[CMake manual](http://cmake.org/cmake/help/documentation.html). - - -@subsection news_30_multiwnd Multi-window support - -GLFW now supports the creation of multiple windows, each with their own OpenGL -or OpenGL ES context, and all window functions now take a window handle. Event -callbacks are now per-window and are provided with the handle of the window that -received the event. The @ref glfwMakeContextCurrent function has been added to -select which context is current on a given thread. - - -@subsection news_30_multimon Multi-monitor support - -GLFW now explicitly supports multiple monitors. They can be enumerated with -@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref -glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize, -and specified at window creation to make the newly created window full screen on -that specific monitor. - - -@subsection news_30_unicode Unicode support - -All string arguments to GLFW functions and all strings returned by GLFW now use -the UTF-8 encoding. This includes the window title, error string, clipboard -text, monitor and joystick names as well as the extension function arguments (as -ASCII is a subset of UTF-8). - - -@subsection news_30_clipboard Clipboard text I/O - -GLFW now supports reading and writing plain text to and from the system -clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString -functions. - - -@subsection news_30_gamma Gamma ramp support - -GLFW now supports setting and reading back the gamma ramp of monitors, with the -@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref -glfwSetGamma, which generates a ramp from a gamma value and then sets it. - - -@subsection news_30_gles OpenGL ES support - -GLFW now supports the creation of OpenGL ES contexts, by setting the -`GLFW_CLIENT_API` window hint to `GLFW_OPENGL_ES_API`, where creation of such -contexts are supported. Note that GLFW *does not implement* OpenGL ES, so your -driver must provide support in a way usable by GLFW. Modern nVidia and Intel -drivers support creation of OpenGL ES context using the GLX and WGL APIs, while -AMD provides an EGL implementation instead. - - -@subsection news_30_egl (Experimental) EGL support - -GLFW now has an experimental EGL context creation back end that can be selected -through CMake options. - - -@subsection news_30_hidpi High-DPI support - -GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full -resolution framebuffers where other UI elements are scaled up. To achieve this, -@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been -added. These work with pixels, while the rest of the GLFW API works with screen -coordinates. - - -@subsection news_30_error Error callback - -GLFW now has an error callback, which can provide your application with much -more detailed diagnostics than was previously possible. The callback is passed -an error code and a description string. - - -@subsection news_30_wndptr Per-window user pointer - -Each window now has a user-defined pointer, retrieved with @ref -glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it -easier to integrate GLFW into C++ code. - - -@subsection news_30_iconifyfun Window iconification callback - -Each window now has a callback for iconification and restoration events, -which is set with @ref glfwSetWindowIconifyCallback. - - -@subsection news_30_wndposfun Window position callback - -Each window now has a callback for position events, which is set with @ref -glfwSetWindowPosCallback. - - -@subsection news_30_wndpos Window position query - -The position of a window can now be retrieved using @ref glfwGetWindowPos. - - -@subsection news_30_focusfun Window focus callback - -Each windows now has a callback for focus events, which is set with @ref -glfwSetWindowFocusCallback. - - -@subsection news_30_enterleave Cursor enter/leave callback - -Each window now has a callback for when the mouse cursor enters or leaves its -client area, which is set with @ref glfwSetCursorEnterCallback. - - -@subsection news_30_wndtitle Initial window title - -The title of a window is now specified at creation time, as one of the arguments -to @ref glfwCreateWindow. - - -@subsection news_30_hidden Hidden windows - -Windows can now be hidden with @ref glfwHideWindow, shown using @ref -glfwShowWindow and created initially hidden with the `GLFW_VISIBLE` window hint. -This allows for off-screen rendering in a way compatible with most drivers, as -well as moving a window to a specific position before showing it. - - -@subsection news_30_undecorated Undecorated windows - -Windowed mode windows can now be created without decorations, i.e. things like -a frame, a title bar, with the `GLFW_DECORATED` window hint. This allows for -the creation of things like splash screens. - - -@subsection news_30_keymods Modifier key bit masks - -[Modifier key bit mask](@ref mods) parameters have been added to the -[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks. - - -@subsection news_30_scancode Platform-specific scancodes - -A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys -that don't have a [key token](@ref keys) still get passed on with the key -parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines -and are intended to be used for key bindings. - - -@subsection news_30_jsname Joystick names - -The name of a joystick can now be retrieved using @ref glfwGetJoystickName. - - -@subsection news_30_doxygen Doxygen documentation - -You are reading it. - -*/ diff --git a/extern/glfw/docs/quick.dox b/extern/glfw/docs/quick.dox deleted file mode 100644 index d024730..0000000 --- a/extern/glfw/docs/quick.dox +++ /dev/null @@ -1,308 +0,0 @@ -/*! - -@page quick Getting started - -@tableofcontents - -This guide will show how to write simple OpenGL applications using GLFW 3. It -will introduce a few of the most commonly used functions, but there are many -others. To see detailed documentation on any GLFW function, just click on its -name. - -This guide assumes no experience with earlier versions of GLFW. If you -have used GLFW 2.x in the past, you should also read the -[transition guide](@ref moving). - - -@section quick_include Including the GLFW header - -In the files of your program where you use OpenGL or GLFW, you need to include -the GLFW 3 header file. - -@code -#include -@endcode - -This defines all the constants, types and function prototypes of the GLFW API. -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 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 directly -- If you *do* need to include such headers, do it *before* including the - GLFW one and it will detect this - -Starting with version 3.0, the GLU header `glu.h` is no longer included by -default. If you wish to include it, define `GLFW_INCLUDE_GLU` before the -inclusion of the GLFW header. - -@code -#define GLFW_INCLUDE_GLU -#include -@endcode - - -@section quick_init_term Initializing and terminating GLFW - -Before you can use most GLFW functions, the library must be initialized. This -is done with @ref glfwInit, which returns non-zero if successful, or zero if an -error occurred. - -@code -if (!glfwInit()) - exit(EXIT_FAILURE); -@endcode - -When you are done using GLFW, typically at the very end of the program, you need -to call @ref glfwTerminate. - -@code -glfwTerminate(); -@endcode - -This destroys any remaining windows and releases any other resources allocated by -GLFW. After this call, you must call @ref glfwInit again before using any GLFW -functions that require it. - - -@section quick_capture_error Setting an error callback - -Most events are reported through callbacks, whether it's a key being pressed, -a GLFW window being moved, or an error occurring. Callbacks are simply -C functions (or C++ static methods) that are called by GLFW with arguments -describing the event. - -In case @ref glfwInit or any other GLFW function fails, an error is reported to -the GLFW error callback. You can receive these reports by setting the error -callback. The callback function itself should match the signature of @ref -GLFWerrorfun. Here is a simple error callback that just prints the error -description to `stderr`. - -@code -void error_callback(int error, const char* description) -{ - fputs(description, stderr); -} -@endcode - -Setting the callback, so GLFW knows to call it, is done with @ref -glfwSetErrorCallback. This is one of the few GLFW functions that may be called -before @ref glfwInit, which lets you be notified of errors during -initialization, so you should set it before you do anything else with GLFW. - -@code -glfwSetErrorCallback(error_callback); -@endcode - - -@section quick_create_window Creating a window and context - -The window (and its context) is created with @ref glfwCreateWindow, which -returns a handle to the created window. For example, this creates a 640 by 480 -windowed mode window: - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); -@endcode - -If window creation fails, `NULL` will be returned, so you need to check whether -it did. - -@code -if (!window) -{ - glfwTerminate(); - exit(EXIT_FAILURE); -} -@endcode - -This handle is then passed to all window related functions, and is provided to -you along with input events, so you know which window received the input. - -To create a full screen window, you need to specify which monitor the window -should use. In most cases, the user's primary monitor is a good choice. You -can get this with @ref glfwGetPrimaryMonitor. To make the above window -full screen, just pass along the monitor handle: - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL); -@endcode - -Full screen windows cover the entire display area of a monitor, have no border -or decorations, and change the monitor's resolution to the one most closely -matching the requested window size. - -When you are done with the window, destroy it with the @ref glfwDestroyWindow -function. - -@code -glfwDestroyWindow(window); -@endcode - -Once this function is called, no more events will be delivered for that window -and its handle becomes invalid. - - -@section quick_context_current Making the OpenGL context current - -Before you can use the OpenGL API, it must have a current OpenGL context. You -make a window's context current with @ref glfwMakeContextCurrent. It will then -remain as the current context until you make another context current or until -the window owning it is destroyed. - -@code -glfwMakeContextCurrent(window); -@endcode - - -@section quick_window_close Checking the window close flag - -Each window has a flag indicating whether the window should be closed. This can -be checked with @ref glfwWindowShouldClose. - -When the user attempts to close the window, either by pressing the close widget -in the title bar or using a key combination like Alt+F4, this flag is set to 1. -Note that **the window isn't actually closed**, so you are expected to monitor -this flag and either destroy the window or give some kind of feedback to the -user. - -@code -while (!glfwWindowShouldClose(window)) -{ - // Keep running -} -@endcode - -You can be notified when user is attempting to close the window by setting -a close callback with @ref glfwSetWindowCloseCallback. The callback will be -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. - - -@section quick_key_input Receiving input events - -Each window has a large number of callbacks that can be set to receive all the -various kinds of events. To receive key press and release events, a -[key callback](@ref GLFWkeyfun) is set using @ref glfwSetKeyCallback. - -@code -static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -{ - if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) - glfwSetWindowShouldClose(window, GL_TRUE); -} -@endcode - -For event callbacks to actually be called when an event occurs, you need to -process events as described below. - - -@section quick_render Rendering with OpenGL - -Once you have a current OpenGL context, you can use OpenGL normally. In this -tutorial, a multi-colored rotating triangle will be rendered. The framebuffer -size, needed by this example for `glViewport` and `glOrtho`, is retrieved with -@ref glfwGetFramebufferSize. - -@code -int width, height; -glfwGetFramebufferSize(window, &width, &height); -glViewport(0, 0, width, height); -@endcode - -However, you can also set a framebuffer size callback using @ref -glfwSetFramebufferSizeCallback and call `glViewport` from there. - -@code -void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - glViewport(0, 0, width, height); -} -@endcode - - -@section quick_timer Reading the timer - -For the triangle to rotate properly, a time source is needed. GLFW provides -@ref glfwGetTime, which returns the number of seconds since @ref glfwInit as -a `double`. The time source used is the most accurate on each platform and -generally has micro- or nanosecond resolution. - -@code -double time = glfwGetTime(); -@endcode - - -@section quick_swap_buffers Swapping buffers - -GLFW windows always use double-buffering. That means that you have two -rendering buffers; a front buffer and a back buffer. The front buffer is the -one being displayed and the back buffer the one you render to. - -When the entire frame has been rendered, it is time to swap the back and the -front buffers in order to display the rendered frame, and begin rendering a new -frame. This is done with @ref glfwSwapBuffers. - -@code -glfwSwapBuffers(window); -@endcode - - -@section quick_process_events Processing events - -GLFW needs to communicate regularly with the window system both in order to -receive events and to show that it hasn't locked up. Event processing must be -done regularly and is normally done each frame before rendering but after buffer -swap. - -There are two ways to process pending events. @ref glfwPollEvents processes -only those events that have already been received and then returns immediately. -This is the best choice when rendering continually, like most games do. - -@code -glfwPollEvents(); -@endcode - -If instead you only need to update your rendering once you have received new -input, @ref glfwWaitEvents is a better choice. It waits until at least one -event has been received, putting the thread to sleep in the meantime, and then -processes all received events just like @ref glfwPollEvents does. This saves -a great deal of CPU cycles and is useful for, for example, many kinds of editing -tools. - -@code -glfwWaitEvents(); -@endcode - - -@section quick_example Putting it together: A small GLFW application - -Now that you know how to initialize GLFW, create a window and poll for -keyboard input, it's possible to create a simple program. - -@snippet simple.c code - -This program creates a 640 by 480 windowed mode window and runs a loop clearing -the screen, rendering a triangle and processing events until the user closes the -window. It can be found in the source distribution as `examples/simple.c`, and -is by default compiled along with all other examples when you build GLFW. - -To learn more about how to compile and link programs that use GLFW, see -@ref build. - -*/ diff --git a/extern/glfw/docs/window.dox b/extern/glfw/docs/window.dox deleted file mode 100644 index ab83e50..0000000 --- a/extern/glfw/docs/window.dox +++ /dev/null @@ -1,496 +0,0 @@ -/*! - -@page window Window handling guide - -@tableofcontents - -The primary purpose of GLFW is to provide a simple interface to window -management and OpenGL and OpenGL ES context creation. GLFW supports multiple -windows, which can be either a normal desktop window or a full screen window. - - -@section window_object Window handles - -The @ref GLFWwindow object encapsulates both a window and a context. They are -created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow (or -@ref glfwTerminate, if any remain). As the window and context are inseparably -linked, the object pointer is used as both a context and window handle. - - -@section window_creation Window creation - -The window and its context are created with @ref glfwCreateWindow, which -returns a handle to the created window object. For example, this creates a 640 -by 480 windowed mode window: - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); -@endcode - -If window creation fails, `NULL` will be returned, so you need to check whether -it did. - -This handle is then passed to all window related functions, and is provided to -you along with input events, so you know which window received the input. - -To create a full screen window, you need to specify which monitor the window -should use. In most cases, the user's primary monitor is a good choice. For -more information about monitors, see the @ref monitor. - -@code -GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL); -@endcode - -Full screen windows cover the entire display area of a monitor, have no border -or decorations, and change the monitor's resolution to the one most closely -matching the requested window size. - -For more control over how the window and its context are created, see @ref -window_hints below. - - -@section window_destruction Window destruction - -When you are done with the window, destroy it with the @ref glfwDestroyWindow -function. - -@code -glfwDestroyWindow(window); -@endcode - -Once this function is called, no more events will be delivered for that window -and its handle becomes invalid. - - -@section window_userptr Window user pointer - -Each window has a user pointer that can be set with @ref -glfwSetWindowUserPointer and fetched with @ref glfwGetWindowUserPointer. This -can be used for any purpose you need and will not modified by GLFW throughout -the life-time of the window. - - -@section window_hints Window creation hints - -There are a number of hints that can be set before the creation of a window and -context. Some affect the window itself, others affect the framebuffer or -context. These hints are set to their default values each time the library is -initialized with @ref glfwInit, can be set individually with @ref glfwWindowHint -and reset all at once to their defaults with @ref glfwDefaultWindowHints. - -Note that hints need to be set *before* the creation of the window and context -you wish to have the specified attributes. - - -@subsection window_hints_hard Hard and soft constraints - -Some window hints are hard constraints. These must match the available -capabilities *exactly* for window and context creation to succeed. Hints -that are not hard constraints are matched as closely as possible, but the -resulting window and context may differ from what these hints requested. To -find out the actual attributes of the created window and context, use the -@ref glfwGetWindowAttrib function. - -The following hints are hard constraints: -- `GLFW_STEREO` -- `GLFW_CLIENT_API` - -The following additional hints are hard constraints if requesting an OpenGL -context: -- `GLFW_OPENGL_FORWARD_COMPAT` -- `GLFW_OPENGL_PROFILE` - -Hints that do not apply to a given type of window or context are ignored. - - -@subsection window_hints_wnd Window related hints - -The `GLFW_RESIZABLE` hint specifies whether the window will be resizable *by the -user*. The window will still be resizable using the @ref glfwSetWindowSize -function. This hint is ignored for full screen windows. - -The `GLFW_VISIBLE` hint specifies whether the window will be initially -visible. This hint is ignored for full screen windows. - -The `GLFW_DECORATED` hint specifies whether the window will have window -decorations such as a border, a close widget, etc. This hint is ignored for -full screen windows. Note that even though a window may lack a close widget, it -is usually still possible for the user to generate close events. - - -@subsection window_hints_fb Framebuffer related hints - -The `GLFW_RED_BITS`, `GLFW_GREEN_BITS`, `GLFW_BLUE_BITS`, `GLFW_ALPHA_BITS`, -`GLFW_DEPTH_BITS` and `GLFW_STENCIL_BITS` hints specify the desired bit -depths of the various components of the default framebuffer. - -The `GLFW_ACCUM_RED_BITS`, `GLFW_ACCUM_GREEN_BITS`, `GLFW_ACCUM_BLUE_BITS` -and `GLFW_ACCUM_ALPHA_BITS` hints specify the desired bit depths of the -various components of the accumulation buffer. - -The `GLFW_AUX_BUFFERS` hint specifies the desired number of auxiliary -buffers. - -The `GLFW_STEREO` hint specifies whether to use stereoscopic rendering. - -The `GLFW_SAMPLES` hint specifies the desired number of samples to use for -multisampling. Zero disables multisampling. - -The `GLFW_SRGB_CAPABLE` hint specifies whether the framebuffer should be -sRGB capable. - -The `GLFW_REFRESH_RATE` hint specifies the desired refresh rate for full screen -windows. If set to zero, the highest available refresh rate will be used. This -hint is ignored for windowed mode windows. - - -@subsection window_hints_ctx Context related hints - -The `GLFW_CLIENT_API` hint specifies which client API to create the context -for. Possible values are `GLFW_OPENGL_API` and `GLFW_OPENGL_ES_API`. - -The `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR` hints -specify the client API version that the created context must be compatible -with. - -For OpenGL, these hints are *not* hard constraints, as they don't have to -match exactly, but @ref glfwCreateWindow will still fail if the resulting -OpenGL version is less than the one requested. It is therefore perfectly -safe to use the default of version 1.0 for legacy code and you may still -get backwards-compatible contexts of version 3.0 and above when available. - -While there is no way to ask the driver for a context of the highest supported -version, most drivers provide this when you ask GLFW for a version -1.0 context. - -For OpenGL ES, these hints are hard constraints. - -If an OpenGL context is requested, the `GLFW_OPENGL_FORWARD_COMPAT` hint -specifies whether the OpenGL context should be forward-compatible, i.e. one -where all functionality deprecated in the requested version of OpenGL is -removed. This may only be used if the requested OpenGL version is 3.0 or -above. If another client API is requested, this hint is ignored. - -If an OpenGL context is requested, the `GLFW_OPENGL_DEBUG_CONTEXT` hint -specifies whether to create a debug OpenGL context, which may have -additional error and performance issue reporting functionality. If another -client API is requested, this hint is ignored. - -If an OpenGL context is requested, the `GLFW_OPENGL_PROFILE` hint specifies -which OpenGL profile to create the context for. Possible values are one of -`GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`, or -`GLFW_OPENGL_ANY_PROFILE` to not request a specific profile. If requesting -an OpenGL version below 3.2, `GLFW_OPENGL_ANY_PROFILE` must be used. If -another client API is requested, this hint is ignored. - -The `GLFW_CONTEXT_ROBUSTNESS` hint specifies the robustness strategy to be -used by the context. This can be one of `GLFW_NO_RESET_NOTIFICATION` or -`GLFW_LOSE_CONTEXT_ON_RESET`, or `GLFW_NO_ROBUSTNESS` to not request -a robustness strategy. - - -@subsection window_hints_values Supported and default values - -| Name | Default value | Supported values | -| ---------------------------- | ------------------------- | ----------------------- | -| `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_RED_BITS` | 8 | 0 to `INT_MAX` | -| `GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` | -| `GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` | -| `GLFW_ALPHA_BITS` | 8 | 0 to `INT_MAX` | -| `GLFW_DEPTH_BITS` | 24 | 0 to `INT_MAX` | -| `GLFW_STENCIL_BITS` | 8 | 0 to `INT_MAX` | -| `GLFW_ACCUM_RED_BITS` | 0 | 0 to `INT_MAX` | -| `GLFW_ACCUM_GREEN_BITS` | 0 | 0 to `INT_MAX` | -| `GLFW_ACCUM_BLUE_BITS` | 0 | 0 to `INT_MAX` | -| `GLFW_ACCUM_ALPHA_BITS` | 0 | 0 to `INT_MAX` | -| `GLFW_AUX_BUFFERS` | 0 | 0 to `INT_MAX` | -| `GLFW_SAMPLES` | 0 | 0 to `INT_MAX` | -| `GLFW_REFRESH_RATE` | 0 | 0 to `INT_MAX` | -| `GLFW_STEREO` | `GL_FALSE` | `GL_TRUE` or `GL_FALSE` | -| `GLFW_SRGB_CAPABLE` | `GL_FALSE` | `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_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` | - - -@section window_close Window close flag - -When the user attempts to close the window, for example by clicking the close -widget or using a key chord like Alt+F4, the *close flag* of the window is set. -The window is however not actually destroyed and, unless you watch for this -state change, nothing further happens. - -The current state of the close flag is returned by @ref glfwWindowShouldClose -and can be set or cleared directly with @ref glfwSetWindowShouldClose. A common -pattern is to use the close flag as a main loop condition. - -@code -while (!glfwWindowShouldClose(window)) -{ - render(window); - - glfwSwapBuffers(window); - glfwPollEvents(); -} -@endcode - -If you wish to be notified when the user attempts to close a window, you can set -the close callback with @ref glfwSetWindowCloseCallback. This callback is -called directly *after* the close flag has been set. - -@code -glfwSetWindowCloseCallback(window, window_close_callback); -@endcode - -The callback function can be used for example to filter close requests and clear -the close flag again unless certain conditions are met. - -@code -void window_close_callback(GLFWwindow* window) -{ - if (!time_to_close) - glfwSetWindowShouldClose(window, GL_FALSE); -} -@endcode - - -@section window_size Window size - -The size of a window can be changed with @ref glfwSetWindowSize. For windowed -mode windows, this resizes the specified window so that its *client area* has -the specified size. Note that the window system may put limitations on size. -For full screen windows, it selects and sets the video mode most closely -matching the specified size. - -@code -void glfwSetWindowSize(window, 640, 480); -@endcode - -If you wish to be notified when a window is resized, whether by the user or -the system, you can set the size callback with @ref glfwSetWindowSizeCallback. - -@code -glfwSetWindowSizeCallback(window, window_size_callback); -@endcode - -The callback function receives the new size of the client area of the window. - -@code -void window_size_callback(GLFWwindow* window, int width, int height) -{ -} -@endcode - -There is also @ref glfwGetWindowSize for directly retrieving the current size of -a window. - -@code -int width, height; -glfwGetWindowSize(window, &width, &height); -@endcode - - -@section window_fbsize Window framebuffer size - -While the size of a window is measured in screen coordinates, OpenGL works with -pixels. The size you pass into `glViewport`, for example, should be in pixels -and not screen coordinates. On some platforms screen coordinates and pixels are -the same, but this is not the case on all platforms supported by GLFW. There is -a second set of functions to retrieve the size in pixels of the framebuffer of -a window. - -If you wish to be notified when the framebuffer of a window is resized, whether -by the user or the system, you can set the size callback with @ref -glfwSetFramebufferSizeCallback. - -@code -glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); -@endcode - -The callback function receives the new size of the client area of the window, -which can for example be used to update the OpenGL viewport. - -@code -void framebuffer_size_callback(GLFWwindow* window, int width, int height) -{ - glViewport(0, 0, width, height); -} -@endcode - -There is also @ref glfwGetFramebufferSize for directly retrieving the current -size of the framebuffer of a window. - -@code -int width, height; -glfwGetFramebufferSize(window, &width, &height); -glViewport(0, 0, width, height); -@endcode - -Note that 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. - - -@section window_pos Window position - -The position of a windowed-mode window can be changed with @ref -glfwSetWindowPos. This moves the window so that the upper-left corner of its -client area has the specified screen coordinates. Note that the window system -may put limitations on placement. - -@code -glfwSetWindowPos(window, 100, 100); -@endcode - -If you wish to be notified when a window is moved, whether by the user or -the system, you can set the position callback with @ref glfwSetWindowPosCallback. - -@code -glfwSetWindowPosCallback(window, window_pos_callback); -@endcode - -The callback function receives the new position of the upper-left corner of its -client area. - -@code -void window_size_callback(GLFWwindow* window, int xpos, int ypos) -{ -} -@endcode - -There is also @ref glfwGetWindowPos for directly retrieving the current position -of the client area of the window. - -@code -int xpos, ypos; -glfwGetWindowPos(window, &xpos, &ypos); -@endcode - - -@section window_title Window title - -All GLFW windows have a title, although undecorated or full screen windows may -not display it or only display it in a task bar or similar interface. To change -the title of a window, use @ref glfwSetWindowTitle. - -@code -glfwSetWindowTitle(window, "My Window"); -@endcode - -The window title is a regular C string using the UTF-8 encoding. This means -for example that, as long as your source file is encoded as UTF-8, you can use -any Unicode characters. - -@code -glfwSetWindowTitle(window, "さよなら絶望先生"); -@endcode - - -@section window_attribs Window attributes - -Windows have a number of attributes that can be returned using @ref -glfwGetWindowAttrib. Some reflect state that may change during the lifetime of -the window, while others reflect the corresponding hints and are fixed at the -time of creation. - -@code -if (glfwGetWindowAttrib(window, GLFW_FOCUSED)) -{ - // window has input focus -} -@endcode - - -@subsection window_attribs_window Window attributes - -The `GLFW_FOCUSED` attribute indicates whether the specified window currently -has input focus. - -The `GLFW_ICONIFIED` attribute indicates whether the specified window is -currently iconified, whether by the user or with @ref glfwIconifyWindow. - -The `GLFW_VISIBLE` attribute indicates whether the specified window is currently -visible. Window visibility can be controlled with @ref glfwShowWindow and @ref -glfwHideWindow and initial visibility is controlled by the -[window hint](@ref window_hints) with the same name. - -The `GLFW_RESIZABLE` attribute indicates whether the specified window is -resizable *by the user*. This is controlled by the -[window hint](@ref window_hints) with the same name. - -The `GLFW_DECORATED` attribute indicates whether the specified window has -decorations such as a border, a close widget, etc. This is controlled by the -[window hint](@ref window_hints) with the same name. - - -@subsection window_attribs_context Context attributes - -The `GLFW_CLIENT_API` attribute indicates the client API provided by the -window's context; either `GLFW_OPENGL_API` or `GLFW_OPENGL_ES_API`. - -The `GLFW_CONTEXT_VERSION_MAJOR`, `GLFW_CONTEXT_VERSION_MINOR` and -`GLFW_CONTEXT_REVISION` attributes indicate the client API version of the -window's context. - -The `GLFW_OPENGL_FORWARD_COMPAT` attribute is `GL_TRUE` if the window's -context is an OpenGL forward-compatible one, or `GL_FALSE` otherwise. - -The `GLFW_OPENGL_DEBUG_CONTEXT` attribute is `GL_TRUE` if the window's -context is an OpenGL debug context, or `GL_FALSE` otherwise. - -The `GLFW_OPENGL_PROFILE` attribute indicates the OpenGL profile used by the -context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` -if the context uses a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the -OpenGL profile is unknown or the context is for another client API. Note that -the returned profile may not match the profile bits of the context flags, as -GLFW will try other means of detecting the profile when no bits are set. - -The `GLFW_CONTEXT_ROBUSTNESS` attribute indicates the robustness strategy -used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or -`GLFW_NO_RESET_NOTIFICATION` if the window's context supports robustness, or -`GLFW_NO_ROBUSTNESS` otherwise. - - -@section window_swap Swapping buffers - -GLFW windows are always double buffered. That means that you have two -rendering buffers; a front buffer and a back buffer. The front buffer is -the one being displayed and the back buffer the one you render to. - -When the entire frame has been rendered, it is time to swap the back and the -front buffers in order to display what has been rendered and begin rendering -a new frame. This is done with @ref glfwSwapBuffers. - -@code -glfwSwapBuffers(window); -@endcode - -Sometimes it can be useful to select when the buffer swap will occur. With the -function @ref glfwSwapInterval it is possible to select the minimum number of -monitor refreshes the driver should wait before swapping the buffers: - -@code -glfwSwapInterval(1); -@endcode - -If the interval is zero, the swap will take place immediately when @ref -glfwSwapBuffers is called without waiting for a refresh. Otherwise at least -interval retraces will pass between each buffer swap. Using a swap interval of -zero can be useful for benchmarking purposes, when it is not desirable to -measure the time it takes to wait for the vertical retrace. However, a swap -interval of one lets you avoid tearing. - -Note that this may not work on all machines, as some drivers have -user-controlled settings that override any swap interval the application -requests. It is also by default disabled on Windows Vista and later when using -DWM (Aero), as using it there sometimes leads to severe jitter. You can -forcibly enable it for machines using DWM using @ref compile_options_win32. - -*/ diff --git a/extern/glfw/examples/CMakeLists.txt b/extern/glfw/examples/CMakeLists.txt index 0199819..229c4a7 100644 --- a/extern/glfw/examples/CMakeLists.txt +++ b/extern/glfw/examples/CMakeLists.txt @@ -1,49 +1,69 @@ -link_libraries(glfw ${OPENGL_glu_LIBRARY}) +link_libraries(glfw "${OPENGL_glu_LIBRARY}") if (BUILD_SHARED_LIBS) add_definitions(-DGLFW_DLL) - link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY}) + link_libraries("${OPENGL_gl_LIBRARY}" "${MATH_LIBRARY}") else() link_libraries(${glfw_LIBRARIES}) endif() -include_directories(${GLFW_SOURCE_DIR}/include - ${GLFW_SOURCE_DIR}/deps) +include_directories("${GLFW_SOURCE_DIR}/include" + "${GLFW_SOURCE_DIR}/deps") -if (NOT APPLE) - # HACK: This is NOTFOUND on OS X 10.8 - include_directories(${OPENGL_INCLUDE_DIR}) +if ("${OPENGL_INCLUDE_DIR}") + include_directories("${OPENGL_INCLUDE_DIR}") endif() -set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h - ${GLFW_SOURCE_DIR}/deps/getopt.c) +set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h" + "${GLFW_SOURCE_DIR}/deps/glad.c") +set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" + "${GLFW_SOURCE_DIR}/deps/getopt.c") +set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" + "${GLFW_SOURCE_DIR}/deps/tinycthread.c") if (APPLE) # Set fancy names for bundles add_executable(Boing MACOSX_BUNDLE boing.c) add_executable(Gears MACOSX_BUNDLE gears.c) + add_executable(Heightmap MACOSX_BUNDLE heightmap.c ${GLAD}) + add_executable(Particles MACOSX_BUNDLE particles.c ${TINYCTHREAD}) add_executable(Simple MACOSX_BUNDLE simple.c) - add_executable("Split View" MACOSX_BUNDLE splitview.c) + add_executable(SplitView MACOSX_BUNDLE splitview.c) add_executable(Wave MACOSX_BUNDLE wave.c) set_target_properties(Boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing") set_target_properties(Gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears") + set_target_properties(Heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap") + set_target_properties(Particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles") set_target_properties(Simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple") - set_target_properties("Split View" PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View") + set_target_properties(SplitView PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View") set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave") + + set_target_properties(Boing Gears Heightmap Particles Simple SplitView Wave PROPERTIES + FOLDER "GLFW3/Examples") else() # Set boring names for executables add_executable(boing WIN32 boing.c) add_executable(gears WIN32 gears.c) - add_executable(heightmap WIN32 heightmap.c ${GETOPT}) + add_executable(heightmap WIN32 heightmap.c ${GLAD}) + add_executable(particles WIN32 particles.c ${TINYCTHREAD} ${GETOPT}) add_executable(simple WIN32 simple.c) add_executable(splitview WIN32 splitview.c) add_executable(wave WIN32 wave.c) + + set_target_properties(boing gears heightmap particles simple splitview wave PROPERTIES + FOLDER "GLFW3/Examples") +endif() + +if (APPLE) + target_link_libraries(Particles "${CMAKE_THREAD_LIBS_INIT}") +elseif (UNIX) + target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") endif() if (MSVC) - set(WINDOWS_BINARIES boing gears heightmap simple splitview wave) + set(WINDOWS_BINARIES boing gears heightmap particles simple splitview wave) # Tell MSVC to use main instead of WinMain for Windows subsystem executables set_target_properties(${WINDOWS_BINARIES} PROPERTIES @@ -51,7 +71,7 @@ if (MSVC) endif() if (APPLE) - set(BUNDLE_BINARIES Boing Gears Simple "Split View" Wave) + set(BUNDLE_BINARIES Boing Gears Heightmap Particles Simple SplitView Wave) set_target_properties(${BUNDLE_BINARIES} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} diff --git a/extern/glfw/examples/boing.c b/extern/glfw/examples/boing.c index 79d2e95..ec31359 100644 --- a/extern/glfw/examples/boing.c +++ b/extern/glfw/examples/boing.c @@ -44,6 +44,8 @@ void init( void ); void display( void ); void reshape( GLFWwindow* window, int w, int h ); void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods ); +void mouse_button_callback( GLFWwindow* window, int button, int action, int mods ); +void cursor_position_callback( GLFWwindow* window, double x, double y ); void DrawBoingBall( void ); void BounceBall( double dt ); void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi ); @@ -80,8 +82,12 @@ typedef enum { DRAW_BALL, DRAW_BALL_SHADOW } DRAW_BALL_ENUM; typedef struct {float x; float y; float z;} vertex_t; /* Global vars */ +int width, height; GLfloat deg_rot_y = 0.f; GLfloat deg_rot_y_inc = 2.f; +GLboolean override_pos = GL_FALSE; +GLfloat cursor_x = 0.f; +GLfloat cursor_y = 0.f; GLfloat ball_x = -RADIUS; GLfloat ball_y = -RADIUS; GLfloat ball_x_inc = 1.f; @@ -251,6 +257,37 @@ void key_callback( GLFWwindow* window, int key, int scancode, int action, int mo glfwSetWindowShouldClose(window, GL_TRUE); } +static void set_ball_pos ( GLfloat x, GLfloat y ) +{ + ball_x = (width / 2) - x; + ball_y = y - (height / 2); +} + +void mouse_button_callback( GLFWwindow* window, int button, int action, int mods ) +{ + if (button != GLFW_MOUSE_BUTTON_LEFT) + return; + + if (action == GLFW_PRESS) + { + override_pos = GL_TRUE; + set_ball_pos(cursor_x, cursor_y); + } + else + { + override_pos = GL_FALSE; + } +} + +void cursor_position_callback( GLFWwindow* window, double x, double y ) +{ + cursor_x = (float) x; + cursor_y = (float) y; + + if ( override_pos ) + set_ball_pos(cursor_x, cursor_y); +} + /***************************************************************************** * Draw the Boing ball. * @@ -341,6 +378,9 @@ void BounceBall( double delta_t ) GLfloat sign; GLfloat deg; + if ( override_pos ) + return; + /* Bounce on walls */ if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) ) { @@ -574,7 +614,6 @@ void DrawGrid( void ) int main( void ) { GLFWwindow* window; - int width, height; /* Init GLFW */ if( !glfwInit() ) @@ -591,6 +630,8 @@ int main( void ) glfwSetFramebufferSizeCallback(window, reshape); glfwSetKeyCallback(window, key_callback); + glfwSetMouseButtonCallback(window, mouse_button_callback); + glfwSetCursorPosCallback(window, cursor_position_callback); glfwMakeContextCurrent(window); glfwSwapInterval( 1 ); diff --git a/extern/glfw/examples/heightmap.c b/extern/glfw/examples/heightmap.c index c39e6b8..9fb75e5 100644 --- a/extern/glfw/examples/heightmap.c +++ b/extern/glfw/examples/heightmap.c @@ -28,37 +28,9 @@ #include #include #include -#include "getopt.h" +#include #include -#include - -/* OpenGL function pointers */ -static PFNGLGENBUFFERSPROC pglGenBuffers = NULL; -static PFNGLGENVERTEXARRAYSPROC pglGenVertexArrays = NULL; -static PFNGLDELETEVERTEXARRAYSPROC pglDeleteVertexArrays = NULL; -static PFNGLCREATESHADERPROC pglCreateShader = NULL; -static PFNGLSHADERSOURCEPROC pglShaderSource = NULL; -static PFNGLCOMPILESHADERPROC pglCompileShader = NULL; -static PFNGLGETSHADERIVPROC pglGetShaderiv = NULL; -static PFNGLGETSHADERINFOLOGPROC pglGetShaderInfoLog = NULL; -static PFNGLDELETESHADERPROC pglDeleteShader = NULL; -static PFNGLCREATEPROGRAMPROC pglCreateProgram = NULL; -static PFNGLATTACHSHADERPROC pglAttachShader = NULL; -static PFNGLLINKPROGRAMPROC pglLinkProgram = NULL; -static PFNGLUSEPROGRAMPROC pglUseProgram = NULL; -static PFNGLGETPROGRAMIVPROC pglGetProgramiv = NULL; -static PFNGLGETPROGRAMINFOLOGPROC pglGetProgramInfoLog = NULL; -static PFNGLDELETEPROGRAMPROC pglDeleteProgram = NULL; -static PFNGLGETUNIFORMLOCATIONPROC pglGetUniformLocation = NULL; -static PFNGLUNIFORMMATRIX4FVPROC pglUniformMatrix4fv = NULL; -static PFNGLGETATTRIBLOCATIONPROC pglGetAttribLocation = NULL; -static PFNGLBINDVERTEXARRAYPROC pglBindVertexArray = NULL; -static PFNGLBUFFERDATAPROC pglBufferData = NULL; -static PFNGLBINDBUFFERPROC pglBindBuffer = NULL; -static PFNGLBUFFERSUBDATAPROC pglBufferSubData = NULL; -static PFNGLENABLEVERTEXATTRIBARRAYPROC pglEnableVertexAttribArray = NULL; -static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL; /* Map height updates */ #define MAX_CIRCLE_SIZE (5.0f) @@ -75,54 +47,11 @@ static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL; 2 * (MAP_NUM_VERTICES - 1)) -/* OpenGL function pointers */ - -#define RESOLVE_GL_FCN(type, var, name) \ - if (status == GL_TRUE) \ - {\ - var = (type) glfwGetProcAddress((name));\ - if ((var) == NULL)\ - {\ - status = GL_FALSE;\ - }\ - } - - -static GLboolean init_opengl(void) -{ - GLboolean status = GL_TRUE; - RESOLVE_GL_FCN(PFNGLCREATESHADERPROC, pglCreateShader, "glCreateShader"); - RESOLVE_GL_FCN(PFNGLSHADERSOURCEPROC, pglShaderSource, "glShaderSource"); - RESOLVE_GL_FCN(PFNGLCOMPILESHADERPROC, pglCompileShader, "glCompileShader"); - RESOLVE_GL_FCN(PFNGLGETSHADERIVPROC, pglGetShaderiv, "glGetShaderiv"); - RESOLVE_GL_FCN(PFNGLGETSHADERINFOLOGPROC, pglGetShaderInfoLog, "glGetShaderInfoLog"); - RESOLVE_GL_FCN(PFNGLDELETESHADERPROC, pglDeleteShader, "glDeleteShader"); - RESOLVE_GL_FCN(PFNGLCREATEPROGRAMPROC, pglCreateProgram, "glCreateProgram"); - RESOLVE_GL_FCN(PFNGLATTACHSHADERPROC, pglAttachShader, "glAttachShader"); - RESOLVE_GL_FCN(PFNGLLINKPROGRAMPROC, pglLinkProgram, "glLinkProgram"); - RESOLVE_GL_FCN(PFNGLUSEPROGRAMPROC, pglUseProgram, "glUseProgram"); - RESOLVE_GL_FCN(PFNGLGETPROGRAMIVPROC, pglGetProgramiv, "glGetProgramiv"); - RESOLVE_GL_FCN(PFNGLGETPROGRAMINFOLOGPROC, pglGetProgramInfoLog, "glGetProgramInfoLog"); - RESOLVE_GL_FCN(PFNGLDELETEPROGRAMPROC, pglDeleteProgram, "glDeleteProgram"); - RESOLVE_GL_FCN(PFNGLGETUNIFORMLOCATIONPROC, pglGetUniformLocation, "glGetUniformLocation"); - RESOLVE_GL_FCN(PFNGLUNIFORMMATRIX4FVPROC, pglUniformMatrix4fv, "glUniformMatrix4fv"); - RESOLVE_GL_FCN(PFNGLGETATTRIBLOCATIONPROC, pglGetAttribLocation, "glGetAttribLocation"); - RESOLVE_GL_FCN(PFNGLGENVERTEXARRAYSPROC, pglGenVertexArrays, "glGenVertexArrays"); - RESOLVE_GL_FCN(PFNGLDELETEVERTEXARRAYSPROC, pglDeleteVertexArrays, "glDeleteVertexArrays"); - RESOLVE_GL_FCN(PFNGLBINDVERTEXARRAYPROC, pglBindVertexArray, "glBindVertexArray"); - RESOLVE_GL_FCN(PFNGLGENBUFFERSPROC, pglGenBuffers, "glGenBuffers"); - RESOLVE_GL_FCN(PFNGLBINDBUFFERPROC, pglBindBuffer, "glBindBuffer"); - RESOLVE_GL_FCN(PFNGLBUFFERDATAPROC, pglBufferData, "glBufferData"); - RESOLVE_GL_FCN(PFNGLBUFFERSUBDATAPROC, pglBufferSubData, "glBufferSubData"); - RESOLVE_GL_FCN(PFNGLENABLEVERTEXATTRIBARRAYPROC, pglEnableVertexAttribArray, "glEnableVertexAttribArray"); - RESOLVE_GL_FCN(PFNGLVERTEXATTRIBPOINTERPROC, pglVertexAttribPointer, "glVertexAttribPointer"); - return status; -} /********************************************************************** * Default shader programs *********************************************************************/ -static const char* default_vertex_shader = +static const char* vertex_shader_text = "#version 150\n" "uniform mat4 project;\n" "uniform mat4 modelview;\n" @@ -135,12 +64,12 @@ static const char* default_vertex_shader = " gl_Position = project * modelview * vec4(x, y, z, 1.0);\n" "}\n"; -static const char* default_fragment_shader = +static const char* fragment_shader_text = "#version 150\n" -"out vec4 gl_FragColor;\n" +"out vec4 color;\n" "void main()\n" "{\n" -" gl_FragColor = vec4(0.2, 1.0, 0.2, 1.0); \n" +" color = vec4(0.2, 1.0, 0.2, 1.0); \n" "}\n"; /********************************************************************** @@ -188,53 +117,27 @@ static GLuint mesh_vbo[4]; * OpenGL helper functions *********************************************************************/ -/* Load a (text) file into memory and return its contents - */ -static char* read_file_content(const char* filename) -{ - FILE* fd; - size_t size = 0; - char* result = NULL; - - fd = fopen(filename, "r"); - if (fd != NULL) - { - size = fseek(fd, 0, SEEK_END); - (void) fseek(fd, 0, SEEK_SET); - - result = malloc(size + 1); - result[size] = '\0'; - if (fread(result, size, 1, fd) != 1) - { - free(result); - result = NULL; - } - (void) fclose(fd); - } - return result; -} - /* Creates a shader object of the specified type using the specified text */ -static GLuint make_shader(GLenum type, const char* shader_src) +static GLuint make_shader(GLenum type, const char* text) { GLuint shader; GLint shader_ok; GLsizei log_length; char info_log[8192]; - shader = pglCreateShader(type); + shader = glCreateShader(type); if (shader != 0) { - pglShaderSource(shader, 1, (const GLchar**)&shader_src, NULL); - pglCompileShader(shader); - pglGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok); + glShaderSource(shader, 1, (const GLchar**)&text, NULL); + glCompileShader(shader); + glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok); if (shader_ok != GL_TRUE) { fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" ); - pglGetShaderInfoLog(shader, 8192, &log_length,info_log); + glGetShaderInfoLog(shader, 8192, &log_length,info_log); fprintf(stderr, "ERROR: \n%s\n\n", info_log); - pglDeleteShader(shader); + glDeleteShader(shader); shader = 0; } } @@ -243,7 +146,7 @@ static GLuint make_shader(GLenum type, const char* shader_src) /* Creates a program object using the specified vertex and fragment text */ -static GLuint make_shader_program(const char* vertex_shader_src, const char* fragment_shader_src) +static GLuint make_shader_program(const char* vs_text, const char* fs_text) { GLuint program = 0u; GLint program_ok; @@ -252,30 +155,30 @@ static GLuint make_shader_program(const char* vertex_shader_src, const char* fra GLsizei log_length; char info_log[8192]; - vertex_shader = make_shader(GL_VERTEX_SHADER, (vertex_shader_src == NULL) ? default_vertex_shader : vertex_shader_src); + vertex_shader = make_shader(GL_VERTEX_SHADER, vs_text); if (vertex_shader != 0u) { - fragment_shader = make_shader(GL_FRAGMENT_SHADER, (fragment_shader_src == NULL) ? default_fragment_shader : fragment_shader_src); + fragment_shader = make_shader(GL_FRAGMENT_SHADER, fs_text); if (fragment_shader != 0u) { /* make the program that connect the two shader and link it */ - program = pglCreateProgram(); + program = glCreateProgram(); if (program != 0u) { /* attach both shader and link */ - pglAttachShader(program, vertex_shader); - pglAttachShader(program, fragment_shader); - pglLinkProgram(program); - pglGetProgramiv(program, GL_LINK_STATUS, &program_ok); + glAttachShader(program, vertex_shader); + glAttachShader(program, fragment_shader); + glLinkProgram(program); + glGetProgramiv(program, GL_LINK_STATUS, &program_ok); if (program_ok != GL_TRUE) { fprintf(stderr, "ERROR, failed to link shader program\n"); - pglGetProgramInfoLog(program, 8192, &log_length, info_log); + glGetProgramInfoLog(program, 8192, &log_length, info_log); fprintf(stderr, "ERROR: \n%s\n\n", info_log); - pglDeleteProgram(program); - pglDeleteShader(fragment_shader); - pglDeleteShader(vertex_shader); + glDeleteProgram(program); + glDeleteShader(fragment_shader); + glDeleteShader(vertex_shader); program = 0u; } } @@ -283,7 +186,7 @@ static GLuint make_shader_program(const char* vertex_shader_src, const char* fra else { fprintf(stderr, "ERROR: Unable to load fragment shader\n"); - pglDeleteShader(vertex_shader); + glDeleteShader(vertex_shader); } } else @@ -439,38 +342,38 @@ static void make_mesh(GLuint program) { GLuint attrloc; - pglGenVertexArrays(1, &mesh); - pglGenBuffers(4, mesh_vbo); - pglBindVertexArray(mesh); + glGenVertexArrays(1, &mesh); + glGenBuffers(4, mesh_vbo); + glBindVertexArray(mesh); /* Prepare the data for drawing through a buffer inidices */ - pglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]); - pglBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW); /* Prepare the attributes for rendering */ - attrloc = pglGetAttribLocation(program, "x"); - pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]); - pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW); - pglEnableVertexAttribArray(attrloc); - pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); + attrloc = glGetAttribLocation(program, "x"); + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW); + glEnableVertexAttribArray(attrloc); + glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); - attrloc = pglGetAttribLocation(program, "z"); - pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]); - pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW); - pglEnableVertexAttribArray(attrloc); - pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); + attrloc = glGetAttribLocation(program, "z"); + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW); + glEnableVertexAttribArray(attrloc); + glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); - attrloc = pglGetAttribLocation(program, "y"); - pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]); - pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW); - pglEnableVertexAttribArray(attrloc); - pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); + attrloc = glGetAttribLocation(program, "y"); + glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW); + glEnableVertexAttribArray(attrloc); + glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0); } /* Update VBO vertices from source data */ static void update_mesh(void) { - pglBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]); + glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]); } /********************************************************************** @@ -488,17 +391,15 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, } } -/* Print usage information */ -static void usage(void) +static void error_callback(int error, const char* description) { - printf("Usage: heightmap [-v ] [-f ]\n"); - printf(" heightmap [-h]\n"); + fprintf(stderr, "Error: %s\n", description); } int main(int argc, char** argv) { GLFWwindow* window; - int ch, iter; + int iter; double dt; double last_update_time; int frame; @@ -506,80 +407,22 @@ int main(int argc, char** argv) GLint uloc_modelview; GLint uloc_project; - char* vertex_shader_path = NULL; - char* fragment_shader_path = NULL; - char* vertex_shader_src = NULL; - char* fragment_shader_src = NULL; GLuint shader_program; - while ((ch = getopt(argc, argv, "f:v:h")) != -1) - { - switch (ch) - { - case 'f': - fragment_shader_path = optarg; - break; - case 'v': - vertex_shader_path = optarg; - break; - case 'h': - usage(); - exit(EXIT_SUCCESS); - default: - usage(); - exit(EXIT_FAILURE); - } - } - - if (fragment_shader_path) - { - vertex_shader_src = read_file_content(fragment_shader_path); - if (!fragment_shader_src) - { - fprintf(stderr, - "ERROR: unable to load fragment shader from '%s'\n", - fragment_shader_path); - exit(EXIT_FAILURE); - } - } - - if (vertex_shader_path) - { - vertex_shader_src = read_file_content(vertex_shader_path); - if (!vertex_shader_src) - { - fprintf(stderr, - "ERROR: unable to load vertex shader from '%s'\n", - fragment_shader_path); - exit(EXIT_FAILURE); - } - } + glfwSetErrorCallback(error_callback); if (!glfwInit()) - { - fprintf(stderr, "ERROR: Unable to initialize GLFW\n"); - usage(); - - free(vertex_shader_src); - free(fragment_shader_src); exit(EXIT_FAILURE); - } 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, GL_FALSE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL); if (! window ) { - fprintf(stderr, "ERROR: Unable to create the OpenGL context and associated window\n"); - usage(); - - free(vertex_shader_src); - free(fragment_shader_src); - glfwTerminate(); exit(EXIT_FAILURE); } @@ -588,32 +431,20 @@ int main(int argc, char** argv) glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); - if (GL_TRUE != init_opengl()) - { - fprintf(stderr, "ERROR: unable to resolve OpenGL function pointers\n"); - free(vertex_shader_src); - free(fragment_shader_src); + gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); - glfwTerminate(); - exit(EXIT_FAILURE); - } /* Prepare opengl resources for rendering */ - shader_program = make_shader_program(vertex_shader_src , fragment_shader_src); - free(vertex_shader_src); - free(fragment_shader_src); + shader_program = make_shader_program(vertex_shader_text, fragment_shader_text); if (shader_program == 0u) { - fprintf(stderr, "ERROR: during creation of the shader program\n"); - usage(); - glfwTerminate(); exit(EXIT_FAILURE); } - pglUseProgram(shader_program); - uloc_project = pglGetUniformLocation(shader_program, "project"); - uloc_modelview = pglGetUniformLocation(shader_program, "modelview"); + glUseProgram(shader_program); + uloc_project = glGetUniformLocation(shader_program, "project"); + uloc_modelview = glGetUniformLocation(shader_program, "modelview"); /* Compute the projection matrix */ f = 1.0f / tanf(view_angle / 2.0f); @@ -622,13 +453,13 @@ int main(int argc, char** argv) projection_matrix[10] = (z_far + z_near)/ (z_near - z_far); projection_matrix[11] = -1.0f; projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far); - pglUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix); + glUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix); /* Set the camera position */ modelview_matrix[12] = -5.0f; modelview_matrix[13] = -5.0f; modelview_matrix[14] = -20.0f; - pglUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix); + glUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix); /* Create mesh data */ init_map(); diff --git a/extern/glfw/examples/particles.c b/extern/glfw/examples/particles.c new file mode 100644 index 0000000..dc9e9fc --- /dev/null +++ b/extern/glfw/examples/particles.c @@ -0,0 +1,1061 @@ +//======================================================================== +// A simple particle engine with threaded physics +// Copyright (c) Marcus Geelnard +// Copyright (c) Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include +#include +#include +#include +#include + +#include +#include + +#define GLFW_INCLUDE_GLU +#include + +// Define tokens for GL_EXT_separate_specular_color if not already defined +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif // GL_EXT_separate_specular_color + +// Some 's do not define M_PI +#ifndef M_PI +#define M_PI 3.141592654 +#endif + + +//======================================================================== +// Type definitions +//======================================================================== + +typedef struct +{ + float x, y, z; +} Vec3; + +// This structure is used for interleaved vertex arrays (see the +// draw_particles function) +// +// NOTE: This structure SHOULD be packed on most systems. It uses 32-bit fields +// on 32-bit boundaries, and is a multiple of 64 bits in total (6x32=3x64). If +// it does not work, try using pragmas or whatever to force the structure to be +// packed. +typedef struct +{ + GLfloat s, t; // Texture coordinates + GLuint rgba; // Color (four ubytes packed into an uint) + GLfloat x, y, z; // Vertex coordinates +} Vertex; + + +//======================================================================== +// Program control global variables +//======================================================================== + +// Window dimensions +float aspect_ratio; + +// "wireframe" flag (true if we use wireframe view) +int wireframe; + +// Thread synchronization +struct { + double t; // Time (s) + float dt; // Time since last frame (s) + int p_frame; // Particle physics frame number + int d_frame; // Particle draw frame number + cnd_t p_done; // Condition: particle physics done + cnd_t d_done; // Condition: particle draw done + mtx_t particles_lock; // Particles data sharing mutex +} thread_sync; + + +//======================================================================== +// Texture declarations (we hard-code them into the source code, since +// they are so simple) +//======================================================================== + +#define P_TEX_WIDTH 8 // Particle texture dimensions +#define P_TEX_HEIGHT 8 +#define F_TEX_WIDTH 16 // Floor texture dimensions +#define F_TEX_HEIGHT 16 + +// Texture object IDs +GLuint particle_tex_id, floor_tex_id; + +// Particle texture (a simple spot) +const unsigned char particle_texture[ P_TEX_WIDTH * P_TEX_HEIGHT ] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x11, 0x22, 0x22, 0x11, 0x00, 0x00, + 0x00, 0x11, 0x33, 0x88, 0x77, 0x33, 0x11, 0x00, + 0x00, 0x22, 0x88, 0xff, 0xee, 0x77, 0x22, 0x00, + 0x00, 0x22, 0x77, 0xee, 0xff, 0x88, 0x22, 0x00, + 0x00, 0x11, 0x33, 0x77, 0x88, 0x33, 0x11, 0x00, + 0x00, 0x00, 0x11, 0x33, 0x22, 0x11, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +// Floor texture (your basic checkered floor) +const unsigned char floor_texture[ F_TEX_WIDTH * F_TEX_HEIGHT ] = { + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0xff, 0xf0, 0xcc, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0xf0, 0xcc, 0xee, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0x30, 0x66, 0x30, 0x30, 0x30, 0x20, 0x30, 0x30, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xee, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0xf0, 0xf0, 0xf0, 0xf0, 0xcc, 0xf0, 0xf0, 0xf0, 0x30, 0x30, 0x55, 0x30, 0x30, 0x44, 0x30, 0x30, + 0xf0, 0xdd, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0x30, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x33, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x30, 0x30, 0xf0, 0xff, 0xf0, 0xf0, 0xdd, 0xf0, 0xf0, 0xff, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x55, 0x33, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xf0, + 0x30, 0x44, 0x66, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xaa, 0xf0, 0xf0, 0xcc, 0xf0, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xdd, 0xf0, + 0x30, 0x30, 0x30, 0x77, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, +}; + + +//======================================================================== +// These are fixed constants that control the particle engine. In a +// modular world, these values should be variables... +//======================================================================== + +// Maximum number of particles +#define MAX_PARTICLES 3000 + +// Life span of a particle (in seconds) +#define LIFE_SPAN 8.f + +// A new particle is born every [BIRTH_INTERVAL] second +#define BIRTH_INTERVAL (LIFE_SPAN/(float)MAX_PARTICLES) + +// Particle size (meters) +#define PARTICLE_SIZE 0.7f + +// Gravitational constant (m/s^2) +#define GRAVITY 9.8f + +// Base initial velocity (m/s) +#define VELOCITY 8.f + +// Bounce friction (1.0 = no friction, 0.0 = maximum friction) +#define FRICTION 0.75f + +// "Fountain" height (m) +#define FOUNTAIN_HEIGHT 3.f + +// Fountain radius (m) +#define FOUNTAIN_RADIUS 1.6f + +// Minimum delta-time for particle phisics (s) +#define MIN_DELTA_T (BIRTH_INTERVAL * 0.5f) + + +//======================================================================== +// Particle system global variables +//======================================================================== + +// This structure holds all state for a single particle +typedef struct { + float x,y,z; // Position in space + float vx,vy,vz; // Velocity vector + float r,g,b; // Color of particle + float life; // Life of particle (1.0 = newborn, < 0.0 = dead) + int active; // Tells if this particle is active +} PARTICLE; + +// Global vectors holding all particles. We use two vectors for double +// buffering. +static PARTICLE particles[MAX_PARTICLES]; + +// Global variable holding the age of the youngest particle +static float min_age; + +// Color of latest born particle (used for fountain lighting) +static float glow_color[4]; + +// Position of latest born particle (used for fountain lighting) +static float glow_pos[4]; + + +//======================================================================== +// Object material and fog configuration constants +//======================================================================== + +const GLfloat fountain_diffuse[4] = { 0.7f, 1.f, 1.f, 1.f }; +const GLfloat fountain_specular[4] = { 1.f, 1.f, 1.f, 1.f }; +const GLfloat fountain_shininess = 12.f; +const GLfloat floor_diffuse[4] = { 1.f, 0.6f, 0.6f, 1.f }; +const GLfloat floor_specular[4] = { 0.6f, 0.6f, 0.6f, 1.f }; +const GLfloat floor_shininess = 18.f; +const GLfloat fog_color[4] = { 0.1f, 0.1f, 0.1f, 1.f }; + + +//======================================================================== +// Print usage information +//======================================================================== + +static void usage(void) +{ + printf("Usage: particles [-bfhs]\n"); + printf("Options:\n"); + printf(" -f Run in full screen\n"); + printf(" -h Display this help\n"); + printf(" -s Run program as single thread (default is to use two threads)\n"); + printf("\n"); + printf("Program runtime controls:\n"); + printf(" W Toggle wireframe mode\n"); + printf(" Esc Exit program\n"); +} + + +//======================================================================== +// Initialize a new particle +//======================================================================== + +static void init_particle(PARTICLE *p, double t) +{ + float xy_angle, velocity; + + // Start position of particle is at the fountain blow-out + p->x = 0.f; + p->y = 0.f; + p->z = FOUNTAIN_HEIGHT; + + // Start velocity is up (Z)... + p->vz = 0.7f + (0.3f / 4096.f) * (float) (rand() & 4095); + + // ...and a randomly chosen X/Y direction + xy_angle = (2.f * (float) M_PI / 4096.f) * (float) (rand() & 4095); + p->vx = 0.4f * (float) cos(xy_angle); + p->vy = 0.4f * (float) sin(xy_angle); + + // Scale velocity vector according to a time-varying velocity + velocity = VELOCITY * (0.8f + 0.1f * (float) (sin(0.5 * t) + sin(1.31 * t))); + p->vx *= velocity; + p->vy *= velocity; + p->vz *= velocity; + + // Color is time-varying + p->r = 0.7f + 0.3f * (float) sin(0.34 * t + 0.1); + p->g = 0.6f + 0.4f * (float) sin(0.63 * t + 1.1); + p->b = 0.6f + 0.4f * (float) sin(0.91 * t + 2.1); + + // Store settings for fountain glow lighting + glow_pos[0] = 0.4f * (float) sin(1.34 * t); + glow_pos[1] = 0.4f * (float) sin(3.11 * t); + glow_pos[2] = FOUNTAIN_HEIGHT + 1.f; + glow_pos[3] = 1.f; + glow_color[0] = p->r; + glow_color[1] = p->g; + glow_color[2] = p->b; + glow_color[3] = 1.f; + + // The particle is new-born and active + p->life = 1.f; + p->active = 1; +} + + +//======================================================================== +// Update a particle +//======================================================================== + +#define FOUNTAIN_R2 (FOUNTAIN_RADIUS+PARTICLE_SIZE/2)*(FOUNTAIN_RADIUS+PARTICLE_SIZE/2) + +static void update_particle(PARTICLE *p, float dt) +{ + // If the particle is not active, we need not do anything + if (!p->active) + return; + + // The particle is getting older... + p->life -= dt * (1.f / LIFE_SPAN); + + // Did the particle die? + if (p->life <= 0.f) + { + p->active = 0; + return; + } + + // Apply gravity + p->vz = p->vz - GRAVITY * dt; + + // Update particle position + p->x = p->x + p->vx * dt; + p->y = p->y + p->vy * dt; + p->z = p->z + p->vz * dt; + + // Simple collision detection + response + if (p->vz < 0.f) + { + // Particles should bounce on the fountain (with friction) + if ((p->x * p->x + p->y * p->y) < FOUNTAIN_R2 && + p->z < (FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2)) + { + p->vz = -FRICTION * p->vz; + p->z = FOUNTAIN_HEIGHT + PARTICLE_SIZE / 2 + + FRICTION * (FOUNTAIN_HEIGHT + + PARTICLE_SIZE / 2 - p->z); + } + + // Particles should bounce on the floor (with friction) + else if (p->z < PARTICLE_SIZE / 2) + { + p->vz = -FRICTION * p->vz; + p->z = PARTICLE_SIZE / 2 + + FRICTION * (PARTICLE_SIZE / 2 - p->z); + } + } +} + + +//======================================================================== +// The main frame for the particle engine. Called once per frame. +//======================================================================== + +static void particle_engine(double t, float dt) +{ + int i; + float dt2; + + // Update particles (iterated several times per frame if dt is too large) + while (dt > 0.f) + { + // Calculate delta time for this iteration + dt2 = dt < MIN_DELTA_T ? dt : MIN_DELTA_T; + + for (i = 0; i < MAX_PARTICLES; i++) + update_particle(&particles[i], dt2); + + min_age += dt2; + + // Should we create any new particle(s)? + while (min_age >= BIRTH_INTERVAL) + { + min_age -= BIRTH_INTERVAL; + + // Find a dead particle to replace with a new one + for (i = 0; i < MAX_PARTICLES; i++) + { + if (!particles[i].active) + { + init_particle(&particles[i], t + min_age); + update_particle(&particles[i], min_age); + break; + } + } + } + + dt -= dt2; + } +} + + +//======================================================================== +// Draw all active particles. We use OpenGL 1.1 vertex +// arrays for this in order to accelerate the drawing. +//======================================================================== + +#define BATCH_PARTICLES 70 // Number of particles to draw in each batch + // (70 corresponds to 7.5 KB = will not blow + // the L1 data cache on most CPUs) +#define PARTICLE_VERTS 4 // Number of vertices per particle + +static void draw_particles(GLFWwindow* window, double t, float dt) +{ + int i, particle_count; + Vertex vertex_array[BATCH_PARTICLES * PARTICLE_VERTS]; + Vertex* vptr; + float alpha; + GLuint rgba; + Vec3 quad_lower_left, quad_lower_right; + GLfloat mat[16]; + PARTICLE* pptr; + + // Here comes the real trick with flat single primitive objects (s.c. + // "billboards"): We must rotate the textured primitive so that it + // always faces the viewer (is coplanar with the view-plane). + // We: + // 1) Create the primitive around origo (0,0,0) + // 2) Rotate it so that it is coplanar with the view plane + // 3) Translate it according to the particle position + // Note that 1) and 2) is the same for all particles (done only once). + + // Get modelview matrix. We will only use the upper left 3x3 part of + // the matrix, which represents the rotation. + glGetFloatv(GL_MODELVIEW_MATRIX, mat); + + // 1) & 2) We do it in one swift step: + // Although not obvious, the following six lines represent two matrix/ + // vector multiplications. The matrix is the inverse 3x3 rotation + // matrix (i.e. the transpose of the same matrix), and the two vectors + // represent the lower left corner of the quad, PARTICLE_SIZE/2 * + // (-1,-1,0), and the lower right corner, PARTICLE_SIZE/2 * (1,-1,0). + // The upper left/right corners of the quad is always the negative of + // the opposite corners (regardless of rotation). + quad_lower_left.x = (-PARTICLE_SIZE / 2) * (mat[0] + mat[1]); + quad_lower_left.y = (-PARTICLE_SIZE / 2) * (mat[4] + mat[5]); + quad_lower_left.z = (-PARTICLE_SIZE / 2) * (mat[8] + mat[9]); + quad_lower_right.x = (PARTICLE_SIZE / 2) * (mat[0] - mat[1]); + quad_lower_right.y = (PARTICLE_SIZE / 2) * (mat[4] - mat[5]); + quad_lower_right.z = (PARTICLE_SIZE / 2) * (mat[8] - mat[9]); + + // Don't update z-buffer, since all particles are transparent! + glDepthMask(GL_FALSE); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + + // Select particle texture + if (!wireframe) + { + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, particle_tex_id); + } + + // Set up vertex arrays. We use interleaved arrays, which is easier to + // handle (in most situations) and it gives a linear memeory access + // access pattern (which may give better performance in some + // situations). GL_T2F_C4UB_V3F means: 2 floats for texture coords, + // 4 ubytes for color and 3 floats for vertex coord (in that order). + // Most OpenGL cards / drivers are optimized for this format. + glInterleavedArrays(GL_T2F_C4UB_V3F, 0, vertex_array); + + // Wait for particle physics thread to be done + mtx_lock(&thread_sync.particles_lock); + while (!glfwWindowShouldClose(window) && + thread_sync.p_frame <= thread_sync.d_frame) + { + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_nsec += 100000000; + cnd_timedwait(&thread_sync.p_done, &thread_sync.particles_lock, &ts); + } + + // Store the frame time and delta time for the physics thread + thread_sync.t = t; + thread_sync.dt = dt; + + // Update frame counter + thread_sync.d_frame++; + + // Loop through all particles and build vertex arrays. + particle_count = 0; + vptr = vertex_array; + pptr = particles; + + for (i = 0; i < MAX_PARTICLES; i++) + { + if (pptr->active) + { + // Calculate particle intensity (we set it to max during 75% + // of its life, then it fades out) + alpha = 4.f * pptr->life; + if (alpha > 1.f) + alpha = 1.f; + + // Convert color from float to 8-bit (store it in a 32-bit + // integer using endian independent type casting) + ((GLubyte*) &rgba)[0] = (GLubyte)(pptr->r * 255.f); + ((GLubyte*) &rgba)[1] = (GLubyte)(pptr->g * 255.f); + ((GLubyte*) &rgba)[2] = (GLubyte)(pptr->b * 255.f); + ((GLubyte*) &rgba)[3] = (GLubyte)(alpha * 255.f); + + // 3) Translate the quad to the correct position in modelview + // space and store its parameters in vertex arrays (we also + // store texture coord and color information for each vertex). + + // Lower left corner + vptr->s = 0.f; + vptr->t = 0.f; + vptr->rgba = rgba; + vptr->x = pptr->x + quad_lower_left.x; + vptr->y = pptr->y + quad_lower_left.y; + vptr->z = pptr->z + quad_lower_left.z; + vptr ++; + + // Lower right corner + vptr->s = 1.f; + vptr->t = 0.f; + vptr->rgba = rgba; + vptr->x = pptr->x + quad_lower_right.x; + vptr->y = pptr->y + quad_lower_right.y; + vptr->z = pptr->z + quad_lower_right.z; + vptr ++; + + // Upper right corner + vptr->s = 1.f; + vptr->t = 1.f; + vptr->rgba = rgba; + vptr->x = pptr->x - quad_lower_left.x; + vptr->y = pptr->y - quad_lower_left.y; + vptr->z = pptr->z - quad_lower_left.z; + vptr ++; + + // Upper left corner + vptr->s = 0.f; + vptr->t = 1.f; + vptr->rgba = rgba; + vptr->x = pptr->x - quad_lower_right.x; + vptr->y = pptr->y - quad_lower_right.y; + vptr->z = pptr->z - quad_lower_right.z; + vptr ++; + + // Increase count of drawable particles + particle_count ++; + } + + // If we have filled up one batch of particles, draw it as a set + // of quads using glDrawArrays. + if (particle_count >= BATCH_PARTICLES) + { + // The first argument tells which primitive type we use (QUAD) + // The second argument tells the index of the first vertex (0) + // The last argument is the vertex count + glDrawArrays(GL_QUADS, 0, PARTICLE_VERTS * particle_count); + particle_count = 0; + vptr = vertex_array; + } + + // Next particle + pptr++; + } + + // We are done with the particle data + mtx_unlock(&thread_sync.particles_lock); + cnd_signal(&thread_sync.d_done); + + // Draw final batch of particles (if any) + glDrawArrays(GL_QUADS, 0, PARTICLE_VERTS * particle_count); + + // Disable vertex arrays (Note: glInterleavedArrays implicitly called + // glEnableClientState for vertex, texture coord and color arrays) + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + glDepthMask(GL_TRUE); +} + + +//======================================================================== +// Fountain geometry specification +//======================================================================== + +#define FOUNTAIN_SIDE_POINTS 14 +#define FOUNTAIN_SWEEP_STEPS 32 + +static const float fountain_side[FOUNTAIN_SIDE_POINTS * 2] = +{ + 1.2f, 0.f, 1.f, 0.2f, 0.41f, 0.3f, 0.4f, 0.35f, + 0.4f, 1.95f, 0.41f, 2.f, 0.8f, 2.2f, 1.2f, 2.4f, + 1.5f, 2.7f, 1.55f,2.95f, 1.6f, 3.f, 1.f, 3.f, + 0.5f, 3.f, 0.f, 3.f +}; + +static const float fountain_normal[FOUNTAIN_SIDE_POINTS * 2] = +{ + 1.0000f, 0.0000f, 0.6428f, 0.7660f, 0.3420f, 0.9397f, 1.0000f, 0.0000f, + 1.0000f, 0.0000f, 0.3420f,-0.9397f, 0.4226f,-0.9063f, 0.5000f,-0.8660f, + 0.7660f,-0.6428f, 0.9063f,-0.4226f, 0.0000f,1.00000f, 0.0000f,1.00000f, + 0.0000f,1.00000f, 0.0000f,1.00000f +}; + + +//======================================================================== +// Draw a fountain +//======================================================================== + +static void draw_fountain(void) +{ + static GLuint fountain_list = 0; + double angle; + float x, y; + int m, n; + + // The first time, we build the fountain display list + if (!fountain_list) + { + fountain_list = glGenLists(1); + glNewList(fountain_list, GL_COMPILE_AND_EXECUTE); + + glMaterialfv(GL_FRONT, GL_DIFFUSE, fountain_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, fountain_specular); + glMaterialf(GL_FRONT, GL_SHININESS, fountain_shininess); + + // Build fountain using triangle strips + for (n = 0; n < FOUNTAIN_SIDE_POINTS - 1; n++) + { + glBegin(GL_TRIANGLE_STRIP); + for (m = 0; m <= FOUNTAIN_SWEEP_STEPS; m++) + { + angle = (double) m * (2.0 * M_PI / (double) FOUNTAIN_SWEEP_STEPS); + x = (float) cos(angle); + y = (float) sin(angle); + + // Draw triangle strip + glNormal3f(x * fountain_normal[n * 2 + 2], + y * fountain_normal[n * 2 + 2], + fountain_normal[n * 2 + 3]); + glVertex3f(x * fountain_side[n * 2 + 2], + y * fountain_side[n * 2 + 2], + fountain_side[n * 2 +3 ]); + glNormal3f(x * fountain_normal[n * 2], + y * fountain_normal[n * 2], + fountain_normal[n * 2 + 1]); + glVertex3f(x * fountain_side[n * 2], + y * fountain_side[n * 2], + fountain_side[n * 2 + 1]); + } + + glEnd(); + } + + glEndList(); + } + else + glCallList(fountain_list); +} + + +//======================================================================== +// Recursive function for building variable tesselated floor +//======================================================================== + +static void tessellate_floor(float x1, float y1, float x2, float y2, int depth) +{ + float delta, x, y; + + // Last recursion? + if (depth >= 5) + delta = 999999.f; + else + { + x = (float) (fabs(x1) < fabs(x2) ? fabs(x1) : fabs(x2)); + y = (float) (fabs(y1) < fabs(y2) ? fabs(y1) : fabs(y2)); + delta = x*x + y*y; + } + + // Recurse further? + if (delta < 0.1f) + { + x = (x1 + x2) * 0.5f; + y = (y1 + y2) * 0.5f; + tessellate_floor(x1, y1, x, y, depth + 1); + tessellate_floor(x, y1, x2, y, depth + 1); + tessellate_floor(x1, y, x, y2, depth + 1); + tessellate_floor(x, y, x2, y2, depth + 1); + } + else + { + glTexCoord2f(x1 * 30.f, y1 * 30.f); + glVertex3f( x1 * 80.f, y1 * 80.f, 0.f); + glTexCoord2f(x2 * 30.f, y1 * 30.f); + glVertex3f( x2 * 80.f, y1 * 80.f, 0.f); + glTexCoord2f(x2 * 30.f, y2 * 30.f); + glVertex3f( x2 * 80.f, y2 * 80.f, 0.f); + glTexCoord2f(x1 * 30.f, y2 * 30.f); + glVertex3f( x1 * 80.f, y2 * 80.f, 0.f); + } +} + + +//======================================================================== +// Draw floor. We build the floor recursively and let the tessellation in the +// center (near x,y=0,0) be high, while the tessellation around the edges be +// low. +//======================================================================== + +static void draw_floor(void) +{ + static GLuint floor_list = 0; + + if (!wireframe) + { + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, floor_tex_id); + } + + // The first time, we build the floor display list + if (!floor_list) + { + floor_list = glGenLists(1); + glNewList(floor_list, GL_COMPILE_AND_EXECUTE); + + glMaterialfv(GL_FRONT, GL_DIFFUSE, floor_diffuse); + glMaterialfv(GL_FRONT, GL_SPECULAR, floor_specular); + glMaterialf(GL_FRONT, GL_SHININESS, floor_shininess); + + // Draw floor as a bunch of triangle strips (high tesselation + // improves lighting) + glNormal3f(0.f, 0.f, 1.f); + glBegin(GL_QUADS); + tessellate_floor(-1.f, -1.f, 0.f, 0.f, 0); + tessellate_floor( 0.f, -1.f, 1.f, 0.f, 0); + tessellate_floor( 0.f, 0.f, 1.f, 1.f, 0); + tessellate_floor(-1.f, 0.f, 0.f, 1.f, 0); + glEnd(); + + glEndList(); + } + else + glCallList(floor_list); + + glDisable(GL_TEXTURE_2D); + +} + + +//======================================================================== +// Position and configure light sources +//======================================================================== + +static void setup_lights(void) +{ + float l1pos[4], l1amb[4], l1dif[4], l1spec[4]; + float l2pos[4], l2amb[4], l2dif[4], l2spec[4]; + + // Set light source 1 parameters + l1pos[0] = 0.f; l1pos[1] = -9.f; l1pos[2] = 8.f; l1pos[3] = 1.f; + l1amb[0] = 0.2f; l1amb[1] = 0.2f; l1amb[2] = 0.2f; l1amb[3] = 1.f; + l1dif[0] = 0.8f; l1dif[1] = 0.4f; l1dif[2] = 0.2f; l1dif[3] = 1.f; + l1spec[0] = 1.f; l1spec[1] = 0.6f; l1spec[2] = 0.2f; l1spec[3] = 0.f; + + // Set light source 2 parameters + l2pos[0] = -15.f; l2pos[1] = 12.f; l2pos[2] = 1.5f; l2pos[3] = 1.f; + l2amb[0] = 0.f; l2amb[1] = 0.f; l2amb[2] = 0.f; l2amb[3] = 1.f; + l2dif[0] = 0.2f; l2dif[1] = 0.4f; l2dif[2] = 0.8f; l2dif[3] = 1.f; + l2spec[0] = 0.2f; l2spec[1] = 0.6f; l2spec[2] = 1.f; l2spec[3] = 0.f; + + glLightfv(GL_LIGHT1, GL_POSITION, l1pos); + glLightfv(GL_LIGHT1, GL_AMBIENT, l1amb); + glLightfv(GL_LIGHT1, GL_DIFFUSE, l1dif); + glLightfv(GL_LIGHT1, GL_SPECULAR, l1spec); + glLightfv(GL_LIGHT2, GL_POSITION, l2pos); + glLightfv(GL_LIGHT2, GL_AMBIENT, l2amb); + glLightfv(GL_LIGHT2, GL_DIFFUSE, l2dif); + glLightfv(GL_LIGHT2, GL_SPECULAR, l2spec); + glLightfv(GL_LIGHT3, GL_POSITION, glow_pos); + glLightfv(GL_LIGHT3, GL_DIFFUSE, glow_color); + glLightfv(GL_LIGHT3, GL_SPECULAR, glow_color); + + glEnable(GL_LIGHT1); + glEnable(GL_LIGHT2); + glEnable(GL_LIGHT3); +} + + +//======================================================================== +// Main rendering function +//======================================================================== + +static void draw_scene(GLFWwindow* window, double t) +{ + double xpos, ypos, zpos, angle_x, angle_y, angle_z; + static double t_old = 0.0; + float dt; + + // Calculate frame-to-frame delta time + dt = (float) (t - t_old); + t_old = t; + + glClearColor(0.1f, 0.1f, 0.1f, 1.f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(65.0, aspect_ratio, 1.0, 60.0); + + // Setup camera + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + // Rotate camera + angle_x = 90.0 - 10.0; + angle_y = 10.0 * sin(0.3 * t); + angle_z = 10.0 * t; + glRotated(-angle_x, 1.0, 0.0, 0.0); + glRotated(-angle_y, 0.0, 1.0, 0.0); + glRotated(-angle_z, 0.0, 0.0, 1.0); + + // Translate camera + xpos = 15.0 * sin((M_PI / 180.0) * angle_z) + + 2.0 * sin((M_PI / 180.0) * 3.1 * t); + ypos = -15.0 * cos((M_PI / 180.0) * angle_z) + + 2.0 * cos((M_PI / 180.0) * 2.9 * t); + zpos = 4.0 + 2.0 * cos((M_PI / 180.0) * 4.9 * t); + glTranslated(-xpos, -ypos, -zpos); + + glFrontFace(GL_CCW); + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + + setup_lights(); + glEnable(GL_LIGHTING); + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_EXP); + glFogf(GL_FOG_DENSITY, 0.05f); + glFogfv(GL_FOG_COLOR, fog_color); + + draw_floor(); + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + + draw_fountain(); + + glDisable(GL_LIGHTING); + glDisable(GL_FOG); + + // Particles must be drawn after all solid objects have been drawn + draw_particles(window, t, dt); + + // Z-buffer not needed anymore + glDisable(GL_DEPTH_TEST); +} + + +//======================================================================== +// Window resize callback function +//======================================================================== + +static void resize_callback(GLFWwindow* window, int width, int height) +{ + glViewport(0, 0, width, height); + aspect_ratio = height ? width / (float) height : 1.f; +} + + +//======================================================================== +// Key callback functions +//======================================================================== + +static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) +{ + if (action == GLFW_PRESS) + { + switch (key) + { + case GLFW_KEY_ESCAPE: + glfwSetWindowShouldClose(window, GL_TRUE); + break; + case GLFW_KEY_W: + wireframe = !wireframe; + glPolygonMode(GL_FRONT_AND_BACK, + wireframe ? GL_LINE : GL_FILL); + break; + default: + break; + } + } +} + + +//======================================================================== +// Thread for updating particle physics +//======================================================================== + +static int physics_thread_main(void* arg) +{ + GLFWwindow* window = arg; + + for (;;) + { + mtx_lock(&thread_sync.particles_lock); + + // Wait for particle drawing to be done + while (!glfwWindowShouldClose(window) && + thread_sync.p_frame > thread_sync.d_frame) + { + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_nsec += 100000000; + cnd_timedwait(&thread_sync.d_done, &thread_sync.particles_lock, &ts); + } + + if (glfwWindowShouldClose(window)) + break; + + // Update particles + particle_engine(thread_sync.t, thread_sync.dt); + + // Update frame counter + thread_sync.p_frame++; + + // Unlock mutex and signal drawing thread + mtx_unlock(&thread_sync.particles_lock); + cnd_signal(&thread_sync.p_done); + } + + return 0; +} + + +//======================================================================== +// main +//======================================================================== + +int main(int argc, char** argv) +{ + int ch, width, height; + thrd_t physics_thread = 0; + GLFWwindow* window; + GLFWmonitor* monitor = NULL; + + if (!glfwInit()) + { + fprintf(stderr, "Failed to initialize GLFW\n"); + exit(EXIT_FAILURE); + } + + while ((ch = getopt(argc, argv, "fh")) != -1) + { + switch (ch) + { + case 'f': + monitor = glfwGetPrimaryMonitor(); + break; + case 'h': + usage(); + exit(EXIT_SUCCESS); + } + } + + if (monitor) + { + const GLFWvidmode* mode = glfwGetVideoMode(monitor); + + glfwWindowHint(GLFW_RED_BITS, mode->redBits); + glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); + glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); + glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); + + width = mode->width; + height = mode->height; + } + else + { + width = 640; + height = 480; + } + + window = glfwCreateWindow(width, height, "Particle Engine", monitor, NULL); + if (!window) + { + fprintf(stderr, "Failed to create GLFW window\n"); + glfwTerminate(); + exit(EXIT_FAILURE); + } + + if (monitor) + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); + + glfwMakeContextCurrent(window); + glfwSwapInterval(1); + + glfwSetWindowSizeCallback(window, resize_callback); + glfwSetKeyCallback(window, key_callback); + + // Set initial aspect ratio + glfwGetWindowSize(window, &width, &height); + resize_callback(window, width, height); + + // Upload particle texture + glGenTextures(1, &particle_tex_id); + glBindTexture(GL_TEXTURE_2D, particle_tex_id); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, P_TEX_WIDTH, P_TEX_HEIGHT, + 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, particle_texture); + + // Upload floor texture + glGenTextures(1, &floor_tex_id); + glBindTexture(GL_TEXTURE_2D, floor_tex_id); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, F_TEX_WIDTH, F_TEX_HEIGHT, + 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, floor_texture); + + if (glfwExtensionSupported("GL_EXT_separate_specular_color")) + { + glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, + GL_SEPARATE_SPECULAR_COLOR_EXT); + } + + // Set filled polygon mode as default (not wireframe) + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + wireframe = 0; + + // Set initial times + thread_sync.t = 0.0; + thread_sync.dt = 0.001f; + thread_sync.p_frame = 0; + thread_sync.d_frame = 0; + + mtx_init(&thread_sync.particles_lock, mtx_timed); + cnd_init(&thread_sync.p_done); + cnd_init(&thread_sync.d_done); + + if (thrd_create(&physics_thread, physics_thread_main, window) != thrd_success) + { + glfwTerminate(); + exit(EXIT_FAILURE); + } + + glfwSetTime(0.0); + + while (!glfwWindowShouldClose(window)) + { + draw_scene(window, glfwGetTime()); + + glfwSwapBuffers(window); + glfwPollEvents(); + } + + thrd_join(physics_thread, NULL); + + glfwDestroyWindow(window); + glfwTerminate(); + + exit(EXIT_SUCCESS); +} + diff --git a/extern/glfw/examples/simple.c b/extern/glfw/examples/simple.c index 89eaa02..c39be57 100644 --- a/extern/glfw/examples/simple.c +++ b/extern/glfw/examples/simple.c @@ -57,6 +57,7 @@ int main(void) } glfwMakeContextCurrent(window); + glfwSwapInterval(1); glfwSetKeyCallback(window, key_callback); diff --git a/extern/glfw/examples/wave.c b/extern/glfw/examples/wave.c index 6890e85..bafe465 100644 --- a/extern/glfw/examples/wave.c +++ b/extern/glfw/examples/wave.c @@ -28,10 +28,8 @@ GLfloat alpha = 210.f, beta = -70.f; GLfloat zoom = 2.f; -GLboolean locked = GL_FALSE; - -int cursorX; -int cursorY; +double cursorX; +double cursorY; struct Vertex { @@ -321,13 +319,10 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) if (action == GLFW_PRESS) { glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - locked = GL_TRUE; + glfwGetCursorPos(window, &cursorX, &cursorY); } else - { - locked = GL_FALSE; glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - } } @@ -337,14 +332,14 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) void cursor_position_callback(GLFWwindow* window, double x, double y) { - if (locked) + if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) { alpha += (GLfloat) (x - cursorX) / 10.f; beta += (GLfloat) (y - cursorY) / 10.f; - } - cursorX = (int) x; - cursorY = (int) y; + cursorX = x; + cursorY = y; + } } diff --git a/extern/glfw/include/GLFW/glfw3.h b/extern/glfw/include/GLFW/glfw3.h index 0f97738..8941449 100644 --- a/extern/glfw/include/GLFW/glfw3.h +++ b/extern/glfw/include/GLFW/glfw3.h @@ -1,5 +1,5 @@ /************************************************************************* - * GLFW 3.0 - www.glfw.org + * GLFW 3.1 - www.glfw.org * A library for OpenGL, window and input *------------------------------------------------------------------------ * Copyright (c) 2002-2006 Marcus Geelnard @@ -38,23 +38,27 @@ extern "C" { * Doxygen documentation *************************************************************************/ -/*! @defgroup clipboard Clipboard support - */ /*! @defgroup context Context handling + * + * This is the reference documentation for context related functions. For more + * information, see the @ref context. */ -/*! @defgroup error Error handling - */ -/*! @defgroup init Initialization and version information +/*! @defgroup init Initialization, version and errors + * + * This is the reference documentation for initialization and termination of + * the library, version management and error handling. For more information, + * see the @ref intro. */ /*! @defgroup input Input handling + * + * This is the reference documentation for input related functions and types. + * For more information, see the @ref input. */ /*! @defgroup monitor Monitor handling * * This is the reference documentation for monitor related functions and types. * For more information, see the @ref monitor. */ -/*! @defgroup time Time input - */ /*! @defgroup window Window handling * * This is the reference documentation for window related functions and types, @@ -140,63 +144,81 @@ extern "C" { /* Include the chosen client API headers. */ #if defined(__APPLE_CC__) - #if defined(GLFW_INCLUDE_GLCOREARB) - #include - #elif !defined(GLFW_INCLUDE_NONE) - #define GL_GLEXT_LEGACY - #include + #if defined(GLFW_INCLUDE_GLCOREARB) + #include + #if defined(GLFW_INCLUDE_GLEXT) + #include #endif - #if defined(GLFW_INCLUDE_GLU) - #include + #elif !defined(GLFW_INCLUDE_NONE) + #if !defined(GLFW_INCLUDE_GLEXT) + #define GL_GLEXT_LEGACY #endif + #include + #endif + #if defined(GLFW_INCLUDE_GLU) + #include + #endif #else - #if defined(GLFW_INCLUDE_GLCOREARB) - #include - #elif defined(GLFW_INCLUDE_ES1) - #include - #elif defined(GLFW_INCLUDE_ES2) - #include - #elif defined(GLFW_INCLUDE_ES3) - #include - #elif !defined(GLFW_INCLUDE_NONE) - #include + #if defined(GLFW_INCLUDE_GLCOREARB) + #include + #elif defined(GLFW_INCLUDE_ES1) + #include + #if defined(GLFW_INCLUDE_GLEXT) + #include #endif - #if defined(GLFW_INCLUDE_GLU) - #include + #elif defined(GLFW_INCLUDE_ES2) + #include + #if defined(GLFW_INCLUDE_GLEXT) + #include #endif + #elif defined(GLFW_INCLUDE_ES3) + #include + #if defined(GLFW_INCLUDE_GLEXT) + #include + #endif + #elif defined(GLFW_INCLUDE_ES31) + #include + #if defined(GLFW_INCLUDE_GLEXT) + #include + #endif + #elif !defined(GLFW_INCLUDE_NONE) + #include + #if defined(GLFW_INCLUDE_GLEXT) + #include + #endif + #endif + #if defined(GLFW_INCLUDE_GLU) + #include + #endif #endif #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) - /* GLFW_DLL is defined by users of GLFW when compiling programs that will link - * to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the - * GLFW configuration header when compiling the DLL version of the library. + /* GLFW_DLL must be defined by applications that are linking against the DLL + * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW + * configuration header when compiling the DLL version of the library. */ #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" #endif +/* GLFWAPI is used to declare public API functions for export + * from the DLL / shared library / dynamic library. + */ #if defined(_WIN32) && defined(_GLFW_BUILD_DLL) - - /* We are building a Win32 DLL */ + /* We are building GLFW as a Win32 DLL */ #define GLFWAPI __declspec(dllexport) - #elif defined(_WIN32) && defined(GLFW_DLL) - - /* We are calling a Win32 DLL */ + /* We are calling GLFW as a Win32 DLL */ #if defined(__LCC__) #define GLFWAPI extern #else #define GLFWAPI __declspec(dllimport) #endif - #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) - + /* We are building GLFW as a shared / dynamic library */ #define GLFWAPI __attribute__((visibility("default"))) - #else - - /* We are either building/calling a static lib or we are non-win32 */ + /* We are building or calling GLFW as a static library */ #define GLFWAPI - #endif /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ @@ -220,27 +242,36 @@ extern "C" { * backward-compatible. * @ingroup init */ -#define GLFW_VERSION_MINOR 0 +#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 4 +#define GLFW_VERSION_REVISION 0 /*! @} */ /*! @name Key and button actions * @{ */ -/*! @brief The key or button was released. +/*! @brief The key or mouse button was released. + * + * The key or mouse button was released. + * * @ingroup input */ #define GLFW_RELEASE 0 -/*! @brief The key or button was pressed. +/*! @brief The key or mouse button was pressed. + * + * The key or mouse button was pressed. + * * @ingroup input */ #define GLFW_PRESS 1 /*! @brief The key was held down until it repeated. + * + * The key was held down until it repeated. + * * @ingroup input */ #define GLFW_REPEAT 2 @@ -248,20 +279,22 @@ extern "C" { /*! @defgroup keys Keyboard keys * - * These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60), - * but re-arranged to map to 7-bit ASCII for printable keys (function keys are - * put in the 256+ range). + * See [key input](@ref input_key) for how these are used. * - * The naming of the key codes follow these rules: - * - The US keyboard layout is used - * - Names of printable alpha-numeric characters are used (e.g. "A", "R", - * "3", etc.) - * - For non-alphanumeric characters, Unicode:ish names are used (e.g. - * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not - * correspond to the Unicode standard (usually for brevity) - * - Keys that lack a clear US mapping are named "WORLD_x" - * - For non-printable keys, custom names are used (e.g. "F4", - * "BACKSPACE", etc.) + * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60), + * but re-arranged to map to 7-bit ASCII for printable keys (function keys are + * put in the 256+ range). + * + * The naming of the key codes follow these rules: + * - The US keyboard layout is used + * - Names of printable alpha-numeric characters are used (e.g. "A", "R", + * "3", etc.) + * - For non-alphanumeric characters, Unicode:ish names are used (e.g. + * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not + * correspond to the Unicode standard (usually for brevity) + * - Keys that lack a clear US mapping are named "WORLD_x" + * - For non-printable keys, custom names are used (e.g. "F4", + * "BACKSPACE", etc.) * * @ingroup input * @{ @@ -398,6 +431,9 @@ extern "C" { /*! @} */ /*! @defgroup mods Modifier key flags + * + * See [key input](@ref input_key) for how these are used. + * * @ingroup input * @{ */ @@ -417,6 +453,9 @@ extern "C" { /*! @} */ /*! @defgroup buttons Mouse buttons + * + * See [mouse button input](@ref input_mouse_button) for how these are used. + * * @ingroup input * @{ */ #define GLFW_MOUSE_BUTTON_1 0 @@ -434,6 +473,9 @@ extern "C" { /*! @} */ /*! @defgroup joysticks Joysticks + * + * See [joystick input](@ref joystick) for how these are used. + * * @ingroup input * @{ */ #define GLFW_JOYSTICK_1 0 @@ -456,36 +498,128 @@ extern "C" { /*! @} */ /*! @defgroup errors Error codes - * @ingroup error + * + * See [error handling](@ref error_handling) for how these are used. + * + * @ingroup init * @{ */ /*! @brief GLFW has not been initialized. + * + * This occurs if a GLFW function was called that may not be called unless the + * library is [initialized](@ref intro_init). + * + * @par Analysis + * Application programmer error. Initialize GLFW before calling any function + * that requires initialization. */ #define GLFW_NOT_INITIALIZED 0x00010001 /*! @brief No context is current for this thread. + * + * This occurs if a GLFW function was called that needs and operates on the + * current OpenGL or OpenGL ES context but no context is current on the calling + * thread. One such function is @ref glfwSwapInterval. + * + * @par Analysis + * Application programmer error. Ensure a context is current before calling + * functions that require a current context. */ #define GLFW_NO_CURRENT_CONTEXT 0x00010002 -/*! @brief One of the enum parameters for the function was given an invalid - * enum. +/*! @brief One of the arguments to the function was an invalid enum value. + * + * One of the arguments to the function was an invalid enum value, for example + * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref + * glfwGetWindowAttrib. + * + * @par Analysis + * Application programmer error. Fix the offending call. */ #define GLFW_INVALID_ENUM 0x00010003 -/*! @brief One of the parameters for the function was given an invalid value. +/*! @brief One of the arguments to the function was an invalid value. + * + * One of the arguments to the function was an invalid value, for example + * requesting a non-existent OpenGL or OpenGL ES version like 2.7. + * + * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead + * result in a @ref GLFW_VERSION_UNAVAILABLE error. + * + * @par Analysis + * Application programmer error. Fix the offending call. */ #define GLFW_INVALID_VALUE 0x00010004 /*! @brief A memory allocation failed. + * + * A memory allocation failed. + * + * @par Analysis + * A bug in GLFW or the underlying operating system. Report the bug to our + * [issue tracker](https://github.com/glfw/glfw/issues). */ #define GLFW_OUT_OF_MEMORY 0x00010005 /*! @brief GLFW could not find support for the requested client API on the * system. + * + * GLFW could not find support for the requested client API on the system. + * + * @par Analysis + * The installed graphics driver does not support the requested client API, or + * does not support it via the chosen context creation backend. Below are + * a few examples. + * + * @par + * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only + * supports OpenGL ES via EGL, while Nvidia and Intel only supports it via + * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa + * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary + * driver. */ #define GLFW_API_UNAVAILABLE 0x00010006 -/*! @brief The requested client API version is not available. +/*! @brief The requested OpenGL or OpenGL ES version is not available. + * + * The requested OpenGL or OpenGL ES version (including any requested profile + * or context option) is not available on this machine. + * + * @par Analysis + * The machine does not support your requirements. If your application is + * sufficiently flexible, downgrade your requirements and try again. + * Otherwise, inform the user that their machine does not match your + * requirements. + * + * @par + * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0 + * comes out before the 4.x series gets that far, also fail with this error and + * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions + * will exist. */ #define GLFW_VERSION_UNAVAILABLE 0x00010007 /*! @brief A platform-specific error occurred that does not match any of the * more specific categories. + * + * A platform-specific error occurred that does not match any of the more + * specific categories. + * + * @par Analysis + * A bug in GLFW or the underlying operating system. Report the bug to our + * [issue tracker](https://github.com/glfw/glfw/issues). */ #define GLFW_PLATFORM_ERROR 0x00010008 -/*! @brief The clipboard did not contain data in the requested format. +/*! @brief The requested format is not supported or available. + * + * If emitted during window creation, the requested pixel format is not + * supported. + * + * If emitted when querying the clipboard, the contents of the clipboard could + * not be converted to the requested format. + * + * @par Analysis + * If emitted during window creation, one or more + * [hard constraints](@ref window_hints_hard) did not match any of the + * available pixel formats. If your application is sufficiently flexible, + * downgrade your requirements and try again. Otherwise, inform the user that + * their machine does not match your requirements. + * + * @par + * If emitted when querying the clipboard, ignore the error or report it to + * the user, as appropriate. */ #define GLFW_FORMAT_UNAVAILABLE 0x00010009 /*! @} */ @@ -495,6 +629,8 @@ extern "C" { #define GLFW_RESIZABLE 0x00020003 #define GLFW_VISIBLE 0x00020004 #define GLFW_DECORATED 0x00020005 +#define GLFW_AUTO_ICONIFY 0x00020006 +#define GLFW_FLOATING 0x00020007 #define GLFW_RED_BITS 0x00021001 #define GLFW_GREEN_BITS 0x00021002 @@ -511,6 +647,7 @@ extern "C" { #define GLFW_SAMPLES 0x0002100D #define GLFW_SRGB_CAPABLE 0x0002100E #define GLFW_REFRESH_RATE 0x0002100F +#define GLFW_DOUBLEBUFFER 0x00021010 #define GLFW_CLIENT_API 0x00022001 #define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 @@ -520,6 +657,7 @@ extern "C" { #define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 #define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 #define GLFW_OPENGL_PROFILE 0x00022008 +#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009 #define GLFW_OPENGL_API 0x00030001 #define GLFW_OPENGL_ES_API 0x00030002 @@ -540,9 +678,54 @@ extern "C" { #define GLFW_CURSOR_HIDDEN 0x00034002 #define GLFW_CURSOR_DISABLED 0x00034003 +#define GLFW_ANY_RELEASE_BEHAVIOR 0 +#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 +#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002 + +/*! @defgroup shapes Standard cursor shapes + * + * See [standard cursor creation](@ref cursor_standard) for how these are used. + * + * @ingroup input + * @{ */ + +/*! @brief The regular arrow cursor shape. + * + * The regular arrow cursor. + */ +#define GLFW_ARROW_CURSOR 0x00036001 +/*! @brief The text input I-beam cursor shape. + * + * The text input I-beam cursor shape. + */ +#define GLFW_IBEAM_CURSOR 0x00036002 +/*! @brief The crosshair shape. + * + * The crosshair shape. + */ +#define GLFW_CROSSHAIR_CURSOR 0x00036003 +/*! @brief The hand shape. + * + * The hand shape. + */ +#define GLFW_HAND_CURSOR 0x00036004 +/*! @brief The horizontal resize arrow shape. + * + * The horizontal resize arrow shape. + */ +#define GLFW_HRESIZE_CURSOR 0x00036005 +/*! @brief The vertical resize arrow shape. + * + * The vertical resize arrow shape. + */ +#define GLFW_VRESIZE_CURSOR 0x00036006 +/*! @} */ + #define GLFW_CONNECTED 0x00040001 #define GLFW_DISCONNECTED 0x00040002 +#define GLFW_DONT_CARE -1 + /************************************************************************* * GLFW API types @@ -573,6 +756,14 @@ typedef struct GLFWmonitor GLFWmonitor; */ typedef struct GLFWwindow GLFWwindow; +/*! @brief Opaque cursor object. + * + * Opaque cursor object. + * + * @ingroup cursor + */ +typedef struct GLFWcursor GLFWcursor; + /*! @brief The function signature for error callbacks. * * This is the function signature for error callback functions. @@ -582,7 +773,7 @@ typedef struct GLFWwindow GLFWwindow; * * @sa glfwSetErrorCallback * - * @ingroup error + * @ingroup init */ typedef void (* GLFWerrorfun)(int,const char*); @@ -590,7 +781,7 @@ typedef void (* GLFWerrorfun)(int,const char*); * * This is the function signature for window position callback functions. * - * @param[in] window The window that the user moved. + * @param[in] window The window that was moved. * @param[in] xpos The new x-coordinate, in screen coordinates, of the * upper-left corner of the client area of the window. * @param[in] ypos The new y-coordinate, in screen coordinates, of the @@ -606,7 +797,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int); * * This is the function signature for window size callback functions. * - * @param[in] window The window that the user resized. + * @param[in] window The window that was resized. * @param[in] width The new width, in screen coordinates, of the window. * @param[in] height The new height, in screen coordinates, of the window. * @@ -644,9 +835,9 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*); * * This is the function signature for window focus callback functions. * - * @param[in] window The window that was focused or defocused. - * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if - * it was defocused. + * @param[in] window The window that gained or lost input focus. + * @param[in] focused `GL_TRUE` if the window was given input focus, or + * `GL_FALSE` if it lost it. * * @sa glfwSetWindowFocusCallback * @@ -750,7 +941,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); * @param[in] window The window that received the event. * @param[in] key The [keyboard key](@ref keys) that was pressed or released. * @param[in] scancode The system-specific scancode of the key. - * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT. + * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. * @param[in] mods Bit field describing which [modifier keys](@ref mods) were * held down. * @@ -773,6 +964,38 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int); */ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); +/*! @brief The function signature for Unicode character with modifiers + * callbacks. + * + * This is the function signature for Unicode character with modifiers callback + * functions. It is called for each input character, regardless of what + * modifier keys are held down. + * + * @param[in] window The window that received the event. + * @param[in] codepoint The Unicode code point of the character. + * @param[in] mods Bit field describing which [modifier keys](@ref mods) were + * held down. + * + * @sa glfwSetCharModsCallback + * + * @ingroup input + */ +typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int); + +/*! @brief The function signature for file drop callbacks. + * + * This is the function signature for file drop callbacks. + * + * @param[in] window The window that received the event. + * @param[in] count The number of dropped files. + * @param[in] names The UTF-8 encoded path names of the dropped files. + * + * @sa glfwSetDropCallback + * + * @ingroup input + */ +typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**); + /*! @brief The function signature for monitor configuration callbacks. * * This is the function signature for monitor configuration callback functions. @@ -838,6 +1061,21 @@ typedef struct GLFWgammaramp unsigned int size; } GLFWgammaramp; +/*! @brief Image data. + */ +typedef struct GLFWimage +{ + /*! The width, in pixels, of this image. + */ + int width; + /*! The height, in pixels, of this image. + */ + int height; + /*! The pixel data of this image, arranged left-to-right, top-to-bottom. + */ + unsigned char* pixels; +} GLFWimage; + /************************************************************************* * GLFW API functions @@ -846,53 +1084,70 @@ typedef struct GLFWgammaramp /*! @brief Initializes the GLFW library. * * This function initializes the GLFW library. Before most GLFW functions can - * be used, GLFW must be initialized, and before a program terminates GLFW + * be used, GLFW must be initialized, and before an application terminates GLFW * should be terminated in order to free any resources allocated during or * after initialization. * * If this function fails, it calls @ref glfwTerminate before returning. If it - * succeeds, you should call @ref glfwTerminate before the program exits. + * succeeds, you should call @ref glfwTerminate before the application exits. * * Additional calls to this function after successful initialization but before - * termination will succeed but will do nothing. + * termination will return `GL_TRUE` immediately. * - * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred. + * @return `GL_TRUE` if successful, or `GL_FALSE` if an + * [error](@ref error_handling) occurred. * - * @par New in GLFW 3 - * This function no longer registers @ref glfwTerminate with `atexit`. - * - * @note This function may only be called from the main thread. - * - * @note **OS X:** This function will change the current directory of the + * @remarks __OS X:__ This function will change the current directory of the * application to the `Contents/Resources` subdirectory of the application's - * bundle, if present. + * bundle, if present. This can be disabled with a + * [compile-time option](@ref compile_options_osx). * + * @remarks __X11:__ If the `LC_CTYPE` category of the current locale is set to + * `"C"` then the environment's locale will be applied to that category. This + * is done because character input will not function when `LC_CTYPE` is set to + * `"C"`. If another locale was set before this function was called, it will + * be left untouched. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref intro_init * @sa glfwTerminate * + * @since Added in GLFW 1.0. + * * @ingroup init */ GLFWAPI int glfwInit(void); /*! @brief Terminates the GLFW library. * - * This function destroys all remaining windows, frees any allocated resources - * and sets the library to an uninitialized state. Once this is called, you - * must again call @ref glfwInit successfully before you will be able to use - * most GLFW functions. + * This function destroys all remaining windows and cursors, restores any + * modified gamma ramps and frees any other allocated resources. Once this + * function is called, you must again call @ref glfwInit successfully before + * you will be able to use most GLFW functions. * * If GLFW has been successfully initialized, this function should be called - * before the program exits. If initialization fails, there is no need to call - * this function, as it is called by @ref glfwInit before it returns failure. + * before the application exits. If initialization fails, there is no need to + * call this function, as it is called by @ref glfwInit before it returns + * failure. * * @remarks This function may be called before @ref glfwInit. * - * @note This function may only be called from the main thread. - * * @warning No window's context may be current on another thread when this * function is called. * + * @par Reentrancy + * This function may not be called from a callback. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref intro_init * @sa glfwInit * + * @since Added in GLFW 1.0. + * * @ingroup init */ GLFWAPI void glfwTerminate(void); @@ -903,46 +1158,55 @@ GLFWAPI void glfwTerminate(void); * library. It is intended for when you are using GLFW as a shared library and * want to ensure that you are using the minimum required version. * + * Any or all of the version arguments may be `NULL`. This function always + * succeeds. + * * @param[out] major Where to store the major version number, or `NULL`. * @param[out] minor Where to store the minor version number, or `NULL`. * @param[out] rev Where to store the revision number, or `NULL`. * * @remarks This function may be called before @ref glfwInit. * - * @remarks This function may be called from any thread. + * @par Thread Safety + * This function may be called from any thread. * + * @sa @ref intro_version * @sa glfwGetVersionString * + * @since Added in GLFW 1.0. + * * @ingroup init */ GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); /*! @brief Returns a string describing the compile-time configuration. * - * This function returns a static string generated at compile-time according to - * which configuration macros were defined. This is intended for use when - * submitting bug reports, to allow developers to see which code paths are - * enabled in a binary. + * This function returns the compile-time generated + * [version string](@ref intro_version_string) of the GLFW library binary. It + * describes the version, platform, compiler and any platform-specific + * compile-time options. * - * The format of the string is as follows: - * - The version of GLFW - * - The name of the window system API - * - The name of the context creation API - * - Any additional options or APIs + * __Do not use the version string__ to parse the GLFW library version. The + * @ref glfwGetVersion function already provides the version of the running + * library binary. * - * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL - * back ends, the version string may look something like this: - * - * 3.0.0 Win32 WGL MinGW + * This function always succeeds. * * @return The GLFW version string. * * @remarks This function may be called before @ref glfwInit. * - * @remarks This function may be called from any thread. + * @par Pointer Lifetime + * The returned string is static and compile-time generated. * + * @par Thread Safety + * This function may be called from any thread. + * + * @sa @ref intro_version * @sa glfwGetVersion * + * @since Added in GLFW 3.0. + * * @ingroup init */ GLFWAPI const char* glfwGetVersionString(void); @@ -952,23 +1216,31 @@ GLFWAPI const char* glfwGetVersionString(void); * This function sets the error callback, which is called with an error code * and a human-readable description each time a GLFW error occurs. * + * The error callback is called on the thread where the error occurred. If you + * are using GLFW from multiple threads, your error callback needs to be + * written accordingly. + * + * Because the description string may have been generated specifically for that + * error, it is not guaranteed to be valid after the callback has returned. If + * you wish to use it after the callback returns, you need to make a copy. + * + * Once set, the error callback remains set even after the library has been + * terminated. + * * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set. * * @remarks This function may be called before @ref glfwInit. * - * @note The error callback is called by the thread where the error was - * generated. If you are using GLFW from multiple threads, your error callback - * needs to be written accordingly. + * @par Thread Safety + * This function may only be called from the main thread. * - * @note Because the description string provided to the callback may have been - * generated specifically for that error, it is not guaranteed to be valid - * after the callback has returned. If you wish to use it after that, you need - * to make your own copy of it before returning. + * @sa @ref error_handling * - * @ingroup error + * @since Added in GLFW 3.0. + * + * @ingroup init */ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); @@ -977,19 +1249,25 @@ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); * This function returns an array of handles for all currently connected * monitors. * - * @param[out] count Where to store the size of the returned array. This is - * set to zero if an error occurred. - * @return An array of monitor handles, or `NULL` if an error occurred. + * @param[out] count Where to store the number of monitors in the returned + * array. This is set to zero if an error occurred. + * @return An array of monitor handles, or `NULL` if an + * [error](@ref error_handling) occurred. * - * @note The returned array is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned array is allocated and freed by GLFW. You should not free it + * yourself. It is guaranteed to be valid only until the monitor configuration + * changes or the library is terminated. * - * @note The returned array is valid only until the monitor configuration - * changes. See @ref glfwSetMonitorCallback to receive notifications of - * configuration changes. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref monitor_monitors + * @sa @ref monitor_event * @sa glfwGetPrimaryMonitor * + * @since Added in GLFW 3.0. + * * @ingroup monitor */ GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); @@ -999,10 +1277,17 @@ GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); * This function returns the primary monitor. This is usually the monitor * where elements like the Windows task bar or the OS X menu bar is located. * - * @return The primary monitor, or `NULL` if an error occurred. + * @return The primary monitor, or `NULL` if an [error](@ref error_handling) + * occurred. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_monitors * @sa glfwGetMonitors * + * @since Added in GLFW 3.0. + * * @ingroup monitor */ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); @@ -1012,10 +1297,20 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); * This function returns the position, in screen coordinates, of the upper-left * corner of the specified monitor. * + * Any or all of the position arguments may be `NULL`. If an error occurs, all + * non-`NULL` position arguments will be set to zero. + * * @param[in] monitor The monitor to query. * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_properties + * + * @since Added in GLFW 3.0. + * * @ingroup monitor */ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); @@ -1025,31 +1320,55 @@ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); * This function returns the size, in millimetres, of the display area of the * specified monitor. * - * @param[in] monitor The monitor to query. - * @param[out] width Where to store the width, in mm, of the monitor's display - * area, or `NULL`. - * @param[out] height Where to store the height, in mm, of the monitor's - * display area, or `NULL`. + * Some systems do not provide accurate monitor size information, either + * because the monitor + * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data) + * data is incorrect or because the driver does not report it accurately. * - * @note Some operating systems do not provide accurate information, either - * because the monitor's EDID data is incorrect, or because the driver does not - * report it accurately. + * Any or all of the size arguments may be `NULL`. If an error occurs, all + * non-`NULL` size arguments will be set to zero. + * + * @param[in] monitor The monitor to query. + * @param[out] widthMM Where to store the width, in millimetres, of the + * monitor's display area, or `NULL`. + * @param[out] heightMM Where to store the height, in millimetres, of the + * monitor's display area, or `NULL`. + * + * @remarks __Windows:__ The OS calculates the returned physical size from the + * current resolution and system DPI instead of querying the monitor EDID data. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_properties + * + * @since Added in GLFW 3.0. * * @ingroup monitor */ -GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height); +GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM); /*! @brief Returns the name of the specified monitor. * * This function returns a human-readable name, encoded as UTF-8, of the - * specified monitor. + * specified monitor. The name typically reflects the make and model of the + * monitor and is not guaranteed to be unique among the connected monitors. * * @param[in] monitor The monitor to query. - * @return The UTF-8 encoded name of the monitor, or `NULL` if an error - * occurred. + * @return The UTF-8 encoded name of the monitor, or `NULL` if an + * [error](@ref error_handling) occurred. * - * @note The returned string is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned string is allocated and freed by GLFW. You should not free it + * yourself. It is valid until the specified monitor is disconnected or the + * library is terminated. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_properties + * + * @since Added in GLFW 3.0. * * @ingroup monitor */ @@ -1063,12 +1382,19 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor); * * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @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 + * @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. + * + * @sa @ref monitor_event + * + * @since Added in GLFW 3.0. + * * @ingroup monitor */ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); @@ -1083,16 +1409,25 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); * @param[in] monitor The monitor to query. * @param[out] count Where to store the number of video modes in the returned * array. This is set to zero if an error occurred. - * @return An array of video modes, or `NULL` if an error occurred. + * @return An array of video modes, or `NULL` if an + * [error](@ref error_handling) occurred. * - * @note The returned array is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned array is allocated and freed by GLFW. You should not free it + * yourself. It is valid until the specified monitor is disconnected, this + * function is called again for that monitor or the library is terminated. * - * @note The returned array is valid only until this function is called again - * for the specified monitor. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref monitor_modes * @sa glfwGetVideoMode * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Changed to return an array of modes for a specific monitor. + * * @ingroup monitor */ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); @@ -1100,17 +1435,26 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); /*! @brief Returns the current mode of the specified monitor. * * This function returns the current video mode of the specified monitor. If - * you are using a full screen window, the return value will therefore depend - * on whether it is focused. + * you have created a full screen window for that monitor, the return value + * will depend on whether that window is iconified. * * @param[in] monitor The monitor to query. - * @return The current mode of the monitor, or `NULL` if an error occurred. + * @return The current mode of the monitor, or `NULL` if an + * [error](@ref error_handling) occurred. * - * @note The returned struct is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned array is allocated and freed by GLFW. You should not free it + * yourself. It is valid until the specified monitor is disconnected or the + * library is terminated. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_modes * @sa glfwGetVideoModes * + * @since Added in GLFW 3.0. Replaces `glfwGetDesktopMode`. + * * @ingroup monitor */ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); @@ -1123,19 +1467,37 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); * @param[in] monitor The monitor whose gamma ramp to set. * @param[in] gamma The desired exponent. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_gamma + * + * @since Added in GLFW 3.0. + * * @ingroup monitor */ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); -/*! @brief Retrieves the current gamma ramp for the specified monitor. +/*! @brief Returns the current gamma ramp for the specified monitor. * - * This function retrieves the current gamma ramp of the specified monitor. + * This function returns the current gamma ramp of the specified monitor. * * @param[in] monitor The monitor to query. - * @return The current gamma ramp, or `NULL` if an error occurred. + * @return The current gamma ramp, or `NULL` if an + * [error](@ref error_handling) occurred. * - * @note The value arrays of the returned ramp are allocated and freed by GLFW. - * You should not free them yourself. + * @par Pointer Lifetime + * The returned structure and its arrays are allocated and freed by GLFW. You + * should not free them yourself. They are valid until the specified monitor + * is disconnected, this function is called again for that monitor or the + * library is terminated. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_gamma + * + * @since Added in GLFW 3.0. * * @ingroup monitor */ @@ -1143,13 +1505,25 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); /*! @brief Sets the current gamma ramp for the specified monitor. * - * This function sets the current gamma ramp for the specified monitor. + * This function sets the current gamma ramp for the specified monitor. The + * original gamma ramp for that monitor is saved by GLFW the first time this + * function is called and is restored by @ref glfwTerminate. * * @param[in] monitor The monitor whose gamma ramp to set. * @param[in] ramp The gamma ramp to use. * * @note Gamma ramp sizes other than 256 are not supported by all hardware. * + * @par Pointer Lifetime + * The specified gamma ramp is copied before this function returns. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref monitor_gamma + * + * @since Added in GLFW 3.0. + * * @ingroup monitor */ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); @@ -1159,10 +1533,14 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp); * This function resets all window hints to their * [default values](@ref window_hints_values). * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_hints * @sa glfwWindowHint * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void glfwDefaultWindowHints(void); @@ -1172,52 +1550,70 @@ GLFWAPI void glfwDefaultWindowHints(void); * This function sets hints for the next call to @ref glfwCreateWindow. The * hints, once set, retain their values until changed by a call to @ref * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is - * terminated with @ref glfwTerminate. + * terminated. * * @param[in] target The [window hint](@ref window_hints) to set. * @param[in] hint The new value of the window hint. * - * @par New in GLFW 3 - * Hints are no longer reset to their default values on window creation. To - * set default hint values, use @ref glfwDefaultWindowHints. - * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_hints * @sa glfwDefaultWindowHints * + * @since Added in GLFW 3.0. Replaces `glfwOpenWindowHint`. + * * @ingroup window */ GLFWAPI void glfwWindowHint(int target, int hint); /*! @brief Creates a window and its associated context. * - * This function creates a window and its associated context. Most of the - * options controlling how the window and its context should be created are - * specified through @ref glfwWindowHint. + * This function creates a window and its associated OpenGL or OpenGL ES + * context. Most of the options controlling how the window and its context + * should be created are specified with [window hints](@ref window_hints). * * Successful creation does not change which context is current. Before you - * can use the newly created context, you need to make it current using @ref - * glfwMakeContextCurrent. + * can use the newly created context, you need to + * [make it current](@ref context_current). For information about the `share` + * parameter, see @ref context_sharing. * - * Note that the created window and context may differ from what you requested, - * as not all parameters and hints are + * The created window, framebuffer and context may differ from what you + * requested, as not all parameters and hints are * [hard constraints](@ref window_hints_hard). This includes the size of the - * window, especially for full screen windows. To retrieve the actual - * attributes of the created window and context, use queries like @ref + * window, especially for full screen windows. To query the actual attributes + * of the created window, framebuffer and context, use queries like @ref * glfwGetWindowAttrib and @ref glfwGetWindowSize. * - * To create a full screen window, you need to specify the monitor to use. If - * no monitor is specified, windowed mode will be used. Unless you have a way - * for the user to choose a specific monitor, it is recommended that you pick - * the primary monitor. For more information on how to retrieve monitors, see - * @ref monitor_monitors. + * To create a full screen window, you need to specify the monitor the window + * will cover. If no monitor is specified, windowed mode will be used. Unless + * you have a way for the user to choose a specific monitor, it is recommended + * that you pick the primary monitor. For more information on how to query + * connected monitors, see @ref monitor_monitors. * - * To create the window at a specific position, make it initially invisible - * using the `GLFW_VISIBLE` window hint, set its position and then show it. + * For full screen windows, the specified size becomes the resolution of the + * window's _desired video mode_. As long as a full screen window has input + * focus, the supported video mode most closely matching the desired video mode + * is set for the specified monitor. For more information about full screen + * windows, including the creation of so called _windowed full screen_ or + * _borderless full screen_ windows, see @ref window_windowed_full_screen. * - * If a full screen window is active, the screensaver is prohibited from + * By default, newly created windows use the placement recommended by the + * window system. To create the window at a specific position, make it + * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window + * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) + * it. + * + * If a full screen window has input focus, the screensaver is prohibited from * starting. * + * Window systems put limits on window sizes. Very large or very small window + * dimensions may be overridden by the window system on creation. Check the + * actual [size](@ref window_size) after creation. + * + * The [swap interval](@ref buffer_swap) is not set during window creation and + * the initial value may vary depending on driver settings and defaults. + * * @param[in] width The desired width, in screen coordinates, of the window. * This must be greater than zero. * @param[in] height The desired height, in screen coordinates, of the window. @@ -1227,32 +1623,47 @@ GLFWAPI void glfwWindowHint(int target, int hint); * windowed mode. * @param[in] share The window whose context to share resources with, or `NULL` * to not share resources. - * @return The handle of the created window, or `NULL` if an error occurred. + * @return The handle of the created window, or `NULL` if an + * [error](@ref error_handling) occurred. * - * @remarks **Windows:** Window creation will fail if the Microsoft GDI + * @remarks __Windows:__ Window creation will fail if the Microsoft GDI * software OpenGL implementation is the only one available. * - * @remarks **Windows:** If the executable has an icon resource named + * @remarks __Windows:__ If the executable has an icon resource named * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is * present, the `IDI_WINLOGO` icon will be used instead. * - * @remarks **OS X:** The GLFW window has no icon, as it is not a document + * @remarks __Windows:__ The context to share resources with may not be current + * on any other thread. + * + * @remarks __OS X:__ The GLFW window has no icon, as it is not a document * window, but the dock icon will be the same as the application bundle's icon. - * Also, the first time a window is opened the menu bar is populated with - * common commands like Hide, Quit and About. The (minimal) about dialog uses - * information from the application's bundle. For more information on bundles, - * see the Bundle Programming Guide provided by Apple. + * For more information on bundles, see the + * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/) + * in the Mac Developer Library. * - * @remarks **X11:** There is no mechanism for setting the window icon yet. + * @remarks __OS X:__ The first time a window is created the menu bar is + * populated with common commands like Hide, Quit and About. The About entry + * opens a minimal about dialog with information from the application's bundle. + * The menu bar can be disabled with a + * [compile-time option](@ref compile_options_osx). * - * @remarks The swap interval is not set during window creation, but is left at - * the default value for that platform. For more information, see @ref - * glfwSwapInterval. + * @remarks __X11:__ There is no mechanism for setting the window icon yet. * - * @note This function may only be called from the main thread. + * @remarks __X11:__ Some window managers will not respect the placement of + * initially hidden windows. * + * @par Reentrancy + * This function may not be called from a callback. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_creation * @sa glfwDestroyWindow * + * @since Added in GLFW 3.0. Replaces `glfwOpenWindow`. + * * @ingroup window */ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); @@ -1262,19 +1673,25 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, G * This function destroys the specified window and its context. On calling * this function, no further callbacks will be called for that window. * - * @param[in] window The window to destroy. - * - * @note This function may only be called from the main thread. - * - * @note This function may not be called from a callback. - * - * @note If the window's context is current on the main thread, it is + * If the context of the specified window is current on the main thread, it is * detached before being destroyed. * - * @warning The window's context must not be current on any other thread. + * @param[in] window The window to destroy. * + * @note The context of the specified window must not be current on any other + * thread when this function is called. + * + * @par Reentrancy + * This function may not be called from a callback. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_creation * @sa glfwCreateWindow * + * @since Added in GLFW 3.0. Replaces `glfwCloseWindow`. + * * @ingroup window */ GLFWAPI void glfwDestroyWindow(GLFWwindow* window); @@ -1286,7 +1703,12 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* window); * @param[in] window The window to query. * @return The value of the close flag. * - * @remarks This function may be called from secondary threads. + * @par Thread Safety + * This function may be called from any thread. Access is not synchronized. + * + * @sa @ref window_close + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1301,7 +1723,12 @@ GLFWAPI int glfwWindowShouldClose(GLFWwindow* window); * @param[in] window The window whose flag to change. * @param[in] value The new value. * - * @remarks This function may be called from secondary threads. + * @par Thread Safety + * This function may be called from any thread. Access is not synchronized. + * + * @sa @ref window_close + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1315,7 +1742,15 @@ GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value); * @param[in] window The window whose title to change. * @param[in] title The UTF-8 encoded window title. * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_title + * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. * * @ingroup window */ @@ -1326,14 +1761,23 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title); * This function retrieves the position, in screen coordinates, of the * upper-left corner of the client area of the specified window. * + * Any or all of the position arguments may be `NULL`. If an error occurs, all + * non-`NULL` position arguments will be set to zero. + * * @param[in] window The window to query. * @param[out] xpos Where to store the x-coordinate of the upper-left corner of * the client area, or `NULL`. * @param[out] ypos Where to store the y-coordinate of the upper-left corner of * the client area, or `NULL`. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_pos * @sa glfwSetWindowPos * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); @@ -1341,27 +1785,30 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); /*! @brief Sets the position of the client area of the specified window. * * This function sets the position, in screen coordinates, of the upper-left - * corner of the client area of the window. + * corner of the client area of the specified windowed mode window. If the + * window is a full screen window, this function does nothing. * - * If the specified window is a full screen window, this function does nothing. + * __Do not use this function__ to move an already visible window unless you + * have very good reasons for doing so, as it will confuse and annoy the user. * - * If you wish to set an initial window position you should create a hidden - * window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its position and - * then show it. + * The window manager may put limits on what positions are allowed. GLFW + * cannot and should not override these limits. * * @param[in] window The window to query. * @param[in] xpos The x-coordinate of the upper-left corner of the client area. * @param[in] ypos The y-coordinate of the upper-left corner of the client area. * - * @note It is very rarely a good idea to move an already visible window, as it - * will confuse and annoy the user. - * - * @note This function may only be called from the main thread. - * - * @note The window manager may put limits on what positions are allowed. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_pos * @sa glfwGetWindowPos * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * * @ingroup window */ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); @@ -1370,7 +1817,10 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); * * This function retrieves the size, in screen coordinates, of the client area * of the specified window. If you wish to retrieve the size of the - * framebuffer in pixels, see @ref glfwGetFramebufferSize. + * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize. + * + * Any or all of the size arguments may be `NULL`. If an error occurs, all + * non-`NULL` size arguments will be set to zero. * * @param[in] window The window whose size to retrieve. * @param[out] width Where to store the width, in screen coordinates, of the @@ -1378,8 +1828,17 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos); * @param[out] height Where to store the height, in screen coordinates, of the * client area, or `NULL`. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_size * @sa glfwSetWindowSize * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * * @ingroup window */ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); @@ -1394,16 +1853,24 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); * the context is unaffected, the bit depths of the framebuffer remain * unchanged. * + * The window manager may put limits on what sizes are allowed. GLFW cannot + * and should not override these limits. + * * @param[in] window The window to resize. * @param[in] width The desired width of the specified window. * @param[in] height The desired height of the specified window. * - * @note This function may only be called from the main thread. - * - * @note The window manager may put limits on what window sizes are allowed. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_size * @sa glfwGetWindowSize * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * * @ingroup window */ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); @@ -1414,80 +1881,149 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); * specified window. If you wish to retrieve the size of the window in screen * coordinates, see @ref glfwGetWindowSize. * + * Any or all of the size arguments may be `NULL`. If an error occurs, all + * non-`NULL` size arguments will be set to zero. + * * @param[in] window The window whose framebuffer to query. * @param[out] width Where to store the width, in pixels, of the framebuffer, * or `NULL`. * @param[out] height Where to store the height, in pixels, of the framebuffer, * or `NULL`. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_fbsize * @sa glfwSetFramebufferSizeCallback * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); +/*! @brief Retrieves the size of the frame of the window. + * + * This function retrieves the size, in screen coordinates, of each edge of the + * frame of the specified window. This size includes the title bar, if the + * window has one. The size of the frame may vary depending on the + * [window-related hints](@ref window_hints_wnd) used to create it. + * + * Because this function retrieves the size of each window frame edge and not + * the offset along a particular coordinate axis, the retrieved values will + * always be zero or positive. + * + * Any or all of the size arguments may be `NULL`. If an error occurs, all + * non-`NULL` size arguments will be set to zero. + * + * @param[in] window The window whose frame size to query. + * @param[out] left Where to store the size, in screen coordinates, of the left + * edge of the window frame, or `NULL`. + * @param[out] top Where to store the size, in screen coordinates, of the top + * edge of the window frame, or `NULL`. + * @param[out] right Where to store the size, in screen coordinates, of the + * right edge of the window frame, or `NULL`. + * @param[out] bottom Where to store the size, in screen coordinates, of the + * bottom edge of the window frame, or `NULL`. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_size + * + * @since Added in GLFW 3.1. + * + * @ingroup window + */ +GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom); + /*! @brief Iconifies the specified window. * - * This function iconifies/minimizes the specified window, if it was previously - * restored. If it is a full screen window, the original monitor resolution is - * restored until the window is restored. If the window is already iconified, - * this function does nothing. + * This function iconifies (minimizes) the specified window if it was + * previously restored. If the window is already iconified, this function does + * nothing. + * + * If the specified window is a full screen window, the original monitor + * resolution is restored until the window is restored. * * @param[in] window The window to iconify. * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_iconify * @sa glfwRestoreWindow * + * @since Added in GLFW 2.1. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * * @ingroup window */ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); /*! @brief Restores the specified window. * - * This function restores the specified window, if it was previously - * iconified/minimized. If it is a full screen window, the resolution chosen - * for the window is restored on the selected monitor. If the window is - * already restored, this function does nothing. + * This function restores the specified window if it was previously iconified + * (minimized). If the window is already restored, this function does nothing. + * + * If the specified window is a full screen window, the resolution chosen for + * the window is restored on the selected monitor. * * @param[in] window The window to restore. * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_iconify * @sa glfwIconifyWindow * + * @since Added in GLFW 2.1. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * * @ingroup window */ GLFWAPI void glfwRestoreWindow(GLFWwindow* window); /*! @brief Makes the specified window visible. * - * This function makes the specified window visible, if it was previously + * This function makes the specified window visible if it was previously * hidden. If the window is already visible or is in full screen mode, this * function does nothing. * * @param[in] window The window to make visible. * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_hide * @sa glfwHideWindow * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void glfwShowWindow(GLFWwindow* window); /*! @brief Hides the specified window. * - * This function hides the specified window, if it was previously visible. If + * This function hides the specified window if it was previously visible. If * the window is already hidden or is in full screen mode, this function does * nothing. * * @param[in] window The window to hide. * - * @note This function may only be called from the main thread. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref window_hide * @sa glfwShowWindow * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void glfwHideWindow(GLFWwindow* window); @@ -1498,7 +2034,15 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window); * in full screen on. * * @param[in] window The window to query. - * @return The monitor, or `NULL` if the window is in windowed mode. + * @return The monitor, or `NULL` if the window is in windowed mode or an error + * occurred. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_monitor + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1506,13 +2050,22 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window); /*! @brief Returns an attribute of the specified window. * - * This function returns an attribute of the specified window. There are many - * attributes, some related to the window and others to its context. + * This function returns the value of an attribute of the specified window or + * its OpenGL or OpenGL ES context. * * @param[in] window The window to query. * @param[in] attrib The [window attribute](@ref window_attribs) whose value to * return. - * @return The value of the attribute, or zero if an error occurred. + * @return The value of the attribute, or zero if an + * [error](@ref error_handling) occurred. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_attribs + * + * @since Added in GLFW 3.0. Replaces `glfwGetWindowParam` and + * `glfwGetGLVersion`. * * @ingroup window */ @@ -1527,8 +2080,14 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); * @param[in] window The window whose pointer to set. * @param[in] pointer The new value. * + * @par Thread Safety + * This function may be called from any thread. Access is not synchronized. + * + * @sa @ref window_userptr * @sa glfwGetWindowUserPointer * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); @@ -1540,8 +2099,14 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); * * @param[in] window The window whose pointer to return. * + * @par Thread Safety + * This function may be called from any thread. Access is not synchronized. + * + * @sa @ref window_userptr * @sa glfwSetWindowUserPointer * + * @since Added in GLFW 3.0. + * * @ingroup window */ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); @@ -1555,8 +2120,15 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_pos + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1571,8 +2143,18 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_size + * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. Updated callback signature. * * @ingroup window */ @@ -1592,15 +2174,22 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). * - * @par New in GLFW 3 - * The close callback no longer returns a value. - * - * @remarks **OS X:** Selecting Quit from the application menu will + * @remarks __OS X:__ Selecting Quit from the application menu will * trigger the close callback for all windows. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_close + * + * @since Added in GLFW 2.5. + * + * @par + * __GLFW 3:__ Added window handle parameter. Updated callback signature. + * * @ingroup window */ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); @@ -1618,12 +2207,18 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). * - * @note On compositing window systems such as Aero, Compiz or Aqua, where the - * window contents are saved off-screen, this callback may be called only very - * infrequently or never at all. + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_refresh + * + * @since Added in GLFW 2.5. + * + * @par + * __GLFW 3:__ Added window handle parameter. Updated callback signature. * * @ingroup window */ @@ -1632,18 +2227,25 @@ GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GL /*! @brief Sets the focus callback for the specified window. * * This function sets the focus callback of the specified window, which is - * called when the window gains or loses focus. + * called when the window gains or loses input focus. * - * After the focus callback is called for a window that lost focus, synthetic - * key and mouse button release events will be generated for all such that had - * been pressed. For more information, see @ref glfwSetKeyCallback and @ref - * glfwSetMouseButtonCallback. + * After the focus callback is called for a window that lost input focus, + * synthetic key and mouse button release events will be generated for all such + * that had been pressed. For more information, see @ref glfwSetKeyCallback + * and @ref glfwSetMouseButtonCallback. * * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_focus + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1657,8 +2259,15 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_iconify + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1672,8 +2281,15 @@ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GL * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref window_fbsize + * + * @since Added in GLFW 3.0. * * @ingroup window */ @@ -1681,114 +2297,164 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window /*! @brief Processes all pending events. * - * This function processes only those events that have already been received - * and then returns immediately. Processing events will cause the window and - * input callbacks associated with those events to be called. + * This function processes only those events that are already in the event + * queue and then returns immediately. Processing events will cause the window + * and input callbacks associated with those events to be called. * - * This function is not required for joystick input to work. + * On some platforms, a window move, resize or menu operation will cause event + * processing to block. This is due to how event processing is designed on + * those platforms. You can use the + * [window refresh callback](@ref window_refresh) to redraw the contents of + * your window when necessary during such operations. * - * @par New in GLFW 3 - * This function is no longer called by @ref glfwSwapBuffers. You need to call - * it or @ref glfwWaitEvents yourself. + * On some platforms, certain events are sent directly to the application + * without going through the event queue, causing callbacks to be called + * outside of a call to one of the event processing functions. * - * @remarks On some platforms, a window move, resize or menu operation will - * cause event processing to block. This is due to how event processing is - * designed on those platforms. You can use the - * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents - * of your window when necessary during the operation. + * Event processing is not required for joystick input to work. * - * @note This function may only be called from the main thread. + * @par Reentrancy + * This function may not be called from a callback. * - * @note This function may not be called from a callback. - * - * @note On some platforms, certain callbacks may be called outside of a call - * to one of the event processing functions. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref events * @sa glfwWaitEvents * + * @since Added in GLFW 1.0. + * * @ingroup window */ GLFWAPI void glfwPollEvents(void); -/*! @brief Waits until events are pending and processes them. +/*! @brief Waits until events are queued and processes them. * - * This function puts the calling thread to sleep until at least one event has - * been received. Once one or more events have been received, it behaves as if - * @ref glfwPollEvents was called, i.e. the events are processed and the - * function then returns immediately. Processing events will cause the window - * and input callbacks associated with those events to be called. + * This function puts the calling thread to sleep until at least one event is + * available in the event queue. Once one or more events are available, + * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue + * are processed and the function then returns immediately. Processing events + * will cause the window and input callbacks associated with those events to be + * called. * * Since not all events are associated with callbacks, this function may return * without a callback having been called even if you are monitoring all * callbacks. * - * This function is not required for joystick input to work. + * On some platforms, a window move, resize or menu operation will cause event + * processing to block. This is due to how event processing is designed on + * those platforms. You can use the + * [window refresh callback](@ref window_refresh) to redraw the contents of + * your window when necessary during such operations. * - * @remarks On some platforms, a window move, resize or menu operation will - * cause event processing to block. This is due to how event processing is - * designed on those platforms. You can use the - * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents - * of your window when necessary during the operation. + * On some platforms, certain callbacks may be called outside of a call to one + * of the event processing functions. * - * @note This function may only be called from the main thread. + * If no windows exist, this function returns immediately. For synchronization + * of threads in applications that do not create windows, use your threading + * library of choice. * - * @note This function may not be called from a callback. + * Event processing is not required for joystick input to work. * - * @note On some platforms, certain callbacks may be called outside of a call - * to one of the event processing functions. + * @par Reentrancy + * This function may not be called from a callback. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref events * @sa glfwPollEvents * + * @since Added in GLFW 2.5. + * * @ingroup window */ GLFWAPI void glfwWaitEvents(void); +/*! @brief Posts an empty event to the event queue. + * + * This function posts an empty event from the current thread to the event + * queue, causing @ref glfwWaitEvents to return. + * + * If no windows exist, this function returns immediately. For synchronization + * of threads in applications that do not create windows, use your threading + * library of choice. + * + * @par Thread Safety + * This function may be called from any thread. + * + * @sa @ref events + * @sa glfwWaitEvents + * + * @since Added in GLFW 3.1. + * + * @ingroup window + */ +GLFWAPI void glfwPostEmptyEvent(void); + /*! @brief Returns the value of an input option for the specified window. + * + * This function returns the value of an input option for the specified window. + * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or + * `GLFW_STICKY_MOUSE_BUTTONS`. * * @param[in] window The window to query. * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or * `GLFW_STICKY_MOUSE_BUTTONS`. * + * @par Thread Safety + * This function may only be called from the main thread. + * * @sa glfwSetInputMode * + * @since Added in GLFW 3.0. + * * @ingroup input */ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); /*! @brief Sets an input option for the specified window. + * + * This function sets an input mode option for the specified window. The mode + * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or + * `GLFW_STICKY_MOUSE_BUTTONS`. + * + * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor + * modes: + * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. + * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client + * area of the window but does not restrict the cursor from leaving. + * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual + * 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 `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 + * `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 * `GLFW_STICKY_MOUSE_BUTTONS`. * @param[in] value The new value of the specified input mode. * - * If `mode` is `GLFW_CURSOR`, the value must be one of the supported input - * modes: - * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. - * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client - * area of the window but does not restrict the cursor from leaving. This is - * useful if you wish to render your own cursor or have no visible cursor at - * all. - * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual - * and unlimited cursor movement. This is useful for implementing for - * example 3D camera controls. - * - * If `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 @ref - * 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 `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `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 @ref 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. + * @par Thread Safety + * This function may only be called from the main thread. * * @sa glfwGetInputMode * + * @since Added in GLFW 3.0. Replaces `glfwEnable` and `glfwDisable`. + * * @ingroup input */ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); @@ -1798,22 +2464,34 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); * * This function returns the last state reported for the specified key to the * specified window. The returned state is one of `GLFW_PRESS` or - * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to + * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to * the key callback. * * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns - * `GLFW_PRESS` the first time you call this function after a key has been - * pressed, even if the key has already been released. + * `GLFW_PRESS` the first time you call it for a key that was pressed, even if + * that key has already been released. * * The key functions deal with physical keys, with [key tokens](@ref keys) * named after their use on the standard US keyboard layout. If you want to * input text, use the Unicode character callback instead. * + * The [modifier key bit masks](@ref mods) are not key tokens and cannot be + * used with this function. + * * @param[in] window The desired window. - * @param[in] key The desired [keyboard key](@ref keys). + * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is + * not a valid key for this function. * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. * - * @note `GLFW_KEY_UNKNOWN` is not a valid key for this function. + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref input_key + * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. * * @ingroup input */ @@ -1823,26 +2501,37 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key); * window. * * This function returns the last state reported for the specified mouse button - * to the specified window. + * to the specified window. The returned state is one of `GLFW_PRESS` or + * `GLFW_RELEASE`. * * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function - * returns `GLFW_PRESS` the first time you call this function after a mouse - * button has been pressed, even if the mouse button has already been released. + * `GLFW_PRESS` the first time you call it for a mouse button that was pressed, + * even if that mouse button has already been released. * * @param[in] window The desired window. * @param[in] button The desired [mouse button](@ref buttons). * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref input_mouse_button + * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * * @ingroup input */ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); -/*! @brief Retrieves the last reported cursor position, relative to the client - * area of the window. +/*! @brief Retrieves the position of the cursor relative to the client area of + * the window. * - * This function returns the last reported position of the cursor, in screen - * coordinates, relative to the upper-left corner of the client area of the - * specified window. + * This function returns the position of the cursor, in screen coordinates, + * relative to the upper-left corner of the client area of the specified + * window. * * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor * position is unbounded and limited only by the minimum and maximum values of @@ -1852,14 +2541,23 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); * `floor` function. Casting directly to an integer type works for positive * coordinates, but fails for negative ones. * + * Any or all of the position arguments may be `NULL`. If an error occurs, all + * non-`NULL` position arguments will be set to zero. + * * @param[in] window The desired window. * @param[out] xpos Where to store the cursor x-coordinate, relative to the * left edge of the client area, or `NULL`. * @param[out] ypos Where to store the cursor y-coordinate, relative to the to * top edge of the client area, or `NULL`. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_pos * @sa glfwSetCursorPos * + * @since Added in GLFW 3.0. Replaces `glfwGetMousePos`. + * * @ingroup input */ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); @@ -1869,11 +2567,16 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); * * This function sets the position, in screen coordinates, of the cursor * relative to the upper-left corner of the client area of the specified - * window. The window must be focused. If the window does not have focus when - * this function is called, it fails silently. + * window. The window must have input focus. If the window does not have + * input focus when this function is called, it fails silently. * - * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor - * position is unbounded and limited only by the minimum and maximum values of + * __Do not use this function__ to implement things like camera controls. GLFW + * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the + * cursor, transparently re-centers it and provides unconstrained cursor + * motion. See @ref glfwSetInputMode for more information. + * + * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is + * unconstrained and limited only by the minimum and maximum values of * a `double`. * * @param[in] window The desired window. @@ -1882,15 +2585,138 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); * @param[in] ypos The desired y-coordinate, relative to the top edge of the * client area. * + * @remarks __X11:__ Due to the asynchronous nature of a modern X desktop, it + * may take a moment for the window focus event to arrive. This means you will + * not be able to set the cursor position directly after window creation. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_pos * @sa glfwGetCursorPos * + * @since Added in GLFW 3.0. Replaces `glfwSetMousePos`. + * * @ingroup input */ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); +/*! @brief Creates a custom cursor. + * + * Creates a new custom cursor image that can be set for a window with @ref + * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. + * Any remaining cursors are destroyed by @ref glfwTerminate. + * + * The pixels are 32-bit little-endian RGBA, i.e. eight bits per channel. They + * are arranged canonically as packed sequential rows, starting from the + * top-left corner. + * + * The cursor hotspot is specified in pixels, relative to the upper-left corner + * of the cursor image. Like all other coordinate systems in GLFW, the X-axis + * points to the right and the Y-axis points down. + * + * @param[in] image The desired cursor image. + * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. + * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot. + * + * @return The handle of the created cursor, or `NULL` if an + * [error](@ref error_handling) occurred. + * + * @par Pointer Lifetime + * The specified image data is copied before this function returns. + * + * @par Reentrancy + * This function may not be called from a callback. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_object + * @sa glfwDestroyCursor + * @sa glfwCreateStandardCursor + * + * @since Added in GLFW 3.1. + * + * @ingroup input + */ +GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); + +/*! @brief Creates a cursor with a standard shape. + * + * Returns a cursor with a [standard shape](@ref shapes), that can be set for + * a window with @ref glfwSetCursor. + * + * @param[in] shape One of the [standard shapes](@ref shapes). + * + * @return A new cursor ready to use or `NULL` if an + * [error](@ref error_handling) occurred. + * + * @par Reentrancy + * This function may not be called from a callback. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_object + * @sa glfwCreateCursor + * + * @since Added in GLFW 3.1. + * + * @ingroup input + */ +GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape); + +/*! @brief Destroys a cursor. + * + * This function destroys a cursor previously created with @ref + * glfwCreateCursor. Any remaining cursors will be destroyed by @ref + * glfwTerminate. + * + * @param[in] cursor The cursor object to destroy. + * + * @par Reentrancy + * This function may not be called from a callback. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_object + * @sa glfwCreateCursor + * + * @since Added in GLFW 3.1. + * + * @ingroup input + */ +GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor); + +/*! @brief Sets the cursor for the window. + * + * This function sets the cursor image to be used when the cursor is over the + * client area of the specified window. The set cursor will only be visible + * when the [cursor mode](@ref cursor_mode) of the window is + * `GLFW_CURSOR_NORMAL`. + * + * On some platforms, the set cursor may not be visible unless the window also + * has input focus. + * + * @param[in] window The window to set the cursor for. + * @param[in] cursor The cursor to set, or `NULL` to switch back to the default + * arrow cursor. + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_object + * + * @since Added in GLFW 3.1. + * + * @ingroup input + */ +GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); + /*! @brief Sets the key callback. * - * This function sets the key callback of the specific window, which is called + * This function sets the key callback of the specified window, which is called * when a key is pressed, repeated or released. * * The key functions deal with physical keys, with layout independent @@ -1898,16 +2724,16 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); * layout. If you want to input text, use the * [character callback](@ref glfwSetCharCallback) instead. * - * When a window loses focus, it will generate synthetic key release events - * for all pressed keys. You can tell these events from user-generated events - * by the fact that the synthetic ones are generated after the window has lost - * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have - * already been called. + * When a window loses input focus, it will generate synthetic key release + * events for all pressed keys. You can tell these events from user-generated + * events by the fact that the synthetic ones are generated after the focus + * loss event has been processed, i.e. after the + * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. * * The scancode of a key is specific to that platform or sometimes even to that * machine. Scancodes are intended to allow users to bind keys that don't have * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their - * state is not saved and so it cannot be retrieved with @ref glfwGetKey. + * state is not saved and so it cannot be queried with @ref glfwGetKey. * * Sometimes GLFW needs to generate synthetic key events, in which case the * scancode may be zero. @@ -1915,8 +2741,18 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); * @param[in] window The window whose callback to set. * @param[in] cbfun The new key callback, or `NULL` to remove the currently * set callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref input_key + * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. Updated callback signature. * * @ingroup input */ @@ -1924,11 +2760,56 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); /*! @brief Sets the Unicode character callback. * - * This function sets the character callback of the specific window, which is + * This function sets the character callback of the specified window, which is * called when a Unicode character is input. * - * The character callback is intended for text input. If you want to know - * whether a specific key was pressed or released, use the + * The character callback is intended for Unicode text input. As it deals with + * characters, it is keyboard layout dependent, whereas the + * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1 + * to physical keys, as a key may produce zero, one or more characters. If you + * want to know whether a specific physical key was pressed or released, see + * the key callback instead. + * + * The character callback behaves as system text input normally does and will + * not be called if modifier keys are held down that would prevent normal text + * input on that platform, for example a Super (Command) key on OS X or Alt key + * on Windows. There is a + * [character with modifiers callback](@ref glfwSetCharModsCallback) that + * receives these events. + * + * @param[in] window The window whose callback to set. + * @param[in] cbfun The new callback, or `NULL` to remove the currently set + * callback. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref input_char + * + * @since Added in GLFW 2.4. + * + * @par + * __GLFW 3:__ Added window handle parameter. Updated callback signature. + * + * @ingroup input + */ +GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); + +/*! @brief Sets the Unicode character with modifiers callback. + * + * This function sets the character with modifiers callback of the specified + * window, which is called when a Unicode character is input regardless of what + * modifier keys are used. + * + * The character with modifiers callback is intended for implementing custom + * Unicode character input. For regular Unicode text input, see the + * [character callback](@ref glfwSetCharCallback). Like the character + * callback, the character with modifiers callback deals with characters and is + * keyboard layout dependent. Characters do not map 1:1 to physical keys, as + * a key may produce zero, one or more characters. If you want to know whether + * a specific physical key was pressed or released, see the * [key callback](@ref glfwSetKeyCallback) instead. * * @param[in] window The window whose callback to set. @@ -1937,26 +2818,43 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); * @return The previously set callback, or `NULL` if no callback was set or an * error occurred. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref input_char + * + * @since Added in GLFW 3.1. + * * @ingroup input */ -GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); +GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun); /*! @brief Sets the mouse button callback. * * This function sets the mouse button callback of the specified window, which * is called when a mouse button is pressed or released. * - * When a window loses focus, it will generate synthetic mouse button release - * events for all pressed mouse buttons. You can tell these events from - * user-generated events by the fact that the synthetic ones are generated - * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the - * focus callback will have already been called. + * When a window loses input focus, it will generate synthetic mouse button + * release events for all pressed mouse buttons. You can tell these events + * from user-generated events by the fact that the synthetic ones are generated + * after the focus loss event has been processed, i.e. after the + * [window focus callback](@ref glfwSetWindowFocusCallback) has been called. * * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref input_mouse_button + * + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. Updated callback signature. * * @ingroup input */ @@ -1972,8 +2870,15 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmo * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_pos + * + * @since Added in GLFW 3.0. Replaces `glfwSetMousePosCallback`. * * @ingroup input */ @@ -1988,8 +2893,15 @@ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursor * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref cursor_enter + * + * @since Added in GLFW 3.0. * * @ingroup input */ @@ -2007,20 +2919,61 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcu * @param[in] window The window whose callback to set. * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently * set callback. - * @return The previously set callback, or `NULL` if no callback was set or an - * error occurred. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref scrolling + * + * @since Added in GLFW 3.0. Replaces `glfwSetMouseWheelCallback`. * * @ingroup input */ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); +/*! @brief Sets the file drop callback. + * + * This function sets the file drop callback of the specified window, which is + * called when one or more dragged files are dropped on the window. + * + * Because the path array and its strings may have been generated specifically + * for that event, they are not guaranteed to be valid after the callback has + * returned. If you wish to use them after the callback returns, you need to + * make a deep copy. + * + * @param[in] window The window whose callback to set. + * @param[in] cbfun The new file drop callback, or `NULL` to remove the + * currently set callback. + * @return The previously set callback, or `NULL` if no callback was set or the + * library had not been [initialized](@ref intro_init). + * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref path_drop + * + * @since Added in GLFW 3.1. + * + * @ingroup input + */ +GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun); + /*! @brief Returns whether the specified joystick is present. * * This function returns whether the specified joystick is present. * - * @param[in] joy The joystick to query. + * @param[in] joy The [joystick](@ref joysticks) to query. * @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. + * + * @sa @ref joystick + * + * @since Added in GLFW 3.0. Replaces `glfwGetJoystickParam`. + * * @ingroup input */ GLFWAPI int glfwJoystickPresent(int joy); @@ -2028,17 +2981,24 @@ GLFWAPI int glfwJoystickPresent(int joy); /*! @brief Returns the values of all axes of the specified joystick. * * This function returns the values of all axes of the specified joystick. + * Each element in the array is a value between -1.0 and 1.0. * - * @param[in] joy The joystick to query. - * @param[out] count Where to store the size of the returned array. This is - * set to zero if an error occurred. + * @param[in] joy The [joystick](@ref joysticks) to query. + * @param[out] count Where to store the number of axis values in the returned + * array. This is set to zero if an error occurred. * @return An array of axis values, or `NULL` if the joystick is not present. * - * @note The returned array is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned array is allocated and freed by GLFW. You should not free it + * yourself. It is valid until the specified joystick is disconnected, this + * function is called again for that joystick or the library is terminated. * - * @note The returned array is valid only until the next call to @ref - * glfwGetJoystickAxes for that joystick. + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref joystick_axis + * + * @since Added in GLFW 3.0. Replaces `glfwGetJoystickPos`. * * @ingroup input */ @@ -2047,17 +3007,27 @@ GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count); /*! @brief Returns the state of all buttons of the specified joystick. * * This function returns the state of all buttons of the specified joystick. + * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`. * - * @param[in] joy The joystick to query. - * @param[out] count Where to store the size of the returned array. This is - * set to zero if an error occurred. + * @param[in] joy The [joystick](@ref joysticks) to query. + * @param[out] count Where to store the number of button states in the returned + * array. This is set to zero if an error occurred. * @return An array of button states, or `NULL` if the joystick is not present. * - * @note The returned array is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned array is allocated and freed by GLFW. You should not free it + * yourself. It is valid until the specified joystick is disconnected, this + * function is called again for that joystick or the library is terminated. * - * @note The returned array is valid only until the next call to @ref - * glfwGetJoystickButtons for that joystick. + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref joystick_button + * + * @since Added in GLFW 2.2. + * + * @par + * __GLFW 3:__ Changed to return a dynamic array. * * @ingroup input */ @@ -2066,16 +3036,24 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count); /*! @brief Returns the name of the specified joystick. * * This function returns the name, encoded as UTF-8, of the specified joystick. + * The returned string is allocated and freed by GLFW. You should not free it + * yourself. * - * @param[in] joy The joystick to query. + * @param[in] joy The [joystick](@ref joysticks) to query. * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick * is not present. * - * @note The returned string is allocated and freed by GLFW. You should not - * free it yourself. + * @par Pointer Lifetime + * The returned string is allocated and freed by GLFW. You should not free it + * yourself. It is valid until the specified joystick is disconnected, this + * function is called again for that joystick or the library is terminated. * - * @note The returned string is valid only until the next call to @ref - * glfwGetJoystickName for that joystick. + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref joystick_name + * + * @since Added in GLFW 3.0. * * @ingroup input */ @@ -2084,40 +3062,50 @@ GLFWAPI const char* glfwGetJoystickName(int joy); /*! @brief Sets the clipboard to the specified string. * * This function sets the system clipboard to the specified, UTF-8 encoded - * string. The string is copied before returning, so you don't have to retain - * it afterwards. + * string. * * @param[in] window The window that will own the clipboard contents. * @param[in] string A UTF-8 encoded string. * - * @note This function may only be called from the main thread. + * @par Pointer Lifetime + * The specified string is copied before this function returns. * + * @par Thread Safety + * This function may only be called from the main thread. + * + * @sa @ref clipboard * @sa glfwGetClipboardString * - * @ingroup clipboard + * @since Added in GLFW 3.0. + * + * @ingroup input */ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); -/*! @brief Retrieves the contents of the clipboard as a string. +/*! @brief Returns the contents of the clipboard as a string. * * This function returns the contents of the system clipboard, if it contains * or is convertible to a UTF-8 encoded string. * * @param[in] window The window that will request the clipboard contents. * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` - * if an error occurred. + * if an [error](@ref error_handling) occurred. * - * @note This function may only be called from the main thread. + * @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 + * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library + * is terminated. * - * @note The returned string is allocated and freed by GLFW. You should not - * free it yourself. - * - * @note The returned string is valid only until the next call to @ref - * glfwGetClipboardString or @ref glfwSetClipboardString. + * @par Thread Safety + * This function may only be called from the main thread. * + * @sa @ref clipboard * @sa glfwSetClipboardString * - * @ingroup clipboard + * @since Added in GLFW 3.0. + * + * @ingroup input */ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); @@ -2127,15 +3115,21 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW * was initialized. * - * @return The current value, in seconds, or zero if an error occurred. + * The resolution of the timer is system dependent, but is usually on the order + * of a few micro- or nanoseconds. It uses the highest-resolution monotonic + * time source on each supported platform. * - * @remarks This function may be called from secondary threads. + * @return The current value, in seconds, or zero if an + * [error](@ref error_handling) occurred. * - * @note The resolution of the timer is system dependent, but is usually on the - * order of a few micro- or nanoseconds. It uses the highest-resolution - * monotonic time source on each supported platform. + * @par Thread Safety + * This function may be called from any thread. Access is not synchronized. * - * @ingroup time + * @sa @ref time + * + * @since Added in GLFW 1.0. + * + * @ingroup input */ GLFWAPI double glfwGetTime(void); @@ -2146,44 +3140,61 @@ GLFWAPI double glfwGetTime(void); * * @param[in] time The new value, in seconds. * - * @note The resolution of the timer is system dependent, but is usually on the - * order of a few micro- or nanoseconds. It uses the highest-resolution - * monotonic time source on each supported platform. + * @par Thread Safety + * This function may only be called from the main thread. * - * @ingroup time + * @sa @ref time + * + * @since Added in GLFW 2.2. + * + * @ingroup input */ GLFWAPI void glfwSetTime(double time); /*! @brief Makes the context of the specified window current for the calling * thread. * - * This function makes the context of the specified window current on the - * calling thread. A context can only be made current on a single thread at - * a time and each thread can have only a single current context at a time. + * This function makes the OpenGL or OpenGL ES context of the specified window + * current on the calling thread. A context can only be made current on + * a single thread at a time and each thread can have only a single current + * context at a time. + * + * By default, making a context non-current implicitly forces a pipeline flush. + * On machines that support `GL_KHR_context_flush_control`, you can control + * whether a context performs this flush by setting the + * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint. * * @param[in] window The window whose context to make current, or `NULL` to * detach the current context. * - * @remarks This function may be called from secondary threads. + * @par Thread Safety + * This function may be called from any thread. * + * @sa @ref context_current * @sa glfwGetCurrentContext * + * @since Added in GLFW 3.0. + * * @ingroup context */ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); /*! @brief Returns the window whose context is current on the calling thread. * - * This function returns the window whose context is current on the calling - * thread. + * This function returns the window whose OpenGL or OpenGL ES context is + * current on the calling thread. * * @return The window whose context is current, or `NULL` if no window's * context is current. * - * @remarks This function may be called from secondary threads. + * @par Thread Safety + * This function may be called from any thread. * + * @sa @ref context_current * @sa glfwMakeContextCurrent * + * @since Added in GLFW 3.0. + * * @ingroup context */ GLFWAPI GLFWwindow* glfwGetCurrentContext(void); @@ -2196,24 +3207,28 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void); * * @param[in] window The window whose buffers to swap. * - * @remarks This function may be called from secondary threads. - * - * @par New in GLFW 3 - * This function no longer calls @ref glfwPollEvents. You need to call it or - * @ref glfwWaitEvents yourself. + * @par Thread Safety + * This function may be called from any thread. * + * @sa @ref buffer_swap * @sa glfwSwapInterval * - * @ingroup context + * @since Added in GLFW 1.0. + * + * @par + * __GLFW 3:__ Added window handle parameter. + * + * @ingroup window */ GLFWAPI void glfwSwapBuffers(GLFWwindow* window); /*! @brief Sets the swap interval for the current context. * * This function sets the swap interval for the current context, i.e. the - * number of screen updates to wait before swapping the buffers of a window and - * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical - * synchronization', 'vertical retrace synchronization' or 'vsync'. + * number of screen updates to wait from the time @ref glfwSwapBuffers was + * called before swapping the buffers and returning. This is sometimes called + * _vertical synchronization_, _vertical retrace synchronization_ or just + * _vsync_. * * Contexts that support either of the `WGL_EXT_swap_control_tear` and * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, @@ -2222,11 +3237,12 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window); * glfwExtensionSupported. For more information about swap tearing, see the * extension specifications. * + * A context must be current on the calling thread. Calling this function + * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. + * * @param[in] interval The minimum number of screen updates to wait for * until the buffers are swapped by @ref glfwSwapBuffers. * - * @remarks This function may be called from secondary threads. - * * @note This function is not called during window creation, leaving the swap * interval set to whatever is the default on that platform. This is done * because some swap interval extensions used by GLFW do not allow the swap @@ -2236,8 +3252,14 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window); * because of user settings that override the request or due to bugs in the * driver. * + * @par Thread Safety + * This function may be called from any thread. + * + * @sa @ref buffer_swap * @sa glfwSwapBuffers * + * @since Added in GLFW 1.0. + * * @ingroup context */ GLFWAPI void glfwSwapInterval(int interval); @@ -2245,19 +3267,28 @@ GLFWAPI void glfwSwapInterval(int interval); /*! @brief Returns whether the specified extension is available. * * This function returns whether the specified - * [OpenGL or context creation API extension](@ref context_glext) is supported - * by the current context. For example, on Windows both the OpenGL and WGL - * extension strings are checked. + * [API extension](@ref context_glext) is supported by the current OpenGL or + * OpenGL ES context. It searches both for OpenGL and OpenGL ES extension and + * platform-specific context creation API extensions. + * + * A context must be current on the calling thread. Calling this function + * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error. + * + * As this functions retrieves and searches one or more extension strings each + * call, it is recommended that you cache its results if it is going to be used + * frequently. The extension strings will not change during the lifetime of + * a context, so there is no danger in doing this. * * @param[in] extension The ASCII encoded name of the extension. * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise. * - * @remarks This function may be called from secondary threads. + * @par Thread Safety + * This function may be called from any thread. * - * @note As this functions searches one or more extension strings on each call, - * it is recommended that you cache its results if it's going to be used - * frequently. The extension strings will not change during the lifetime of - * a context, so there is no danger in doing this. + * @sa @ref context_glext + * @sa glfwGetProcAddress + * + * @since Added in GLFW 1.0. * * @ingroup context */ @@ -2270,15 +3301,27 @@ GLFWAPI int glfwExtensionSupported(const char* extension); * [client API or extension function](@ref context_glext), if it is supported * by the current context. * + * A context must be current on the calling thread. Calling this function + * 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 the function is - * unavailable. + * unavailable or an [error](@ref error_handling) occurred. * - * @remarks This function may be called from secondary threads. + * @note The addresses of a given function is not guaranteed to be the same + * between contexts. * - * @note The addresses of these functions are not guaranteed to be the same for - * all contexts, especially if they use different client APIs or even different - * context creation hints. + * @par Pointer Lifetime + * The returned function pointer is valid until the context is destroyed or the + * library is terminated. + * + * @par Thread Safety + * This function may be called from any thread. + * + * @sa @ref context_glext + * @sa glfwExtensionSupported + * + * @since Added in GLFW 1.0. * * @ingroup context */ diff --git a/extern/glfw/include/GLFW/glfw3native.h b/extern/glfw/include/GLFW/glfw3native.h index d570f58..b3ce748 100644 --- a/extern/glfw/include/GLFW/glfw3native.h +++ b/extern/glfw/include/GLFW/glfw3native.h @@ -1,5 +1,5 @@ /************************************************************************* - * GLFW 3.0 - www.glfw.org + * GLFW 3.1 - www.glfw.org * A library for OpenGL, window and input *------------------------------------------------------------------------ * Copyright (c) 2002-2006 Marcus Geelnard @@ -40,13 +40,13 @@ extern "C" { /*! @defgroup native Native access * - * **By using the native API, you assert that you know what you're doing and - * how to fix problems caused by using it. If you don't, you shouldn't be - * using it.** + * **By using the native access functions you assert that you know what you're + * doing and how to fix problems caused by using them. If you don't, you + * shouldn't be using them.** * * Before the inclusion of @ref glfw3native.h, you must define exactly one - * window API macro and exactly one context API macro. Failure to do this - * will cause a compile-time error. + * window system API macro and exactly one context creation API macro. Failure + * to do this will cause a compile-time error. * * The available window API macros are: * * `GLFW_EXPOSE_NATIVE_WIN32` @@ -71,8 +71,13 @@ extern "C" { *************************************************************************/ #if defined(GLFW_EXPOSE_NATIVE_WIN32) + // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for + // example to allow applications to correctly declare a GL_ARB_debug_output + // callback) but windows.h assumes no one will define APIENTRY before it does + #undef APIENTRY #include #elif defined(GLFW_EXPOSE_NATIVE_COCOA) + #include #if defined(__OBJC__) #import #else @@ -80,8 +85,9 @@ extern "C" { #endif #elif defined(GLFW_EXPOSE_NATIVE_X11) #include + #include #else - #error "No window API specified" + #error "No window API selected" #endif #if defined(GLFW_EXPOSE_NATIVE_WGL) @@ -93,7 +99,7 @@ extern "C" { #elif defined(GLFW_EXPOSE_NATIVE_EGL) #include #else - #error "No context API specified" + #error "No context API selected" #endif @@ -102,8 +108,49 @@ extern "C" { *************************************************************************/ #if defined(GLFW_EXPOSE_NATIVE_WIN32) +/*! @brief Returns the adapter device name of the specified monitor. + * + * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`) + * 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.1. + * + * @ingroup native + */ +GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor); + +/*! @brief Returns the display device name of the specified monitor. + * + * @return The UTF-8 encoded display device name (for example + * `\\.\DISPLAY1\Monitor0`) 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.1. + * + * @ingroup native + */ +GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor); + /*! @brief Returns the `HWND` of the specified window. - * @return The `HWND` of the specified window. + * + * @return The `HWND` 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.0. + * * @ingroup native */ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window); @@ -111,15 +158,48 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window); #if defined(GLFW_EXPOSE_NATIVE_WGL) /*! @brief Returns the `HGLRC` of the specified window. - * @return The `HGLRC` of the specified window. + * + * @return The `HGLRC` 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.0. + * * @ingroup native */ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window); #endif #if defined(GLFW_EXPOSE_NATIVE_COCOA) +/*! @brief Returns the `CGDirectDisplayID` of the specified monitor. + * + * @return The `CGDirectDisplayID` of the specified monitor, or + * `kCGNullDirectDisplay` 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.1. + * + * @ingroup native + */ +GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor); + /*! @brief Returns the `NSWindow` of the specified window. - * @return The `NSWindow` of the specified window. + * + * @return The `NSWindow` of the specified window, or `nil` 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.0. + * * @ingroup native */ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window); @@ -127,7 +207,16 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window); #if defined(GLFW_EXPOSE_NATIVE_NSGL) /*! @brief Returns the `NSOpenGLContext` of the specified window. - * @return The `NSOpenGLContext` of the specified window. + * + * @return The `NSOpenGLContext` of the specified window, or `nil` 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.0. + * * @ingroup native */ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window); @@ -135,12 +224,61 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window); #if defined(GLFW_EXPOSE_NATIVE_X11) /*! @brief Returns the `Display` used by GLFW. - * @return The `Display` used by GLFW. + * + * @return The `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.0. + * * @ingroup native */ GLFWAPI Display* glfwGetX11Display(void); + +/*! @brief Returns the `RRCrtc` of the specified monitor. + * + * @return The `RRCrtc` of the specified monitor, 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.1. + * + * @ingroup native + */ +GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor); + +/*! @brief Returns the `RROutput` of the specified monitor. + * + * @return The `RROutput` of the specified monitor, 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.1. + * + * @ingroup native + */ +GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor); + /*! @brief Returns the `Window` of the specified window. - * @return The `Window` of the specified window. + * + * @return The `Window` 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.0. + * * @ingroup native */ GLFWAPI Window glfwGetX11Window(GLFWwindow* window); @@ -148,7 +286,16 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window); #if defined(GLFW_EXPOSE_NATIVE_GLX) /*! @brief Returns the `GLXContext` of the specified window. - * @return The `GLXContext` of the specified window. + * + * @return The `GLXContext` 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.0. + * * @ingroup native */ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); @@ -156,17 +303,46 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window); #if defined(GLFW_EXPOSE_NATIVE_EGL) /*! @brief Returns the `EGLDisplay` used by GLFW. - * @return The `EGLDisplay` used by GLFW. + * + * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` 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.0. + * * @ingroup native */ GLFWAPI EGLDisplay glfwGetEGLDisplay(void); + /*! @brief Returns the `EGLContext` of the specified window. - * @return The `EGLContext` of the specified window. + * + * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` 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.0. + * * @ingroup native */ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window); + /*! @brief Returns the `EGLSurface` of the specified window. - * @return The `EGLSurface` of the specified window. + * + * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` 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.0. + * * @ingroup native */ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window); diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/context.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/context.c.o new file mode 100644 index 0000000000000000000000000000000000000000..abd9f9564910e6ea61c9cb80da4de66fd6f1dd70 GIT binary patch literal 10176 zcmbVReQ;aVmA{f4Tf|1sWxdpe5FV@vP7{Pb0<{R~`q{GmOq4i{^TDnmLbfGG8(T8c zQ$AP{JIKoRRX9mI*FY?R1!Bm@pABgw1X!G@-!2b_4rI8)0@!my$8z zLwnAB_e#gl(r%}BqWA9o-QPXu+;h&mAI?-ypx5beFj*Yz>#Wq0D7>3W^-f;xWD2We zdin!*wr2Ktq3~HDebupVV1t9XSaxTX5zbu54!94k%$(bQ1N0~}KY(HBt4<|@mCQM1 z=1F+#vv;Ai*4*hT(0kdc&##OqH_u?5^t(#^diq8898mlq=Yn$dSui-;=g#Ez-vWw^ zM^VX462SCTS1Oraa2<*j<(V&(*Z7ah&C{qa{fR?4HdZJUvVHZLoRX;nG1F6ZOqu!4 zB5R1X`3ay)d(#WcroNjUsLz};?me7$s4gz?uRcc6SDlBJqe&an3y!JYvUcQe;j%ip zPUBV>GIdjV;=&iG6z1KK$r;PmcPsQ?|k#WZpSclijs8 z^N#WB?5+-9up@QJpPi~}J=c>d9IEqYH}mQ_<-`mA?7sS*%#}km=|lC7^v{_;JJ8UR zIfv~AY-e{iXD%G___Mvue&3lx%lxa)IDYQW_O> zI!F2f^ZVXQtTXP@eIF|R_x*~09)9mhUuRD6z)eH8v7raG2eb#ZU0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Fcf}gk@{e Y34V6{xXqN){~8`1pgd!nzg_?T0)+afRsaA1 literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/glx_context.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/glx_context.c.o new file mode 100644 index 0000000000000000000000000000000000000000..16e76c052dff8810917976e526ddbb6ae8e64c4d GIT binary patch literal 11112 zcmbVRYj7J^6<%4XZQ?|$K5^U7Y(Y~T(yEq|Qm1Kx*OshxP#ZON(om;$WqW0d$dXyD z@_+z#B_#;Oq0m4>AJYd6bm#!4g<{8TqdXcXz>iGeM~46{6qssKm=ro`p{3%SyZ5fI z*4ps6GuplPJKsI$+;iWnF9t%LH4cZsl0#T4%#|1_2v2=G%9)BQ?KNEJWWcjC}sz0Q8qSN1FyW_)2b9c zgbH3n<4R#>3SO@xpiHbGul(`p4?yPc-=V_7vqdP1Un`0a9$9uoeDR1f(c=k$rjd)r^S66z>`oR?s3ohJ z<;*chSLUU9|LQ?cNSxRR?sgSMn1`YKn+F@lumyjmnnRv&Aa_zfLA^x6#T?nD2HL+-l8>@-krg%v;@x`WCswS>8 z#hz+n7zaksf=z~amnWPn>-F+%@Oo}oLR_(1VMrOnsQ^PIcV5iNPC*!(Il2IFG50(v z95V`gppb!%bX1I{u6(jh-1~!nmCNE%0fuCAsIbc;De!0t<=-bBkeTvLsEw#wDGav} zIFv6NVq>1L(TC%t5vnNp@hKRmV%87l6&M-yJKS`|T)`H3@4D&%O%TrJk{52?b=HpqISZDMr zl!3n?<+`sTWlJ_Z(eBI~sexJhL69g1P_`c`pZ%Y@#j4Ezjbd&8U1?R*atDg&pL z1JmfxtbczPUJxI$e1#@pPR{zX6zhRCF8|l^15?l#uBUJTOm8V<9sxL0T)Zmt253ls zl6D)$HodkGcIQr~Z^oWW`=a7fzo7xvOkzl$LhA=F8v~dwM23OLZK-J$nxd5e6ve2?6B)MyvXH5gEWP^mOOnrM->&oG>-PBK|a06CT3NN6S%EZ?X zfKSTAPjI=S7V<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N9CLSM8@a;bbNTJ@$NG zUi5IjpWg9szCS+oaK1lwQ2!h!-xFm1e+vy-qHFJ$R2Ueh*JyoRZT($}-(k2%!fZe? zEdL(@3bn_x1^eN3=JmimiQLnTsCog|V4`Vo70CC(gFe@p)5hg}!VS28)j`R)`$A3JURNQMDXbd( z4zX~JxP>rH+*RVZei%E)&+B&@7{=5AkD9Jf{B0_PGRM!-QJ8A_=KnbUGPU=PpWC-^ zN93I2=e}m3fO8UNK(dAYuem@vjvvn=ZqMUKvvqq9*!#4gPe55so^a%Rcwh literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/input.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/input.c.o new file mode 100644 index 0000000000000000000000000000000000000000..073ed2c69daeef6dc28167614657769879eeccfb GIT binary patch literal 11456 zcmcIp4NzRw6}~L7V8DGFjTIX$TZ5LQijZi9BsIJ2!oC<1XdsmuB5an$kPwzx9!ZGW zECMl4fzZ=4=#5^}$G0EB2M?I7qgZ|rQE=07_AIN1d%mV~|j@~-YP?ydgr$=t2Wy)|pS z=J9GUT?@MAY2Ew+9dJyIl=Z%CT%q^%R*_FG^L5?)Xx(~m-PEX->t_s`V0!>`J;a#> zeh;Yqbx&q&o8NoF_`W$(5gIPt?a!zKm3&gU5Us^PzdUX%9Gi9=|pNh>&_{VJ}N9qEZ1PIx*do;qGSrPT&>_^PZr zrOm4KP1Hmx+(s$@qoPHOXc0~XXm(`Mq@fq<7dG1TY_)LM@R0v;J(TdjA$pCfs2v*m$q zey;Uskc#BUa?25|=TYq5a-}HFodI(>>(*n6!TSIadXp>yKYLGT`{Km`uXbR>c%k=1 zM^$WRUAoqj2R+2@To0`|ymdRYCZUJeo%PTf=dA{4Ik_|ltuf!1yx zju#!_e)Qin^~|}czRKF}GY;+El~YqwCC9X$A49G8T?ce#-dd|Ked364z5jv3;G!{S{JT~h z^zL|?UNT~6vEuZOQ^Smnf583Py%NKZZVvlGY^)qC4Er{)vBkVm&&IN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1Nz2Il|R(eJ1hc_+-)f35SPUr|9=G!ck4;2MAZ~ z@37%pe?wS5%W*3d_8+j}zh+~9F`dKIewRzQ9RF?!m-FNy!f{;lC4Yu&_^(U2Y=1VL z=g`j8lAUr1ze>XICS3LZml8i;;{Q(K%l!^Z`~?#KJqefJR~nu3(9b-He>vf*Ki5lq z*`E@LFZ)v?@qZxM-yz|$KR=gn*`G%x`||sGLE_7H-m>94aX?UTyfS}2;p%u-+wem+ z{QGVAkJ|8Gu;IUD!*|m8b%y_hqnaF_)i(T)4gY={{vU1l$87j-+Tfqs*tv?%!Rok{ z*x&)e)$vAc`1jf157^i_WWzsUgTG~C=Mp+ktA75FaCN-ZHvFwN{9oAcKa|!_dB0dF zt#5Mv-)4hvl5lw+IV9n-oh8yba}DI8SkG^haG8Hd$`kzOUhrK~oNtow1_>{b@IOoV zQVIV+!toA9*mu~(^GXR{F7ek(xL3k|BjG*?e^SEb@w$P71@}`rGVo`-3&tYw0qc>q zQ7!OMdhSth_=(I5{)3N2@I8d@x8MXW?wR5WF7BCLR&a68G>hyB`{I76R>9+#*id>D zT-?)${)L@5CU#eD<5!*5dDpo}R(uRmeRL#+ekmk_9TCb+ht zYaT(MTE{~*6p;@XK^yy_;|0q>ArxHe5U21V#LI-zufQpt#Ur~GT4?ip_3=I^)%d?| z{~prE`)s)geF{TDB>We3B}lNX>gQm*|^;&~f1QsvLPc=(5sLoXK1;Zzp-B7f!proMZC u*ijTf*=1FUZ`FT%R((fu75$OWKoi3W82X_0kIPP~{+}QR_bKC7`~NRgDD=kw literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/linux_joystick.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/linux_joystick.c.o new file mode 100644 index 0000000000000000000000000000000000000000..f0c4b32e58fd90bc93a08b5a9e56c3aa4a0509f1 GIT binary patch literal 7832 zcmbVQ3v64}89s^K)U?4)9~&8r)v#Nd@<`*hj1&fo(>S@_3@tR_u|87cIE`D!4)zT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3Vt;bA;L?eN9zAT!PU5Ffx|yO zrb+$ZDf;sjoPTtpHpD7EVxj-K1-@9E+Ym2M{4W!D@wlxJIP%0fF7sTi_^DFxdlday z3cgj*$5|=;>{9eq|G!l9aVARr7Zv;}1%Fq;)p`8T!v9AKj@nK7Kd1On=l4QU@?qT6 zxECw<)ry}b0>`+`QSk36`lyj)+`AN9Q}Fc)UajC86#w{dCjH#2=&SyJtl+BuM-^Q4 z{|m*xIxkNsIL-jo? zV;uuj3}EB^f!_-z*WY74wm!D|%%eG0DT^M=5S^PeW_gks!hf%jS94_m}_Q*I!v zTRf6F1S4_zf9BaDT-Jq}xJRVEtgF@(;j(_}DZ*v_^jHxt>!(+Wa9Kaee81}3O@?qS zmeshMI>9|C##0KgMpeR{jI~v#g2d}M1c-JE$GB4vN4mqe0MHfm02kK`AWpAJMG1(v z7>02aXAo4ss=bG7;d3!PD#`duRFHTXU%u-ERy=;^zGVI@gne;*`Pc3M$yJhWW&Cv{ z1dlUar5rX45#~lE*_Q83B!oTos7fQkzDfm&mvQCWP%u^XxUg3-@X}7=rohy_2iZws zf27Dj_Fvkki9uiLBp}{zqqro>@!vvCgRchCUamjf*~M!ICT~KS=;6X^{I@6_-k;*! hq1;hkFu})O5NaO8ERK(EP8EMW5+gcR6tJkt{tx!~+6Djs literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/monitor.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/monitor.c.o new file mode 100644 index 0000000000000000000000000000000000000000..f7768be65416d2d11091d237ef41a99e56f65f0f GIT binary patch literal 11384 zcmbta4Rlo1oqv;zFhZO+YN}D$X4a0~jKwqqc*-k& z!TQyiNN*n_sf$JTY+DX?w{Gn&Zcn?V?ygQgAh>);{aO`7ToH)_K?n&!NM`^4`|h2& znPjS`d(X+d`+oO-|M&lW?|mna>Y;gg4u`~>L%L1Mym3^Lc9dlL<+NKa$x?x2RTfxF z3i2ym`Ab~+m7e@19_4^J#ebk%E`AKjt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iUh*k@spCf&j2d((*B;q&?P9)NLvSr*+pY<@`=&e!G7Fq@x6 z1{cV22nF~&KDr({h_SHcaC&}umSecwoUj!-6U9%08E%*@i1CA8dH8%DKUhAqmH-6e ukrBk`TjnQQ{t0CV^4)CyFbW3^_b6N|dwtwzCt5#&he>D$vJ8{G{{I0PJ|MsV literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/posix_time.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/posix_time.c.o new file mode 100644 index 0000000000000000000000000000000000000000..09abfa050c39b7a7ec5f6e86d9c0d4e689aa9324 GIT binary patch literal 2856 zcmbVOO>7%Q6n?e?b?V~X6eJ=Als#CL17&5GAQdWwjenA2(gg#tsE)f+fwTqvi*1l!K8eyDRIx>IAHOk7lnt8oBijyAf zun83N*=}{Uaom#+uCwo`GHB=hsPvC&p!eBCKl(Fre~LzFp8+0GbOiS z*Bn0YfEV4yA^6KLz7iAZd$R!|_}9-O$kfjwz^`-9Pz0Xt!3c;zbO1iwgU312%k!+j zRi;sa>pe^~Z{VXP#_7wnKTrpLb`Ya|@5hlDfX@xU-yeXN5vO^tVoS!)A+{}i2%n>k zL*r+ToU`?2rB(7OHODN2S;(g7m8RDululRO)uYQ5ZytvmP?{|q%S;za$7W`V`T5fP zbf%CmLAhElFO^O^9&z|7AbNFo(O&bRxvK5C^+s*h;bf13MFFB5e_!Zq0ciOAix-^i zdGyI>C#ilCr#nX$#)rlvZlO;`JR|r>e33vjir!#ee6T)-&`I(1NGk|O;__V3c_5RxJQqIt`?8jAc%fa5FQrm--j5v@}Bzl6X1Zr)i2G0GB1X46Lhl6?p?R=eI=uer$twQs|fKlw)%JvV9u|X#SK85N%83Cly?-U$*pJk$y0A^D*nU zB=Xg8nZFq%MPKTcu!~N={XZ!_u}lQg{?lEO`LZr_ht$2J6ia|B)CrinR_d$TDg2tq b-xdk<&mukQ{G_Sh{9lNlvJD&$nmYe~s^+Bb literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/posix_tls.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/posix_tls.c.o new file mode 100644 index 0000000000000000000000000000000000000000..b9089dfed70a097cb28af27ed26bf1af6a224d74 GIT binary patch literal 2520 zcmbtU&1(};5T6)7B5JMGf}r3YR4V9_)CyWb(#EzCLMygH58`%BU)s=ox%-N(7Yo%x zDHZV~{t@C)yeQ~ZkeYzPTT>g?NuI>Pn`(9jo@jOHH3D$$xFHuK#7uU|gewE?6xz~X& zx4!bexcoNrrt-+-t_F#p5m*82{m1UZAmcBt{Q4^-?vFTwG`c!Aer2-X8g{ESHErpp zRrZvtl~rywv|7;CL}{F8q)_O$dPYXCpR)Sw3wE#7o6Viep3U}IJuOdps-|3DoeByb z3d>UJ?lnp+bf%8%-IaO77X*LQ_%1E!LCj zF9$IxnqmpaTs>tyDgGJrsK3M#koxafPl~5j)2}W#y5`$uvP*?5IWx7&ohyy1#uIWz zN@IfqC1-4SczkHWnHU%>4LM;5we&2%xoKxkEjr=rlib$49`d}V7uplbt5+NRI8iW~ zG|dlCt1xI>>B79{@dy{f7rYVaEA6*bxmu}~!_ccWS67-|eWY#5Oe7`v7l>p6Fgci& zpT9%M|A~q1i0~&^2e$D-j>P9cG7!I?m+%FUjClQWNN?fMS0EmbxdBlB057S38zck# zL0-Z?1jzu8y9jTw4&eM)g7ZcZK5y(&jGr>LNQqxE{QnAz3*eg*fBAXlfXAWO_>Ir* z5%%ED`HhHB$(T>TSHtgRiGActa@g=E4WBl)h;>n75;dYY%?4`zYd+=(HG6qQ@xd6! zqa^EcemO^;Iq32K?vkDgprcp6XPXchzfW z7K{kw{zA>NlGOhnrvFnW5dFs+lYHqv-d4PKNO@xRzXKzJ__bii&yMg;LyE+=W)H9U U{y0<8{uVC9_!x?f-}wH20GVAXH~;_u literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/window.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/window.c.o new file mode 100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;xp$yh+04eY*ut>eWm1{Sy6J z3C~El%;$#!cb@MBiT-+tPo22WXI zT=wUmiV~aTk^Sm*377SKTf$|1FA1Fd$0y18fkZF+&(mZWG^d^CBwW^aNYr0MFXtaa z!e#k)Nw_Tkw1ms@zantwd3h)p&}d&dFRhkv`Mg>sT=us%fjjx{km%*}x~~TP9*JH) z$L~nEEaz9~FwmUmn~-qXK7A4{+vk@8cgnv?Trkda+$Q1jIbIRClaDIuP~!6iJa$|( zOZbfvzFER=lJEy5{ALONu7o#9_&-Xx%>Nk)|4WH}rUw2>4g3uWZb~LBUoEa z|Nrm)ZDKw7tlaGNw!Ze9Ex+C0fe9Kr*FPcj@3I$)-sWeo-yzmFJLujK>%$J*UT63B zi1iLKB|ybQm1eKArzqYC6YgolN>Hr#Iu6E`-zNMP2G#uM^5-lHuh@|MhpuLOJ=NUQ yXdA~C9B-t{3~jH~ReqiFSCgHHpAhTqxTiEtk8^*@d)4-zwf>-~-0qlk?*D%mD6X^s literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/x11_window.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/x11_window.c.o new file mode 100644 index 0000000000000000000000000000000000000000..070074fefe7cf3ffb541a2a512ab914dd7397d28 GIT binary patch literal 30352 zcmd6Qdwf*Ywg1Tj7#_}vif!79GU(I>wU`LnAX+nIlAO^AL=q$_N~FOapG=M4c-5Z5QqZD(yYnN7mx^j<|Mu2bEoV?xC)x%pu$=k|YH+ANR2SM70KKf) zSsiQ=u_dBEoR;!XWBS*hjf^O}j5>oyKpeFf2a8GIqNp7XmRNQ)7>L^c5ye|JfrKwn zs-$|ZaweCeB5Fm{i3W>8S6g_MLK0CMkvBD7M{O;NI^dnY97ZbaDMh^+wOfOAAg11L zqI%n<(AJ)Cut)TP?6vLCDf%NEY`kdL{Kn^ zQJWGtv?yx7d*~T+YM44~@F3(-bfCEjai~$K@FwHXMy01v!$QmcTRlvCm?U!U#DEzw zlT|PSRneKijl`p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xylLht$*G1{}(90XCwds literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeFiles/glfw.dir/xkb_unicode.c.o b/extern/glfw/src/CMakeFiles/glfw.dir/xkb_unicode.c.o new file mode 100644 index 0000000000000000000000000000000000000000..44a641bcf46755fd36f18564ef403ce6372ef6cb GIT binary patch literal 4864 zcmb_f2~<>PmVUSX|NZaPU-e%tHPN`fs^Z~J-gDO&Tnm8INgz#=e$YBmN!s4y2YLD z7Og9o+auk+efH$?pEqtEv}2QJa@%M1^AF^C13ZQ6dkmQ^Nndw(BfZ?8b!LzB+1o9J zzD$1|g#v{zsIr8^42XmmAqrlH7m_Zpb1(fo!q>a>+u-BN7}S zK~PGbg>o_iD##qDB#Yn}nE=&f6PzRO!+G*IP(uJ3$@9=k`oc9b657aIXeW!|2AK$V z$!7STd;ky0hwvGlriD_A5k~DsI2A?&1tXH)H=<~}v6F@x(KOtMp^-)`-D$+p7$ct6 z8M|n`kw6=bL|SO&MgiS#6w+d2KRsv^(GsJW9ySipQsW>!VjQAnMhPu9 z4%14bl%6n-&?=*ho-xYldE+R(U{uf=qmo`Uj?r437Bj`gtExqgk08#LDI8*-_bG6|%`H~rz)r~%S(QAARm+pvX?Y5(k*BkZ@(flh&t!G-EOtqr&FbYjtU;d38s&McNuJM| z<(FBDyntPn7qV7)5xXKUW>@7`*fsf8c3pmrwaH6ZyS$WzvZXYPEu-OV35{UOX(U@g zqu5HildYoBY&DHxYiKNcoyM^@Xgqt9Ca||@B3ny$vuB-2%tDhHp(zaL9!6;@lW7`b zG@U7QFH>m-v(kNx(@bWgS)A83 zfd$Y;)|)mloi?+6w1quKFSGu%l?|X**g$%f4WifBV0xVmp>6DW+Rik3gE{F<=AyTl zo8D&6(mSjd?O>zmT{e>5V}0p;HjF-Cqv`i-IDN>5QV$zJLzS;cnDS2~T=|+rDE~|% zl~}S<`414rG%s@-;i{rl{ZB`8QIe{EieW|4t4l|3MBa|49xh|3yla|0ai( z??|cgdvZki11VGfNXnJ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?(?HTx%Z1cgzY5HY@R6^BAr(k7Kms1jaZ{Vyxp7#yP4m-cgOa9H%kCaRw6| zXK}aV940x=W3uA{rZ{SFkK-byI%+Y^QHSY{OSsojj~R{z+~;V-Oh*%DIhrxs(SkXS z%b4qE#XQFq%y(SH0>?GnU|z?cnr*n%Y{$>d8~BBJ6aU`4gC?t4u$Z)BTfBk@8ER|quPZ(fV)Nj0tln)>1 zw|&)hMG4xxZNrw}ccq}sTQ)uB?{`Yxq`^U3Lbh&^g5C?>5-bJ1yLq$p2nhQ0dhe?Dt}^3nRAFAUkX zY}6D*1d4>7@ z_^y~w?(VzZk9F_AGroIYo%8F=8|)RHHvjki^Y5IqZ~netS!aAF?(kyWXXk~at^WQ$ r@hM%Xd;dPYd+$E?CV#x<5Adlr@3(t>Ur$e~uloBR?X`EM?)Co+HW!g1 literal 0 HcmV?d00001 diff --git a/extern/glfw/src/CMakeLists.txt b/extern/glfw/src/CMakeLists.txt index cd699ef..77a8501 100644 --- a/extern/glfw/src/CMakeLists.txt +++ b/extern/glfw/src/CMakeLists.txt @@ -1,44 +1,54 @@ -include_directories(${GLFW_SOURCE_DIR}/src - ${GLFW_BINARY_DIR}/src +include_directories("${GLFW_SOURCE_DIR}/src" + "${GLFW_BINARY_DIR}/src" ${glfw_INCLUDE_DIRS}) add_definitions(-D_GLFW_USE_CONFIG_H) -set(common_HEADERS ${GLFW_BINARY_DIR}/src/glfw_config.h internal.h - ${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h - ${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h) -set(common_SOURCES clipboard.c context.c gamma.c init.c input.c joystick.c - monitor.c time.c window.c) +set(common_HEADERS internal.h + "${GLFW_BINARY_DIR}/src/glfw_config.h" + "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h" + "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") +set(common_SOURCES context.c init.c input.c monitor.c window.c) if (_GLFW_COCOA) - set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h) - set(glfw_SOURCES ${common_SOURCES} cocoa_clipboard.m cocoa_gamma.c - cocoa_init.m cocoa_joystick.m cocoa_monitor.m cocoa_time.c - cocoa_window.m) + set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h iokit_joystick.h + posix_tls.h) + set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_monitor.m + cocoa_window.m iokit_joystick.m mach_time.c posix_tls.c) elseif (_GLFW_WIN32) - set(glfw_HEADERS ${common_HEADERS} win32_platform.h) - set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_gamma.c - win32_init.c win32_joystick.c win32_monitor.c win32_time.c - win32_window.c) + set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_tls.h + winmm_joystick.h) + set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_monitor.c win32_time.c + win32_tls.c win32_window.c winmm_joystick.c) elseif (_GLFW_X11) - set(glfw_HEADERS ${common_HEADERS} x11_platform.h) - set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_gamma.c x11_init.c - x11_joystick.c x11_monitor.c x11_time.c x11_window.c - x11_unicode.c) + set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h + linux_joystick.h posix_time.h posix_tls.h) + set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c + xkb_unicode.c linux_joystick.c posix_time.c posix_tls.c) +elseif (_GLFW_WAYLAND) + set(glfw_HEADERS ${common_HEADERS} wl_platform.h linux_joystick.h + posix_time.h posix_tls.h xkb_unicode.h) + set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c + linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c) +elseif (_GLFW_MIR) + set(glfw_HEADERS ${common_HEADERS} mir_platform.h linux_joystick.h + posix_time.h posix_tls.h xkb_unicode.h) + set(glfw_SOURCES ${common_SOURCES} mir_init.c mir_monitor.c mir_window.c + linux_joystick.c posix_time.c posix_tls.c xkb_unicode.c) endif() if (_GLFW_EGL) - list(APPEND glfw_HEADERS ${common_HEADERS} egl_platform.h) + list(APPEND glfw_HEADERS ${common_HEADERS} egl_context.h) list(APPEND glfw_SOURCES ${common_SOURCES} egl_context.c) elseif (_GLFW_NSGL) - list(APPEND glfw_HEADERS ${common_HEADERS} nsgl_platform.h) + list(APPEND glfw_HEADERS ${common_HEADERS} nsgl_context.h) list(APPEND glfw_SOURCES ${common_SOURCES} nsgl_context.m) elseif (_GLFW_WGL) - list(APPEND glfw_HEADERS ${common_HEADERS} wgl_platform.h) + list(APPEND glfw_HEADERS ${common_HEADERS} wgl_context.h) list(APPEND glfw_SOURCES ${common_SOURCES} wgl_context.c) elseif (_GLFW_X11) - list(APPEND glfw_HEADERS ${common_HEADERS} glx_platform.h) + list(APPEND glfw_HEADERS ${common_HEADERS} glx_context.h) list(APPEND glfw_SOURCES ${common_SOURCES} glx_context.c) endif() @@ -48,15 +58,14 @@ if (APPLE) endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) -set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}") +set_target_properties(glfw PROPERTIES + OUTPUT_NAME "${GLFW_LIB_NAME}" + VERSION ${GLFW_VERSION} + SOVERSION ${GLFW_VERSION_MAJOR} + POSITION_INDEPENDENT_CODE ON + FOLDER "GLFW3") if (BUILD_SHARED_LIBS) - # Include version information in the output - set_target_properties(glfw PROPERTIES VERSION ${GLFW_VERSION}) - if (UNIX) - set_target_properties(glfw PROPERTIES SOVERSION ${GLFW_VERSION_MAJOR}) - endif() - if (WIN32) # The GLFW DLL needs a special compile-time macro and import library name set_target_properties(glfw PROPERTIES PREFIX "" IMPORT_PREFIX "") @@ -79,7 +88,6 @@ if (BUILD_SHARED_LIBS) endif() target_link_libraries(glfw ${glfw_LIBRARIES}) - target_link_libraries(glfw LINK_INTERFACE_LIBRARIES) endif() if (GLFW_INSTALL) diff --git a/extern/glfw/src/cmake_install.cmake b/extern/glfw/src/cmake_install.cmake new file mode 100644 index 0000000..4515c24 --- /dev/null +++ b/extern/glfw/src/cmake_install.cmake @@ -0,0 +1,38 @@ +# Install script for directory: /home/fab/swp/swp/extern/glfw/src + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Release") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "0") +endif() + +if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified") + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE STATIC_LIBRARY FILES "/home/fab/swp/swp/extern/glfw/src/libglfw3.a") +endif() + diff --git a/extern/glfw/src/cocoa_gamma.c b/extern/glfw/src/cocoa_gamma.c deleted file mode 100644 index f2905f4..0000000 --- a/extern/glfw/src/cocoa_gamma.c +++ /dev/null @@ -1,84 +0,0 @@ -//======================================================================== -// GLFW 3.0 OS X - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#include -#include -#include - -#include - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) -{ - uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID); - CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue)); - - CGGetDisplayTransferByTable(monitor->ns.displayID, - size, - values, - values + size, - values + size * 2, - &size); - - _glfwAllocGammaArrays(ramp, size); - - for (i = 0; i < size; i++) - { - ramp->red[i] = (unsigned short) (values[i] * 65535); - ramp->green[i] = (unsigned short) (values[i + size] * 65535); - ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535); - } - - free(values); -} - -void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) -{ - int i; - CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue)); - - for (i = 0; i < ramp->size; i++) - { - values[i] = ramp->red[i] / 65535.f; - values[i + ramp->size] = ramp->green[i] / 65535.f; - values[i + ramp->size * 2] = ramp->blue[i] / 65535.f; - } - - CGSetDisplayTransferByTable(monitor->ns.displayID, - ramp->size, - values, - values + ramp->size, - values + ramp->size * 2); - - free(values); -} - diff --git a/extern/glfw/src/cocoa_init.m b/extern/glfw/src/cocoa_init.m index 42b31c5..8779cdf 100644 --- a/extern/glfw/src/cocoa_init.m +++ b/extern/glfw/src/cocoa_init.m @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 OS X - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // @@ -68,6 +68,128 @@ static void changeToResourcesDirectory(void) #endif /* _GLFW_USE_CHDIR */ +// Create key code translation tables +// +static void createKeyTables(void) +{ + memset(_glfw.ns.publicKeys, -1, sizeof(_glfw.ns.publicKeys)); + + _glfw.ns.publicKeys[0x1D] = GLFW_KEY_0; + _glfw.ns.publicKeys[0x12] = GLFW_KEY_1; + _glfw.ns.publicKeys[0x13] = GLFW_KEY_2; + _glfw.ns.publicKeys[0x14] = GLFW_KEY_3; + _glfw.ns.publicKeys[0x15] = GLFW_KEY_4; + _glfw.ns.publicKeys[0x17] = GLFW_KEY_5; + _glfw.ns.publicKeys[0x16] = GLFW_KEY_6; + _glfw.ns.publicKeys[0x1A] = GLFW_KEY_7; + _glfw.ns.publicKeys[0x1C] = GLFW_KEY_8; + _glfw.ns.publicKeys[0x19] = GLFW_KEY_9; + _glfw.ns.publicKeys[0x00] = GLFW_KEY_A; + _glfw.ns.publicKeys[0x0B] = GLFW_KEY_B; + _glfw.ns.publicKeys[0x08] = GLFW_KEY_C; + _glfw.ns.publicKeys[0x02] = GLFW_KEY_D; + _glfw.ns.publicKeys[0x0E] = GLFW_KEY_E; + _glfw.ns.publicKeys[0x03] = GLFW_KEY_F; + _glfw.ns.publicKeys[0x05] = GLFW_KEY_G; + _glfw.ns.publicKeys[0x04] = GLFW_KEY_H; + _glfw.ns.publicKeys[0x22] = GLFW_KEY_I; + _glfw.ns.publicKeys[0x26] = GLFW_KEY_J; + _glfw.ns.publicKeys[0x28] = GLFW_KEY_K; + _glfw.ns.publicKeys[0x25] = GLFW_KEY_L; + _glfw.ns.publicKeys[0x2E] = GLFW_KEY_M; + _glfw.ns.publicKeys[0x2D] = GLFW_KEY_N; + _glfw.ns.publicKeys[0x1F] = GLFW_KEY_O; + _glfw.ns.publicKeys[0x23] = GLFW_KEY_P; + _glfw.ns.publicKeys[0x0C] = GLFW_KEY_Q; + _glfw.ns.publicKeys[0x0F] = GLFW_KEY_R; + _glfw.ns.publicKeys[0x01] = GLFW_KEY_S; + _glfw.ns.publicKeys[0x11] = GLFW_KEY_T; + _glfw.ns.publicKeys[0x20] = GLFW_KEY_U; + _glfw.ns.publicKeys[0x09] = GLFW_KEY_V; + _glfw.ns.publicKeys[0x0D] = GLFW_KEY_W; + _glfw.ns.publicKeys[0x07] = GLFW_KEY_X; + _glfw.ns.publicKeys[0x10] = GLFW_KEY_Y; + _glfw.ns.publicKeys[0x06] = GLFW_KEY_Z; + + _glfw.ns.publicKeys[0x27] = GLFW_KEY_APOSTROPHE; + _glfw.ns.publicKeys[0x2A] = GLFW_KEY_BACKSLASH; + _glfw.ns.publicKeys[0x2B] = GLFW_KEY_COMMA; + _glfw.ns.publicKeys[0x18] = GLFW_KEY_EQUAL; + _glfw.ns.publicKeys[0x32] = GLFW_KEY_GRAVE_ACCENT; + _glfw.ns.publicKeys[0x21] = GLFW_KEY_LEFT_BRACKET; + _glfw.ns.publicKeys[0x1B] = GLFW_KEY_MINUS; + _glfw.ns.publicKeys[0x2F] = GLFW_KEY_PERIOD; + _glfw.ns.publicKeys[0x1E] = GLFW_KEY_RIGHT_BRACKET; + _glfw.ns.publicKeys[0x29] = GLFW_KEY_SEMICOLON; + _glfw.ns.publicKeys[0x2C] = GLFW_KEY_SLASH; + _glfw.ns.publicKeys[0x0A] = GLFW_KEY_WORLD_1; + + _glfw.ns.publicKeys[0x33] = GLFW_KEY_BACKSPACE; + _glfw.ns.publicKeys[0x39] = GLFW_KEY_CAPS_LOCK; + _glfw.ns.publicKeys[0x75] = GLFW_KEY_DELETE; + _glfw.ns.publicKeys[0x7D] = GLFW_KEY_DOWN; + _glfw.ns.publicKeys[0x77] = GLFW_KEY_END; + _glfw.ns.publicKeys[0x24] = GLFW_KEY_ENTER; + _glfw.ns.publicKeys[0x35] = GLFW_KEY_ESCAPE; + _glfw.ns.publicKeys[0x7A] = GLFW_KEY_F1; + _glfw.ns.publicKeys[0x78] = GLFW_KEY_F2; + _glfw.ns.publicKeys[0x63] = GLFW_KEY_F3; + _glfw.ns.publicKeys[0x76] = GLFW_KEY_F4; + _glfw.ns.publicKeys[0x60] = GLFW_KEY_F5; + _glfw.ns.publicKeys[0x61] = GLFW_KEY_F6; + _glfw.ns.publicKeys[0x62] = GLFW_KEY_F7; + _glfw.ns.publicKeys[0x64] = GLFW_KEY_F8; + _glfw.ns.publicKeys[0x65] = GLFW_KEY_F9; + _glfw.ns.publicKeys[0x6D] = GLFW_KEY_F10; + _glfw.ns.publicKeys[0x67] = GLFW_KEY_F11; + _glfw.ns.publicKeys[0x6F] = GLFW_KEY_F12; + _glfw.ns.publicKeys[0x69] = GLFW_KEY_F13; + _glfw.ns.publicKeys[0x6B] = GLFW_KEY_F14; + _glfw.ns.publicKeys[0x71] = GLFW_KEY_F15; + _glfw.ns.publicKeys[0x6A] = GLFW_KEY_F16; + _glfw.ns.publicKeys[0x40] = GLFW_KEY_F17; + _glfw.ns.publicKeys[0x4F] = GLFW_KEY_F18; + _glfw.ns.publicKeys[0x50] = GLFW_KEY_F19; + _glfw.ns.publicKeys[0x5A] = GLFW_KEY_F20; + _glfw.ns.publicKeys[0x73] = GLFW_KEY_HOME; + _glfw.ns.publicKeys[0x72] = GLFW_KEY_INSERT; + _glfw.ns.publicKeys[0x7B] = GLFW_KEY_LEFT; + _glfw.ns.publicKeys[0x3A] = GLFW_KEY_LEFT_ALT; + _glfw.ns.publicKeys[0x3B] = GLFW_KEY_LEFT_CONTROL; + _glfw.ns.publicKeys[0x38] = GLFW_KEY_LEFT_SHIFT; + _glfw.ns.publicKeys[0x37] = GLFW_KEY_LEFT_SUPER; + _glfw.ns.publicKeys[0x6E] = GLFW_KEY_MENU; + _glfw.ns.publicKeys[0x47] = GLFW_KEY_NUM_LOCK; + _glfw.ns.publicKeys[0x79] = GLFW_KEY_PAGE_DOWN; + _glfw.ns.publicKeys[0x74] = GLFW_KEY_PAGE_UP; + _glfw.ns.publicKeys[0x7C] = GLFW_KEY_RIGHT; + _glfw.ns.publicKeys[0x3D] = GLFW_KEY_RIGHT_ALT; + _glfw.ns.publicKeys[0x3E] = GLFW_KEY_RIGHT_CONTROL; + _glfw.ns.publicKeys[0x3C] = GLFW_KEY_RIGHT_SHIFT; + _glfw.ns.publicKeys[0x36] = GLFW_KEY_RIGHT_SUPER; + _glfw.ns.publicKeys[0x31] = GLFW_KEY_SPACE; + _glfw.ns.publicKeys[0x30] = GLFW_KEY_TAB; + _glfw.ns.publicKeys[0x7E] = GLFW_KEY_UP; + + _glfw.ns.publicKeys[0x52] = GLFW_KEY_KP_0; + _glfw.ns.publicKeys[0x53] = GLFW_KEY_KP_1; + _glfw.ns.publicKeys[0x54] = GLFW_KEY_KP_2; + _glfw.ns.publicKeys[0x55] = GLFW_KEY_KP_3; + _glfw.ns.publicKeys[0x56] = GLFW_KEY_KP_4; + _glfw.ns.publicKeys[0x57] = GLFW_KEY_KP_5; + _glfw.ns.publicKeys[0x58] = GLFW_KEY_KP_6; + _glfw.ns.publicKeys[0x59] = GLFW_KEY_KP_7; + _glfw.ns.publicKeys[0x5B] = GLFW_KEY_KP_8; + _glfw.ns.publicKeys[0x5C] = GLFW_KEY_KP_9; + _glfw.ns.publicKeys[0x45] = GLFW_KEY_KP_ADD; + _glfw.ns.publicKeys[0x41] = GLFW_KEY_KP_DECIMAL; + _glfw.ns.publicKeys[0x4B] = GLFW_KEY_KP_DIVIDE; + _glfw.ns.publicKeys[0x4C] = GLFW_KEY_KP_ENTER; + _glfw.ns.publicKeys[0x51] = GLFW_KEY_KP_EQUAL; + _glfw.ns.publicKeys[0x43] = GLFW_KEY_KP_MULTIPLY; + _glfw.ns.publicKeys[0x4E] = GLFW_KEY_KP_SUBTRACT; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// @@ -81,6 +203,8 @@ int _glfwPlatformInit(void) changeToResourcesDirectory(); #endif + createKeyTables(); + _glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState); if (!_glfw.ns.eventSource) return GL_FALSE; @@ -104,9 +228,12 @@ void _glfwPlatformTerminate(void) _glfw.ns.eventSource = NULL; } - [NSApp setDelegate:nil]; - [_glfw.ns.delegate release]; - _glfw.ns.delegate = nil; + if (_glfw.ns.delegate) + { + [NSApp setDelegate:nil]; + [_glfw.ns.delegate release]; + _glfw.ns.delegate = nil; + } [_glfw.ns.autoreleasePool release]; _glfw.ns.autoreleasePool = nil; @@ -132,6 +259,9 @@ const char* _glfwPlatformGetVersionString(void) #if defined(_GLFW_USE_MENUBAR) " menubar" #endif +#if defined(_GLFW_USE_RETINA) + " retina" +#endif #if defined(_GLFW_BUILD_DLL) " dynamic" #endif diff --git a/extern/glfw/src/cocoa_monitor.m b/extern/glfw/src/cocoa_monitor.m index caddde4..d518973 100644 --- a/extern/glfw/src/cocoa_monitor.m +++ b/extern/glfw/src/cocoa_monitor.m @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 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 @@ -27,6 +27,7 @@ #include "internal.h" +#include #include #include @@ -34,17 +35,20 @@ #include #include #include +#include // Get the name of the specified display // -static const char* getDisplayName(CGDirectDisplayID displayID) +static char* getDisplayName(CGDirectDisplayID displayID) { char* name; CFDictionaryRef info, names; CFStringRef value; CFIndex size; + // NOTE: This uses a deprecated function because Apple has + // (as of January 2015) not provided any alternative info = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID), kIODisplayOnlyPreferredName); names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName)); @@ -52,6 +56,7 @@ static const char* getDisplayName(CGDirectDisplayID displayID) if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"), (const void**) &value)) { + // This may happen if a desktop Mac is running headless _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name"); CFRelease(info); @@ -162,74 +167,57 @@ static void endFadeReservation(CGDisplayFadeReservationToken token) // GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) { - CGDisplayModeRef bestMode = NULL; CFArrayRef modes; CFIndex count, i; - unsigned int sizeDiff, leastSizeDiff = UINT_MAX; - unsigned int rateDiff, leastRateDiff = UINT_MAX; - const int bpp = desired->redBits - desired->greenBits - desired->blueBits; + CVDisplayLinkRef link; + CGDisplayModeRef native = NULL; + GLFWvidmode current; + const GLFWvidmode* best; + + best = _glfwChooseVideoMode(monitor, desired); + _glfwPlatformGetVideoMode(monitor, ¤t); + if (_glfwCompareVideoModes(¤t, best) == 0) + return GL_TRUE; + + CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link); modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL); count = CFArrayGetCount(modes); for (i = 0; i < count; i++) { - CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); - if (!modeIsGood(mode)) + CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); + if (!modeIsGood(dm)) continue; - int modeBPP; - - // Identify display mode pixel encoding + const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link); + if (_glfwCompareVideoModes(best, &mode) == 0) { - CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); - - if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0) - modeBPP = 16; - else - modeBPP = 32; - - CFRelease(format); - } - - const int modeWidth = (int) CGDisplayModeGetWidth(mode); - const int modeHeight = (int) CGDisplayModeGetHeight(mode); - const int modeRate = (int) CGDisplayModeGetRefreshRate(mode); - - sizeDiff = (abs(modeBPP - bpp) << 25) | - ((modeWidth - desired->width) * (modeWidth - desired->width) + - (modeHeight - desired->height) * (modeHeight - desired->height)); - - if (desired->refreshRate) - rateDiff = abs(modeRate - desired->refreshRate); - else - rateDiff = UINT_MAX - modeRate; - - if ((sizeDiff < leastSizeDiff) || - (sizeDiff == leastSizeDiff && rateDiff < leastRateDiff)) - { - bestMode = mode; - leastSizeDiff = sizeDiff; - leastRateDiff = rateDiff; + native = dm; + break; } } - if (!bestMode) + if (native) { - CFRelease(modes); + if (monitor->ns.previousMode == NULL) + monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID); + + CGDisplayFadeReservationToken token = beginFadeReservation(); + CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL); + endFadeReservation(token); + } + + CFRelease(modes); + CVDisplayLinkRelease(link); + + if (!native) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Monitor mode list changed"); return GL_FALSE; } - monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID); - - CGDisplayFadeReservationToken token = beginFadeReservation(); - - CGDisplayCapture(monitor->ns.displayID); - CGDisplaySetDisplayMode(monitor->ns.displayID, bestMode, NULL); - - endFadeReservation(token); - - CFRelease(modes); return GL_TRUE; } @@ -237,12 +225,16 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) // void _glfwRestoreVideoMode(_GLFWmonitor* monitor) { - CGDisplayFadeReservationToken token = beginFadeReservation(); + if (monitor->ns.previousMode) + { + CGDisplayFadeReservationToken token = beginFadeReservation(); + CGDisplaySetDisplayMode(monitor->ns.displayID, + monitor->ns.previousMode, NULL); + endFadeReservation(token); - CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL); - CGDisplayRelease(monitor->ns.displayID); - - endFadeReservation(token); + CGDisplayModeRelease(monitor->ns.previousMode); + monitor->ns.previousMode = NULL; + } } @@ -252,75 +244,65 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor) _GLFWmonitor** _glfwPlatformGetMonitors(int* count) { - uint32_t i, found = 0, monitorCount; + uint32_t i, found = 0, displayCount; _GLFWmonitor** monitors; CGDirectDisplayID* displays; *count = 0; - CGGetActiveDisplayList(0, NULL, &monitorCount); + CGGetOnlineDisplayList(0, NULL, &displayCount); - displays = calloc(monitorCount, sizeof(CGDirectDisplayID)); - monitors = calloc(monitorCount, sizeof(_GLFWmonitor*)); + displays = calloc(displayCount, sizeof(CGDirectDisplayID)); + monitors = calloc(displayCount, sizeof(_GLFWmonitor*)); - CGGetActiveDisplayList(monitorCount, displays, &monitorCount); - - for (i = 0; i < monitorCount; i++) - { - const CGSize size = CGDisplayScreenSize(displays[i]); - - monitors[found] = _glfwCreateMonitor(getDisplayName(displays[i]), - size.width, size.height); - - monitors[found]->ns.displayID = displays[i]; - found++; - } - - free(displays); - - for (i = 0; i < monitorCount; i++) - { - if (CGDisplayIsMain(monitors[i]->ns.displayID)) - { - _GLFWmonitor* temp = monitors[0]; - monitors[0] = monitors[i]; - monitors[i] = temp; - break; - } - } + CGGetOnlineDisplayList(displayCount, displays, &displayCount); NSArray* screens = [NSScreen screens]; - for (i = 0; i < monitorCount; i++) + for (i = 0; i < displayCount; i++) { int j; + if (CGDisplayIsAsleep(displays[i])) + continue; + + CGDirectDisplayID screenDisplayID = CGDisplayMirrorsDisplay(displays[i]); + if (screenDisplayID == kCGNullDirectDisplay) + screenDisplayID = displays[i]; + + const CGSize size = CGDisplayScreenSize(displays[i]); + char* name = getDisplayName(displays[i]); + + monitors[found] = _glfwAllocMonitor(name, size.width, size.height); + monitors[found]->ns.displayID = displays[i]; + + free(name); + for (j = 0; j < [screens count]; j++) { NSScreen* screen = [screens objectAtIndex:j]; NSDictionary* dictionary = [screen deviceDescription]; NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"]; - if (monitors[i]->ns.displayID == [number unsignedIntegerValue]) + if ([number unsignedIntegerValue] == screenDisplayID) { - monitors[i]->ns.screen = screen; + monitors[found]->ns.screen = screen; break; } } - if (monitors[i]->ns.screen == nil) + if (monitors[found]->ns.screen) + found++; + else { - _glfwDestroyMonitors(monitors, monitorCount); - _glfwInputError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to find NSScreen for CGDisplay %s", - monitors[i]->name); - - free(monitors); - return NULL; + _glfwFreeMonitor(monitors[found]); + monitors[found] = NULL; } } - *count = monitorCount; + free(displays); + + *count = found; return monitors; } @@ -342,7 +324,7 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) { CFArrayRef modes; - CFIndex count, i; + CFIndex count, i, j; GLFWvidmode* result; CVDisplayLinkRef link; @@ -356,14 +338,26 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) for (i = 0; i < count; i++) { - CGDisplayModeRef mode; + CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); + if (!modeIsGood(dm)) + continue; - mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); - if (modeIsGood(mode)) + const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link); + + for (j = 0; j < *found; j++) { - result[*found] = vidmodeFromCGDisplayMode(mode, link); - (*found)++; + if (_glfwCompareVideoModes(result + j, &mode) == 0) + break; } + + if (i < *found) + { + // This is a duplicate, so skip it + continue; + } + + result[*found] = mode; + (*found)++; } CFRelease(modes); @@ -386,3 +380,60 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode) CVDisplayLinkRelease(link); } +void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +{ + uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID); + CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue)); + + CGGetDisplayTransferByTable(monitor->ns.displayID, + size, + values, + values + size, + values + size * 2, + &size); + + _glfwAllocGammaArrays(ramp, size); + + for (i = 0; i < size; i++) + { + ramp->red[i] = (unsigned short) (values[i] * 65535); + ramp->green[i] = (unsigned short) (values[i + size] * 65535); + ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535); + } + + free(values); +} + +void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) +{ + int i; + CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue)); + + for (i = 0; i < ramp->size; i++) + { + values[i] = ramp->red[i] / 65535.f; + values[i + ramp->size] = ramp->green[i] / 65535.f; + values[i + ramp->size * 2] = ramp->blue[i] / 65535.f; + } + + CGSetDisplayTransferByTable(monitor->ns.displayID, + ramp->size, + values, + values + ramp->size, + values + ramp->size * 2); + + free(values); +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW native API ////// +////////////////////////////////////////////////////////////////////////// + +GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay); + return monitor->ns.displayID; +} + diff --git a/extern/glfw/src/cocoa_platform.h b/extern/glfw/src/cocoa_platform.h index 0e92c4a..7e131be 100644 --- a/extern/glfw/src/cocoa_platform.h +++ b/extern/glfw/src/cocoa_platform.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 OS X - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // @@ -37,83 +37,57 @@ typedef void* id; #endif +#include "posix_tls.h" + #if defined(_GLFW_NSGL) - #include "nsgl_platform.h" + #include "nsgl_context.h" #else #error "No supported context creation API selected" #endif -#include -#include -#include -#include +#include "iokit_joystick.h" #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns +#define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimeNS ns_time #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNS ns +#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns -//======================================================================== -// GLFW platform specific types -//======================================================================== - - -//------------------------------------------------------------------------ -// Platform-specific window structure -//------------------------------------------------------------------------ +// Cocoa-specific per-window data +// typedef struct _GLFWwindowNS { id object; id delegate; id view; unsigned int modifierFlags; + + // The total sum of the distances the cursor has been warped + // since the last cursor motion event was processed + // This is kept to counteract Cocoa doing the same internally + double warpDeltaX, warpDeltaY; + } _GLFWwindowNS; -//------------------------------------------------------------------------ -// Joystick information & state -//------------------------------------------------------------------------ -typedef struct -{ - int present; - char name[256]; - - IOHIDDeviceInterface** interface; - - CFMutableArrayRef axisElements; - CFMutableArrayRef buttonElements; - CFMutableArrayRef hatElements; - - float* axes; - unsigned char* buttons; - -} _GLFWjoy; - - -//------------------------------------------------------------------------ -// Platform-specific library global data for Cocoa -//------------------------------------------------------------------------ +// Cocoa-specific global data +// typedef struct _GLFWlibraryNS { - struct { - double base; - double resolution; - } timer; - CGEventSourceRef eventSource; id delegate; id autoreleasePool; id cursor; + short int publicKeys[256]; char* clipboardString; - _GLFWjoy joysticks[GLFW_JOYSTICK_LAST + 1]; } _GLFWlibraryNS; -//------------------------------------------------------------------------ -// Platform-specific monitor structure -//------------------------------------------------------------------------ +// Cocoa-specific per-monitor data +// typedef struct _GLFWmonitorNS { CGDirectDisplayID displayID; @@ -123,27 +97,28 @@ typedef struct _GLFWmonitorNS } _GLFWmonitorNS; -//======================================================================== -// Prototypes for platform specific internal functions -//======================================================================== +// Cocoa-specific per-cursor data +// +typedef struct _GLFWcursorNS +{ + id object; + +} _GLFWcursorNS; + + +// Cocoa-specific global timer data +// +typedef struct _GLFWtimeNS +{ + double base; + double resolution; + +} _GLFWtimeNS; + -// Time void _glfwInitTimer(void); -// Joystick input -void _glfwInitJoysticks(void); -void _glfwTerminateJoysticks(void); - -// Fullscreen GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoMode(_GLFWmonitor* monitor); -// OpenGL support -int _glfwInitContextAPI(void); -void _glfwTerminateContextAPI(void); -int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig); -void _glfwDestroyContext(_GLFWwindow* window); - #endif // _cocoa_platform_h_ diff --git a/extern/glfw/src/cocoa_window.m b/extern/glfw/src/cocoa_window.m index 8170194..9d182f4 100644 --- a/extern/glfw/src/cocoa_window.m +++ b/extern/glfw/src/cocoa_window.m @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 OS X - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // @@ -26,10 +26,35 @@ #include "internal.h" +#include + // Needed for _NSGetProgname #include +// Returns the specified standard cursor +// +static NSCursor* getStandardCursor(int shape) +{ + switch (shape) + { + case GLFW_ARROW_CURSOR: + return [NSCursor arrowCursor]; + case GLFW_IBEAM_CURSOR: + return [NSCursor IBeamCursor]; + case GLFW_CROSSHAIR_CURSOR: + return [NSCursor crosshairCursor]; + case GLFW_HAND_CURSOR: + return [NSCursor pointingHandCursor]; + case GLFW_HRESIZE_CURSOR: + return [NSCursor resizeLeftRightCursor]; + case GLFW_VRESIZE_CURSOR: + return [NSCursor resizeUpDownCursor]; + } + + return nil; +} + // Center the cursor in the view of the window // static void centerCursor(_GLFWwindow *window) @@ -41,54 +66,40 @@ static void centerCursor(_GLFWwindow *window) // Update the cursor to match the specified cursor mode // -static void setModeCursor(_GLFWwindow* window, int mode) +static void updateModeCursor(_GLFWwindow* window) { - if (mode == GLFW_CURSOR_NORMAL) - [[NSCursor arrowCursor] set]; + 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 fullscreen mode +// Enter full screen mode // -static void enterFullscreenMode(_GLFWwindow* window) +static GLboolean enterFullscreenMode(_GLFWwindow* window) { - if ([window->ns.view isInFullScreenMode]) - return; + GLboolean status; - _glfwSetVideoMode(window->monitor, &window->videoMode); + status = _glfwSetVideoMode(window->monitor, &window->videoMode); - NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:NO], - NSFullScreenModeAllScreens, - nil]; + // NOTE: The window is resized despite mode setting failure to make + // glfwSetWindowSize more robust + [window->ns.object setFrame:[window->monitor->ns.screen frame] + display:YES]; - [window->ns.view enterFullScreenMode:window->monitor->ns.screen - withOptions:options]; - - // HACK: Synthesize focus event as window does not become key when the view - // is made full screen - // TODO: Remove this when moving to a full screen window - _glfwInputWindowFocus(window, GL_TRUE); + return status; } -// Leave fullscreen mode +// Leave full screen mode // static void leaveFullscreenMode(_GLFWwindow* window) { - if (![window->ns.view isInFullScreenMode]) - return; - - // HACK: Synthesize focus event as window does not become key when the view - // is made full screen - // TODO: Remove this when moving to a full screen window - _glfwInputWindowFocus(window, GL_FALSE); - _glfwRestoreVideoMode(window->monitor); - - // Exit full screen after the video restore to avoid a nasty display - // flickering during the fade - [window->ns.view exitFullScreenModeWithOptions:nil]; } // Transforms the specified y-coordinate between the CG display and NS screen @@ -122,7 +133,7 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) _GLFWwindow* window; } -- (id)initWithGlfwWindow:(_GLFWwindow *)initWndow; +- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow; @end @@ -145,7 +156,11 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) - (void)windowDidResize:(NSNotification *)notification { - [window->nsgl.context update]; + if (_glfw.focusedWindow == window && + window->cursorMode == GLFW_CURSOR_DISABLED) + { + centerCursor(window); + } const NSRect contentRect = [window->ns.view frame]; const NSRect fbRect = convertRectToBacking(window, contentRect); @@ -153,21 +168,19 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); _glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height); _glfwInputWindowDamage(window); - - if (window->cursorMode == GLFW_CURSOR_DISABLED) - centerCursor(window); } - (void)windowDidMove:(NSNotification *)notification { - [window->nsgl.context update]; + if (_glfw.focusedWindow == window && + window->cursorMode == GLFW_CURSOR_DISABLED) + { + centerCursor(window); + } int x, y; _glfwPlatformGetWindowPos(window, &x, &y); _glfwInputWindowPos(window, x, y); - - if (window->cursorMode == GLFW_CURSOR_DISABLED) - centerCursor(window); } - (void)windowDidMiniaturize:(NSNotification *)notification @@ -177,22 +190,30 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) - (void)windowDidDeminiaturize:(NSNotification *)notification { - if (window->monitor) - enterFullscreenMode(window); - _glfwInputWindowIconify(window, GL_FALSE); } - (void)windowDidBecomeKey:(NSNotification *)notification { + if (window->monitor) + enterFullscreenMode(window); + + if (_glfw.focusedWindow == window && + window->cursorMode == GLFW_CURSOR_DISABLED) + { + centerCursor(window); + } + _glfwInputWindowFocus(window, GL_TRUE); - _glfwPlatformSetCursorMode(window, window->cursorMode); + _glfwPlatformApplyCursorMode(window); } - (void)windowDidResignKey:(NSNotification *)notification { + if (window->monitor) + leaveFullscreenMode(window); + _glfwInputWindowFocus(window, GL_FALSE); - _glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL); } @end @@ -217,30 +238,18 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect) return NSTerminateCancel; } -- (void)applicationDidHide:(NSNotification *)notification -{ - _GLFWwindow* window; - - for (window = _glfw.windowListHead; window; window = window->next) - _glfwInputWindowVisibility(window, GL_FALSE); -} - -- (void)applicationDidUnhide:(NSNotification *)notification -{ - _GLFWwindow* window; - - for (window = _glfw.windowListHead; window; window = window->next) - { - if ([window->ns.object isVisible]) - _glfwInputWindowVisibility(window, GL_TRUE); - } -} - - (void)applicationDidChangeScreenParameters:(NSNotification *) notification { _glfwInputMonitorChange(); } +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + [NSApp stop:nil]; + + _glfwPlatformPostEmptyEvent(); +} + @end // Translates OS X key modifiers into GLFW ones @@ -265,143 +274,10 @@ static int translateFlags(NSUInteger flags) // static int translateKey(unsigned int key) { - // Keyboard symbol translation table - static const unsigned int table[128] = - { - /* 00 */ GLFW_KEY_A, - /* 01 */ GLFW_KEY_S, - /* 02 */ GLFW_KEY_D, - /* 03 */ GLFW_KEY_F, - /* 04 */ GLFW_KEY_H, - /* 05 */ GLFW_KEY_G, - /* 06 */ GLFW_KEY_Z, - /* 07 */ GLFW_KEY_X, - /* 08 */ GLFW_KEY_C, - /* 09 */ GLFW_KEY_V, - /* 0a */ GLFW_KEY_WORLD_1, - /* 0b */ GLFW_KEY_B, - /* 0c */ GLFW_KEY_Q, - /* 0d */ GLFW_KEY_W, - /* 0e */ GLFW_KEY_E, - /* 0f */ GLFW_KEY_R, - /* 10 */ GLFW_KEY_Y, - /* 11 */ GLFW_KEY_T, - /* 12 */ GLFW_KEY_1, - /* 13 */ GLFW_KEY_2, - /* 14 */ GLFW_KEY_3, - /* 15 */ GLFW_KEY_4, - /* 16 */ GLFW_KEY_6, - /* 17 */ GLFW_KEY_5, - /* 18 */ GLFW_KEY_EQUAL, - /* 19 */ GLFW_KEY_9, - /* 1a */ GLFW_KEY_7, - /* 1b */ GLFW_KEY_MINUS, - /* 1c */ GLFW_KEY_8, - /* 1d */ GLFW_KEY_0, - /* 1e */ GLFW_KEY_RIGHT_BRACKET, - /* 1f */ GLFW_KEY_O, - /* 20 */ GLFW_KEY_U, - /* 21 */ GLFW_KEY_LEFT_BRACKET, - /* 22 */ GLFW_KEY_I, - /* 23 */ GLFW_KEY_P, - /* 24 */ GLFW_KEY_ENTER, - /* 25 */ GLFW_KEY_L, - /* 26 */ GLFW_KEY_J, - /* 27 */ GLFW_KEY_APOSTROPHE, - /* 28 */ GLFW_KEY_K, - /* 29 */ GLFW_KEY_SEMICOLON, - /* 2a */ GLFW_KEY_BACKSLASH, - /* 2b */ GLFW_KEY_COMMA, - /* 2c */ GLFW_KEY_SLASH, - /* 2d */ GLFW_KEY_N, - /* 2e */ GLFW_KEY_M, - /* 2f */ GLFW_KEY_PERIOD, - /* 30 */ GLFW_KEY_TAB, - /* 31 */ GLFW_KEY_SPACE, - /* 32 */ GLFW_KEY_GRAVE_ACCENT, - /* 33 */ GLFW_KEY_BACKSPACE, - /* 34 */ GLFW_KEY_UNKNOWN, - /* 35 */ GLFW_KEY_ESCAPE, - /* 36 */ GLFW_KEY_RIGHT_SUPER, - /* 37 */ GLFW_KEY_LEFT_SUPER, - /* 38 */ GLFW_KEY_LEFT_SHIFT, - /* 39 */ GLFW_KEY_CAPS_LOCK, - /* 3a */ GLFW_KEY_LEFT_ALT, - /* 3b */ GLFW_KEY_LEFT_CONTROL, - /* 3c */ GLFW_KEY_RIGHT_SHIFT, - /* 3d */ GLFW_KEY_RIGHT_ALT, - /* 3e */ GLFW_KEY_RIGHT_CONTROL, - /* 3f */ GLFW_KEY_UNKNOWN, /* Function */ - /* 40 */ GLFW_KEY_F17, - /* 41 */ GLFW_KEY_KP_DECIMAL, - /* 42 */ GLFW_KEY_UNKNOWN, - /* 43 */ GLFW_KEY_KP_MULTIPLY, - /* 44 */ GLFW_KEY_UNKNOWN, - /* 45 */ GLFW_KEY_KP_ADD, - /* 46 */ GLFW_KEY_UNKNOWN, - /* 47 */ GLFW_KEY_NUM_LOCK, /* Really KeypadClear... */ - /* 48 */ GLFW_KEY_UNKNOWN, /* VolumeUp */ - /* 49 */ GLFW_KEY_UNKNOWN, /* VolumeDown */ - /* 4a */ GLFW_KEY_UNKNOWN, /* Mute */ - /* 4b */ GLFW_KEY_KP_DIVIDE, - /* 4c */ GLFW_KEY_KP_ENTER, - /* 4d */ GLFW_KEY_UNKNOWN, - /* 4e */ GLFW_KEY_KP_SUBTRACT, - /* 4f */ GLFW_KEY_F18, - /* 50 */ GLFW_KEY_F19, - /* 51 */ GLFW_KEY_KP_EQUAL, - /* 52 */ GLFW_KEY_KP_0, - /* 53 */ GLFW_KEY_KP_1, - /* 54 */ GLFW_KEY_KP_2, - /* 55 */ GLFW_KEY_KP_3, - /* 56 */ GLFW_KEY_KP_4, - /* 57 */ GLFW_KEY_KP_5, - /* 58 */ GLFW_KEY_KP_6, - /* 59 */ GLFW_KEY_KP_7, - /* 5a */ GLFW_KEY_F20, - /* 5b */ GLFW_KEY_KP_8, - /* 5c */ GLFW_KEY_KP_9, - /* 5d */ GLFW_KEY_UNKNOWN, - /* 5e */ GLFW_KEY_UNKNOWN, - /* 5f */ GLFW_KEY_UNKNOWN, - /* 60 */ GLFW_KEY_F5, - /* 61 */ GLFW_KEY_F6, - /* 62 */ GLFW_KEY_F7, - /* 63 */ GLFW_KEY_F3, - /* 64 */ GLFW_KEY_F8, - /* 65 */ GLFW_KEY_F9, - /* 66 */ GLFW_KEY_UNKNOWN, - /* 67 */ GLFW_KEY_F11, - /* 68 */ GLFW_KEY_UNKNOWN, - /* 69 */ GLFW_KEY_F13, - /* 6a */ GLFW_KEY_F16, - /* 6b */ GLFW_KEY_F14, - /* 6c */ GLFW_KEY_UNKNOWN, - /* 6d */ GLFW_KEY_F10, - /* 6e */ GLFW_KEY_UNKNOWN, - /* 6f */ GLFW_KEY_F12, - /* 70 */ GLFW_KEY_UNKNOWN, - /* 71 */ GLFW_KEY_F15, - /* 72 */ GLFW_KEY_INSERT, /* Really Help... */ - /* 73 */ GLFW_KEY_HOME, - /* 74 */ GLFW_KEY_PAGE_UP, - /* 75 */ GLFW_KEY_DELETE, - /* 76 */ GLFW_KEY_F4, - /* 77 */ GLFW_KEY_END, - /* 78 */ GLFW_KEY_F2, - /* 79 */ GLFW_KEY_PAGE_DOWN, - /* 7a */ GLFW_KEY_F1, - /* 7b */ GLFW_KEY_LEFT, - /* 7c */ GLFW_KEY_RIGHT, - /* 7d */ GLFW_KEY_DOWN, - /* 7e */ GLFW_KEY_UP, - /* 7f */ GLFW_KEY_UNKNOWN, - }; - - if (key >= 128) + if (key >= sizeof(_glfw.ns.publicKeys) / sizeof(_glfw.ns.publicKeys[0])) return GLFW_KEY_UNKNOWN; - return table[key]; + return _glfw.ns.publicKeys[key]; } @@ -409,7 +285,7 @@ static int translateKey(unsigned int key) // Content view class for the GLFW window //------------------------------------------------------------------------ -@interface GLFWContentView : NSView +@interface GLFWContentView : NSOpenGLView { _GLFWwindow* window; NSTrackingArea* trackingArea; @@ -427,7 +303,7 @@ static int translateKey(unsigned int key) { if (_glfw.ns.cursor == nil) { - NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; + NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]; _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data hotSpot:NSZeroPoint]; [data release]; @@ -437,13 +313,16 @@ static int translateKey(unsigned int key) - (id)initWithGlfwWindow:(_GLFWwindow *)initWindow { - self = [super init]; + self = [super initWithFrame:NSMakeRect(0, 0, 1, 1) + pixelFormat:nil]; if (self != nil) { window = initWindow; trackingArea = nil; [self updateTrackingAreas]; + [self registerForDraggedTypes:[NSArray arrayWithObjects: + NSFilenamesPboardType, nil]]; } return self; @@ -472,7 +351,7 @@ static int translateKey(unsigned int key) - (void)cursorUpdate:(NSEvent *)event { - setModeCursor(window, window->cursorMode); + updateModeCursor(window); } - (void)mouseDown:(NSEvent *)event @@ -499,14 +378,21 @@ static int translateKey(unsigned int key) - (void)mouseMoved:(NSEvent *)event { if (window->cursorMode == GLFW_CURSOR_DISABLED) - _glfwInputCursorMotion(window, [event deltaX], [event deltaY]); + { + _glfwInputCursorMotion(window, + [event deltaX] - window->ns.warpDeltaX, + [event deltaY] - window->ns.warpDeltaY); + } else { const NSRect contentRect = [window->ns.view frame]; - const NSPoint p = [event locationInWindow]; + const NSPoint pos = [event locationInWindow]; - _glfwInputCursorMotion(window, p.x, contentRect.size.height - p.y); + _glfwInputCursorMotion(window, pos.x, contentRect.size.height - pos.y); } + + window->ns.warpDeltaX = 0; + window->ns.warpDeltaY = 0; } - (void)rightMouseDown:(NSEvent *)event @@ -567,6 +453,7 @@ static int translateKey(unsigned int key) const NSRect fbRect = convertRectToBacking(window, contentRect); _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); + _glfwInputWindowDamage(window); } - (void)updateTrackingAreas @@ -577,10 +464,12 @@ static int translateKey(unsigned int key) [trackingArea release]; } - NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | - NSTrackingActiveInKeyWindow | - NSTrackingCursorUpdate | - NSTrackingInVisibleRect; + const NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | + NSTrackingActiveInKeyWindow | + NSTrackingEnabledDuringMouseDrag | + NSTrackingCursorUpdate | + NSTrackingInVisibleRect | + NSTrackingAssumeInside; trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] options:options @@ -595,30 +484,45 @@ static int translateKey(unsigned int key) { const int key = translateKey([event keyCode]); const int mods = translateFlags([event modifierFlags]); + _glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods); NSString* characters = [event characters]; NSUInteger i, length = [characters length]; + const int plain = !(mods & GLFW_MOD_SUPER); for (i = 0; i < length; i++) - _glfwInputChar(window, [characters characterAtIndex:i]); + { + const unichar codepoint = [characters characterAtIndex:i]; + if ((codepoint & 0xff00) == 0xf700) + continue; + + _glfwInputChar(window, codepoint, mods, plain); + } } - (void)flagsChanged:(NSEvent *)event { int action; - unsigned int newModifierFlags = + const unsigned int modifierFlags = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask; + const int key = translateKey([event keyCode]); + const int mods = translateFlags(modifierFlags); - if (newModifierFlags > window->ns.modifierFlags) + if (modifierFlags == window->ns.modifierFlags) + { + if (window->keys[key] == GLFW_PRESS) + action = GLFW_RELEASE; + else + action = GLFW_PRESS; + } + else if (modifierFlags > window->ns.modifierFlags) action = GLFW_PRESS; else action = GLFW_RELEASE; - window->ns.modifierFlags = newModifierFlags; + window->ns.modifierFlags = modifierFlags; - const int key = translateKey([event keyCode]); - const int mods = translateFlags([event modifierFlags]); _glfwInputKey(window, key, [event keyCode], action, mods); } @@ -656,6 +560,59 @@ static int translateKey(unsigned int key) _glfwInputScroll(window, deltaX, deltaY); } +- (NSDragOperation)draggingEntered:(id )sender +{ + if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) + == NSDragOperationGeneric) + { + [self setNeedsDisplay:YES]; + return NSDragOperationGeneric; + } + + return NSDragOperationNone; +} + +- (BOOL)prepareForDragOperation:(id )sender +{ + [self setNeedsDisplay:YES]; + return YES; +} + +- (BOOL)performDragOperation:(id )sender +{ + NSPasteboard* pasteboard = [sender draggingPasteboard]; + NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType]; + + const NSRect contentRect = [window->ns.view frame]; + _glfwInputCursorMotion(window, + [sender draggingLocation].x, + contentRect.size.height - [sender draggingLocation].y); + + const int count = [files count]; + if (count) + { + NSEnumerator* e = [files objectEnumerator]; + char** names = calloc(count, sizeof(char*)); + int i; + + for (i = 0; i < count; i++) + names[i] = strdup([[e nextObject] UTF8String]); + + _glfwInputDrop(window, count, (const char**) names); + + for (i = 0; i < count; i++) + free(names[i]); + free(names); + } + + return YES; +} + +- (void)concludeDragOperation:(id )sender +{ + [self setNeedsDisplay:YES]; +} + @end @@ -739,7 +696,7 @@ static NSString* findAppName(void) // This is nasty, nasty stuff -- calls to undocumented semi-private APIs that // could go away at any moment, lots of stuff that really should be // localize(d|able), etc. Loading a nib would save us this horror, but that -// doesn't seem like a good thing to require of GLFW's clients. +// doesn't seem like a good thing to require of GLFW users. // static void createMenuBar(void) { @@ -836,7 +793,18 @@ static GLboolean initializeAppKit(void) createMenuBar(); #endif - [NSApp finishLaunching]; + // There can only be one application delegate, but we allocate it the + // first time a window is created to keep all window code in this file + _glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init]; + if (_glfw.ns.delegate == nil) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Failed to create application delegate"); + return GL_FALSE; + } + + [NSApp setDelegate:_glfw.ns.delegate]; + [NSApp run]; return GL_TRUE; } @@ -846,6 +814,14 @@ static GLboolean initializeAppKit(void) 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 GL_FALSE; + } + unsigned int styleMask = 0; if (wndconfig->monitor || !wndconfig->decorated) @@ -859,8 +835,15 @@ static GLboolean createWindow(_GLFWwindow* window, styleMask |= NSResizableWindowMask; } + NSRect contentRect; + + if (wndconfig->monitor) + contentRect = [wndconfig->monitor->ns.screen frame]; + else + contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); + window->ns.object = [[GLFWWindow alloc] - initWithContentRect:NSMakeRect(0, 0, wndconfig->width, wndconfig->height) + initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; @@ -871,23 +854,30 @@ static GLboolean createWindow(_GLFWwindow* window, return GL_FALSE; } - window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window]; - #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { - [window->ns.view setWantsBestResolutionOpenGLSurface:YES]; - if (wndconfig->resizable) [window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ + if (wndconfig->monitor) + { + [window->ns.object setLevel:NSMainMenuWindowLevel + 1]; + [window->ns.object setHidesOnDeactivate:YES]; + } + else + { + [window->ns.object center]; + + if (wndconfig->floating) + [window->ns.object setLevel:NSFloatingWindowLevel]; + } + [window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]]; - [window->ns.object setContentView:window->ns.view]; [window->ns.object setDelegate:window->ns.delegate]; [window->ns.object setAcceptsMouseMovedEvents:YES]; - [window->ns.object center]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) @@ -904,47 +894,42 @@ static GLboolean createWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { if (!initializeAppKit()) return GL_FALSE; - // There can only be one application delegate, but we allocate it the - // first time a window is created to keep all window code in this file - if (_glfw.ns.delegate == nil) - { - _glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init]; - if (_glfw.ns.delegate == nil) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to create application delegate"); - return GL_FALSE; - } - - [NSApp setDelegate:_glfw.ns.delegate]; - } - - window->ns.delegate = [[GLFWWindowDelegate alloc] initWithGlfwWindow:window]; - if (window->ns.delegate == nil) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to create window delegate"); - return GL_FALSE; - } - - // Don't use accumulation buffer support; it's not accelerated - // Aux buffers probably aren't accelerated either - if (!createWindow(window, wndconfig)) return GL_FALSE; - if (!_glfwCreateContext(window, wndconfig, fbconfig)) + if (!_glfwCreateContext(window, ctxconfig, fbconfig)) return GL_FALSE; + window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window]; + +#if defined(_GLFW_USE_RETINA) +#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 setContentView:window->ns.view]; + // NOTE: If you set the pixel format before the context it creates another + // context, only to have it destroyed by the next line + // We cannot use the view to create the context because that interface + // does not support context resource sharing + [window->ns.view setOpenGLContext:window->nsgl.context]; + [window->ns.view setPixelFormat:window->nsgl.pixelFormat]; [window->nsgl.context setView:window->ns.view]; if (wndconfig->monitor) - enterFullscreenMode(window); + { + _glfwPlatformShowWindow(window); + if (!enterFullscreenMode(window)) + return GL_FALSE; + } return GL_TRUE; } @@ -1019,11 +1004,27 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* heigh *height = (int) fbRect.size.height; } +void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + int* left, int* top, + int* right, int* bottom) +{ + const NSRect contentRect = [window->ns.view frame]; + const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect]; + + if (left) + *left = contentRect.origin.x - frameRect.origin.x; + if (top) + *top = frameRect.origin.y + frameRect.size.height - + contentRect.origin.y - contentRect.size.height; + if (right) + *right = frameRect.origin.x + frameRect.size.width - + contentRect.origin.x - contentRect.size.width; + if (bottom) + *bottom = contentRect.origin.y - frameRect.origin.y; +} + void _glfwPlatformIconifyWindow(_GLFWwindow* window) { - if (window->monitor) - leaveFullscreenMode(window); - [window->ns.object miniaturize:nil]; } @@ -1041,13 +1042,31 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) [NSApp activateIgnoringOtherApps:YES]; [window->ns.object makeKeyAndOrderFront:nil]; - _glfwInputWindowVisibility(window, GL_TRUE); +} + +void _glfwPlatformUnhideWindow(_GLFWwindow* window) +{ + [window->ns.object orderFront:nil]; } void _glfwPlatformHideWindow(_GLFWwindow* window) { [window->ns.object orderOut:nil]; - _glfwInputWindowVisibility(window, GL_FALSE); +} + +int _glfwPlatformWindowFocused(_GLFWwindow* window) +{ + return [window->ns.object isKeyWindow]; +} + +int _glfwPlatformWindowIconified(_GLFWwindow* window) +{ + return [window->ns.object isMiniaturized]; +} + +int _glfwPlatformWindowVisible(_GLFWwindow* window) +{ + return [window->ns.object isVisible]; } void _glfwPlatformPollEvents(void) @@ -1082,9 +1101,42 @@ void _glfwPlatformWaitEvents(void) _glfwPlatformPollEvents(); } +void _glfwPlatformPostEmptyEvent(void) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined + location:NSMakePoint(0, 0) + modifierFlags:0 + timestamp:0 + windowNumber:0 + context:nil + subtype:0 + data1:0 + data2:0]; + [NSApp postEvent:event atStart:YES]; + [pool drain]; +} + +void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) +{ + const NSRect contentRect = [window->ns.view frame]; + const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; + + if (xpos) + *xpos = pos.x; + if (ypos) + *ypos = contentRect.size.height - pos.y - 1; +} + void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { - setModeCursor(window, window->cursorMode); + updateModeCursor(window); + + const NSRect contentRect = [window->ns.view frame]; + const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; + + window->ns.warpDeltaX += x - pos.x; + window->ns.warpDeltaY += y - contentRect.size.height + pos.y; if (window->monitor) { @@ -1093,7 +1145,6 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) } else { - const NSRect contentRect = [window->ns.view frame]; const NSPoint localPoint = NSMakePoint(x, contentRect.size.height - y - 1); const NSPoint globalPoint = [window->ns.object convertBaseToScreen:localPoint]; @@ -1102,19 +1153,123 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) } } -void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) +void _glfwPlatformApplyCursorMode(_GLFWwindow* window) { - setModeCursor(window, mode); + updateModeCursor(window); - if (mode == GLFW_CURSOR_DISABLED) - { + if (window->cursorMode == GLFW_CURSOR_DISABLED) CGAssociateMouseAndMouseCursorPosition(false); - centerCursor(window); - } else CGAssociateMouseAndMouseCursorPosition(true); } +int _glfwPlatformCreateCursor(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) +{ + NSImage* native; + NSBitmapImageRep* rep; + + rep = [[NSBitmapImageRep alloc] + initWithBitmapDataPlanes:NULL + pixelsWide:image->width + pixelsHigh:image->height + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSCalibratedRGBColorSpace + bitmapFormat:NSAlphaNonpremultipliedBitmapFormat + bytesPerRow:image->width * 4 + bitsPerPixel:32]; + + if (rep == nil) + return GL_FALSE; + + memcpy([rep bitmapData], image->pixels, image->width * image->height * 4); + + native = [[NSImage alloc] initWithSize:NSMakeSize(image->width, image->height)]; + [native addRepresentation: rep]; + + cursor->ns.object = [[NSCursor alloc] initWithImage:native + hotSpot:NSMakePoint(xhot, yhot)]; + + [native release]; + [rep release]; + + if (cursor->ns.object == nil) + return GL_FALSE; + + return GL_TRUE; +} + +int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) +{ + cursor->ns.object = getStandardCursor(shape); + if (!cursor->ns.object) + { + _glfwInputError(GLFW_INVALID_ENUM, "Cocoa: Invalid standard cursor"); + return GL_FALSE; + } + + [cursor->ns.object retain]; + return GL_TRUE; +} + +void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) +{ + if (cursor->ns.object) + [(NSCursor*) cursor->ns.object release]; +} + +void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) +{ + const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream]; + + if (window->cursorMode == GLFW_CURSOR_NORMAL && + [window->ns.view mouse:pos inRect:[window->ns.view frame]]) + { + if (cursor) + [(NSCursor*) cursor->ns.object set]; + else + [[NSCursor arrowCursor] set]; + } +} + +void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) +{ + NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil]; + + NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; + [pasteboard declareTypes:types owner:nil]; + [pasteboard setString:[NSString stringWithUTF8String:string] + forType:NSStringPboardType]; +} + +const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) +{ + NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; + + if (![[pasteboard types] containsObject:NSStringPboardType]) + { + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL); + return NULL; + } + + NSString* object = [pasteboard stringForType:NSStringPboardType]; + if (!object) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Cocoa: Failed to retrieve object from pasteboard"); + return NULL; + } + + free(_glfw.ns.clipboardString); + _glfw.ns.clipboardString = strdup([object UTF8String]); + + return _glfw.ns.clipboardString; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// diff --git a/extern/glfw/src/context.c b/extern/glfw/src/context.c index 3bc86bc..f8b8008 100644 --- a/extern/glfw/src/context.c +++ b/extern/glfw/src/context.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -35,9 +35,9 @@ // Parses the client API version string and extracts the version number // -static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) +static GLboolean parseVersionString(int* api, int* major, int* minor, int* rev) { - int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0; + int i; const char* version; const char* prefixes[] = { @@ -47,6 +47,8 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) NULL }; + *api = GLFW_OPENGL_API; + version = (const char*) glGetString(GL_VERSION); if (!version) { @@ -62,23 +64,18 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) if (strncmp(version, prefixes[i], length) == 0) { version += length; - _api = GLFW_OPENGL_ES_API; + *api = GLFW_OPENGL_ES_API; break; } } - if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev)) + if (!sscanf(version, "%d.%d.%d", major, minor, rev)) { _glfwInputError(GLFW_PLATFORM_ERROR, "No version found in context version string"); return GL_FALSE; } - *api = _api; - *major = _major; - *minor = _minor; - *rev = _rev; - return GL_TRUE; } @@ -87,21 +84,21 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) +GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) { - if (wndconfig->clientAPI != GLFW_OPENGL_API && - wndconfig->clientAPI != GLFW_OPENGL_ES_API) + if (ctxconfig->api != GLFW_OPENGL_API && + ctxconfig->api != GLFW_OPENGL_ES_API) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid client API requested"); return GL_FALSE; } - if (wndconfig->clientAPI == GLFW_OPENGL_API) + if (ctxconfig->api == GLFW_OPENGL_API) { - if ((wndconfig->glMajor < 1 || wndconfig->glMinor < 0) || - (wndconfig->glMajor == 1 && wndconfig->glMinor > 5) || - (wndconfig->glMajor == 2 && wndconfig->glMinor > 1) || - (wndconfig->glMajor == 3 && wndconfig->glMinor > 3)) + if ((ctxconfig->major < 1 || ctxconfig->minor < 0) || + (ctxconfig->major == 1 && ctxconfig->minor > 5) || + (ctxconfig->major == 2 && ctxconfig->minor > 1) || + (ctxconfig->major == 3 && ctxconfig->minor > 3)) { // OpenGL 1.0 is the smallest valid version // OpenGL 1.x series ended with version 1.5 @@ -110,7 +107,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) _glfwInputError(GLFW_INVALID_VALUE, "Invalid OpenGL version %i.%i requested", - wndconfig->glMajor, wndconfig->glMinor); + ctxconfig->major, ctxconfig->minor); return GL_FALSE; } else @@ -118,18 +115,18 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) // For now, let everything else through } - if (wndconfig->glProfile) + if (ctxconfig->profile) { - if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE && - wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE) + if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE && + ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid OpenGL profile requested"); return GL_FALSE; } - if (wndconfig->glMajor < 3 || - (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)) + if (ctxconfig->major < 3 || + (ctxconfig->major == 3 && ctxconfig->minor < 2)) { // Desktop OpenGL context profiles are only defined for version 3.2 // and above @@ -141,7 +138,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) } } - if (wndconfig->glForward && wndconfig->glMajor < 3) + if (ctxconfig->forward && ctxconfig->major < 3) { // Forward-compatible contexts are only defined for OpenGL version 3.0 and above _glfwInputError(GLFW_INVALID_VALUE, @@ -150,11 +147,11 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) return GL_FALSE; } } - else if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + else if (ctxconfig->api == GLFW_OPENGL_ES_API) { - if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0 || - (wndconfig->glMajor == 1 && wndconfig->glMinor > 1) || - (wndconfig->glMajor == 2 && wndconfig->glMinor > 0)) + if (ctxconfig->major < 1 || ctxconfig->minor < 0 || + (ctxconfig->major == 1 && ctxconfig->minor > 1) || + (ctxconfig->major == 2 && ctxconfig->minor > 0)) { // OpenGL ES 1.0 is the smallest valid version // OpenGL ES 1.x series ended with version 1.1 @@ -162,7 +159,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) _glfwInputError(GLFW_INVALID_VALUE, "Invalid OpenGL ES version %i.%i requested", - wndconfig->glMajor, wndconfig->glMinor); + ctxconfig->major, ctxconfig->minor); return GL_FALSE; } else @@ -170,7 +167,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) // For now, let everything else through } - if (wndconfig->glProfile) + if (ctxconfig->profile) { // OpenGL ES does not support profiles _glfwInputError(GLFW_INVALID_VALUE, @@ -178,7 +175,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) return GL_FALSE; } - if (wndconfig->glForward) + if (ctxconfig->forward) { // OpenGL ES does not support forward-compatibility _glfwInputError(GLFW_INVALID_VALUE, @@ -187,10 +184,10 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) } } - if (wndconfig->glRobustness) + if (ctxconfig->robustness) { - if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION && - wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET) + if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION && + ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid context robustness mode requested"); @@ -198,6 +195,17 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) } } + if (ctxconfig->release) + { + if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE && + ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH) + { + _glfwInputError(GLFW_INVALID_VALUE, + "Invalid context release behavior requested"); + return GL_FALSE; + } + } + return GL_TRUE; } @@ -222,6 +230,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, continue; } + if (desired->doublebuffer != current->doublebuffer) + { + // Double buffering is a hard constraint + continue; + } + // Count number of missing buffers { missing = 0; @@ -235,8 +249,11 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, if (desired->stencilBits > 0 && current->stencilBits == 0) missing++; - if (desired->auxBuffers > 0 && current->auxBuffers < desired->auxBuffers) + if (desired->auxBuffers > 0 && + current->auxBuffers < desired->auxBuffers) + { missing += desired->auxBuffers - current->auxBuffers; + } if (desired->samples > 0 && current->samples == 0) { @@ -254,19 +271,19 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, { colorDiff = 0; - if (desired->redBits > 0) + if (desired->redBits != GLFW_DONT_CARE) { colorDiff += (desired->redBits - current->redBits) * (desired->redBits - current->redBits); } - if (desired->greenBits > 0) + if (desired->greenBits != GLFW_DONT_CARE) { colorDiff += (desired->greenBits - current->greenBits) * (desired->greenBits - current->greenBits); } - if (desired->blueBits > 0) + if (desired->blueBits != GLFW_DONT_CARE) { colorDiff += (desired->blueBits - current->blueBits) * (desired->blueBits - current->blueBits); @@ -277,59 +294,56 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, { extraDiff = 0; - if (desired->alphaBits > 0) + if (desired->alphaBits != GLFW_DONT_CARE) { extraDiff += (desired->alphaBits - current->alphaBits) * (desired->alphaBits - current->alphaBits); } - if (desired->depthBits > 0) + if (desired->depthBits != GLFW_DONT_CARE) { extraDiff += (desired->depthBits - current->depthBits) * (desired->depthBits - current->depthBits); } - if (desired->stencilBits > 0) + if (desired->stencilBits != GLFW_DONT_CARE) { extraDiff += (desired->stencilBits - current->stencilBits) * (desired->stencilBits - current->stencilBits); } - if (desired->accumRedBits > 0) + if (desired->accumRedBits != GLFW_DONT_CARE) { extraDiff += (desired->accumRedBits - current->accumRedBits) * (desired->accumRedBits - current->accumRedBits); } - if (desired->accumGreenBits > 0) + if (desired->accumGreenBits != GLFW_DONT_CARE) { extraDiff += (desired->accumGreenBits - current->accumGreenBits) * (desired->accumGreenBits - current->accumGreenBits); } - if (desired->accumBlueBits > 0) + if (desired->accumBlueBits != GLFW_DONT_CARE) { extraDiff += (desired->accumBlueBits - current->accumBlueBits) * (desired->accumBlueBits - current->accumBlueBits); } - if (desired->accumAlphaBits > 0) + if (desired->accumAlphaBits != GLFW_DONT_CARE) { extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) * (desired->accumAlphaBits - current->accumAlphaBits); } - if (desired->samples > 0) + if (desired->samples != GLFW_DONT_CARE) { extraDiff += (desired->samples - current->samples) * (desired->samples - current->samples); } - if (desired->sRGB) - { - if (!current->sRGB) - extraDiff++; - } + if (desired->sRGB && !current->sRGB) + extraDiff++; } // Figure out if the current one is better than the best one found so far @@ -358,20 +372,20 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, return closest; } -GLboolean _glfwRefreshContextAttribs(void) +GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); - if (!parseGLVersion(&window->clientAPI, - &window->glMajor, - &window->glMinor, - &window->glRevision)) + if (!parseVersionString(&window->context.api, + &window->context.major, + &window->context.minor, + &window->context.revision)) { return GL_FALSE; } #if defined(_GLFW_USE_OPENGL) - if (window->glMajor > 2) + 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 @@ -386,46 +400,47 @@ GLboolean _glfwRefreshContextAttribs(void) } } - if (window->clientAPI == GLFW_OPENGL_API) + if (window->context.api == GLFW_OPENGL_API) { // Read back context flags (OpenGL 3.0 and above) - if (window->glMajor >= 3) + if (window->context.major >= 3) { GLint flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags); if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) - window->glForward = GL_TRUE; + window->context.forward = GL_TRUE; if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) - window->glDebug = GL_TRUE; - else if (glfwExtensionSupported("GL_ARB_debug_output")) + 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->glDebug = GL_TRUE; + window->context.debug = GL_TRUE; } } // Read back OpenGL context profile (OpenGL 3.2 and above) - if (window->glMajor > 3 || - (window->glMajor == 3 && window->glMinor >= 2)) + if (window->context.major > 3 || + (window->context.major == 3 && window->context.minor >= 2)) { GLint mask; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) - window->glProfile = GLFW_OPENGL_COMPAT_PROFILE; + window->context.profile = GLFW_OPENGL_COMPAT_PROFILE; else if (mask & GL_CONTEXT_CORE_PROFILE_BIT) - window->glProfile = GLFW_OPENGL_CORE_PROFILE; + window->context.profile = GLFW_OPENGL_CORE_PROFILE; else if (glfwExtensionSupported("GL_ARB_compatibility")) { // HACK: This is a workaround for the compatibility profile bit // not being set in the context flags if an OpenGL 3.2+ // context was created without having requested a specific // version - window->glProfile = GLFW_OPENGL_COMPAT_PROFILE; + window->context.profile = GLFW_OPENGL_COMPAT_PROFILE; } } @@ -439,9 +454,9 @@ GLboolean _glfwRefreshContextAttribs(void) glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy); if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB) - window->glRobustness = GLFW_LOSE_CONTEXT_ON_RESET; + window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET; else if (strategy == GL_NO_RESET_NOTIFICATION_ARB) - window->glRobustness = GLFW_NO_RESET_NOTIFICATION; + window->context.robustness = GLFW_NO_RESET_NOTIFICATION; } } else @@ -456,23 +471,34 @@ GLboolean _glfwRefreshContextAttribs(void) glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy); if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB) - window->glRobustness = GLFW_LOSE_CONTEXT_ON_RESET; + window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET; else if (strategy == GL_NO_RESET_NOTIFICATION_ARB) - window->glRobustness = GLFW_NO_RESET_NOTIFICATION; + window->context.robustness = GLFW_NO_RESET_NOTIFICATION; } } + + if (glfwExtensionSupported("GL_KHR_context_flush_control")) + { + GLint behavior; + glGetIntegerv(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 return GL_TRUE; } -GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig) +GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); - if (window->glMajor < wndconfig->glMajor || - (window->glMajor == wndconfig->glMajor && - window->glMinor < wndconfig->glMinor)) + if (window->context.major < ctxconfig->major || + (window->context.major == ctxconfig->major && + window->context.minor < ctxconfig->minor)) { // The desired OpenGL version is greater than the actual version // This only happens if the machine lacks {GLX|WGL}_ARB_create_context @@ -562,7 +588,6 @@ GLFWAPI void glfwSwapInterval(int interval) GLFWAPI int glfwExtensionSupported(const char* extension) { - const GLubyte* extensions; _GLFWwindow* window; _GLFW_REQUIRE_INIT_OR_RETURN(GL_FALSE); @@ -574,29 +599,14 @@ GLFWAPI int glfwExtensionSupported(const char* extension) return GL_FALSE; } - if (!extension || *extension == '\0') + if (*extension == '\0') { _glfwInputError(GLFW_INVALID_VALUE, NULL); return GL_FALSE; } - if (window->glMajor < 3) - { - // Check if extension is in the old style OpenGL extensions string - - extensions = glGetString(GL_EXTENSIONS); - if (!extensions) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Failed to retrieve extension string"); - return GL_FALSE; - } - - if (_glfwStringInExtensionString(extension, extensions)) - return GL_TRUE; - } #if defined(_GLFW_USE_OPENGL) - else + if (window->context.major >= 3) { int i; GLint count; @@ -619,7 +629,22 @@ GLFWAPI int glfwExtensionSupported(const char* extension) return GL_TRUE; } } + else #endif // _GLFW_USE_OPENGL + { + // Check if extension is in the old style OpenGL extensions string + + const GLubyte* extensions = glGetString(GL_EXTENSIONS); + if (!extensions) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Failed to retrieve extension string"); + return GL_FALSE; + } + + if (_glfwStringInExtensionString(extension, extensions)) + return GL_TRUE; + } // Check if extension is in the platform-specific string return _glfwPlatformExtensionSupported(extension); diff --git a/extern/glfw/src/egl_context.c b/extern/glfw/src/egl_context.c index bab955f..e3335a5 100644 --- a/extern/glfw/src/egl_context.c +++ b/extern/glfw/src/egl_context.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 EGL - www.glfw.org +// GLFW 3.1 EGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -32,22 +32,6 @@ #include -// Thread local storage attribute macro -// -#if defined(_MSC_VER) - #define _GLFW_TLS __declspec(thread) -#elif defined(__GNUC__) - #define _GLFW_TLS __thread -#else - #define _GLFW_TLS -#endif - - -// The per-thread current context/window pointer -// -static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL; - - // Return a description of the specified EGL error // static const char* getErrorString(EGLint error) @@ -108,7 +92,7 @@ static int getConfigAttrib(EGLConfig config, int attrib) // Return a list of available and usable framebuffer configs // -static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, +static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* desired, EGLConfig* result) { @@ -155,9 +139,9 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, continue; } - if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + if (ctxconfig->api == GLFW_OPENGL_ES_API) { - if (wndconfig->glMajor == 1) + if (ctxconfig->major == 1) { if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT)) continue; @@ -168,7 +152,7 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, continue; } } - else if (wndconfig->clientAPI == GLFW_OPENGL_API) + else if (ctxconfig->api == GLFW_OPENGL_API) { if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT)) continue; @@ -183,6 +167,7 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, u->stencilBits = getConfigAttrib(n, EGL_STENCIL_SIZE); u->samples = getConfigAttrib(n, EGL_SAMPLES); + u->doublebuffer = GL_TRUE; u->egl = n; usableCount++; @@ -207,6 +192,9 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, // int _glfwInitContextAPI(void) { + if (!_glfwInitTLS()) + return GL_FALSE; + _glfw.egl.display = eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY); if (_glfw.egl.display == EGL_NO_DISPLAY) { @@ -237,6 +225,8 @@ int _glfwInitContextAPI(void) void _glfwTerminateContextAPI(void) { eglTerminate(_glfw.egl.display); + + _glfwTerminateTLS(); } #define setEGLattrib(attribName, attribValue) \ @@ -246,21 +236,20 @@ void _glfwTerminateContextAPI(void) assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \ } -// Prepare for creation of the OpenGL context +// Create the OpenGL or OpenGL ES context // int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int attribs[40]; - EGLint count = 0; EGLConfig config; EGLContext share = NULL; - if (wndconfig->share) - share = wndconfig->share->egl.context; + if (ctxconfig->share) + share = ctxconfig->share->egl.context; - if (!chooseFBConfigs(wndconfig, fbconfig, &config)) + if (!chooseFBConfigs(ctxconfig, fbconfig, &config)) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to find a suitable EGLConfig"); @@ -270,6 +259,7 @@ int _glfwCreateContext(_GLFWwindow* window, #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; @@ -306,8 +296,7 @@ int _glfwCreateContext(_GLFWwindow* window, window->egl.visual = XGetVisualInfo(_glfw.x11.display, mask, &info, &count); - - if (window->egl.visual == NULL) + if (!window->egl.visual) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to retrieve visual for EGLConfig"); @@ -316,7 +305,7 @@ int _glfwCreateContext(_GLFWwindow* window, } #endif // _GLFW_X11 - if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + if (ctxconfig->api == GLFW_OPENGL_ES_API) { if (!eglBindAPI(EGL_OPENGL_ES_API)) { @@ -341,34 +330,34 @@ int _glfwCreateContext(_GLFWwindow* window, { int index = 0, mask = 0, flags = 0, strategy = 0; - if (wndconfig->clientAPI == GLFW_OPENGL_API) + if (ctxconfig->api == GLFW_OPENGL_API) { - if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE) + if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; - else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE) + else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; - if (wndconfig->glForward) + if (ctxconfig->forward) flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; - if (wndconfig->glDebug) + if (ctxconfig->debug) flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; } - if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS) + if (ctxconfig->robustness) { - if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) + if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) strategy = EGL_NO_RESET_NOTIFICATION_KHR; - else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) + else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR; flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; } - if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0) + if (ctxconfig->major != 1 || ctxconfig->minor != 0) { - setEGLattrib(EGL_CONTEXT_MAJOR_VERSION_KHR, wndconfig->glMajor); - setEGLattrib(EGL_CONTEXT_MINOR_VERSION_KHR, wndconfig->glMinor); + setEGLattrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major); + setEGLattrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor); } if (mask) @@ -386,12 +375,15 @@ int _glfwCreateContext(_GLFWwindow* window, { int index = 0; - if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) - setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, wndconfig->glMajor); + if (ctxconfig->api == GLFW_OPENGL_ES_API) + setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major); setEGLattrib(EGL_NONE, EGL_NONE); } + // 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->egl.context = eglCreateContext(_glfw.egl.display, config, share, attribs); @@ -438,7 +430,7 @@ void _glfwDestroyContext(_GLFWwindow* window) // Analyzes the specified context for possible recreation // int _glfwAnalyzeContext(const _GLFWwindow* window, - const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { #if defined(_GLFW_WIN32) @@ -482,12 +474,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } - _glfwCurrentWindow = window; -} - -_GLFWwindow* _glfwPlatformGetCurrentContext(void) -{ - return _glfwCurrentWindow; + _glfwSetCurrentContext(window); } void _glfwPlatformSwapBuffers(_GLFWwindow* window) @@ -526,21 +513,21 @@ GLFWglproc _glfwPlatformGetProcAddress(const char* procname) GLFWAPI EGLDisplay glfwGetEGLDisplay(void) { - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_DISPLAY); return _glfw.egl.display; } GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT); return window->egl.context; } GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT_OR_RETURN(0); + _GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE); return window->egl.surface; } diff --git a/extern/glfw/src/egl_platform.h b/extern/glfw/src/egl_context.h similarity index 69% rename from extern/glfw/src/egl_platform.h rename to extern/glfw/src/egl_context.h index 1109eb9..21d6852 100644 --- a/extern/glfw/src/egl_platform.h +++ b/extern/glfw/src/egl_context.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 EGL - www.glfw.org +// GLFW 3.1 EGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -25,8 +25,8 @@ // //======================================================================== -#ifndef _egl_platform_h_ -#define _egl_platform_h_ +#ifndef _egl_context_h_ +#define _egl_context_h_ #include @@ -40,18 +40,13 @@ #include #endif -#define _GLFW_PLATFORM_FBCONFIG EGLConfig egl -#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextEGL egl -#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryEGL egl +#define _GLFW_PLATFORM_FBCONFIG EGLConfig egl +#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextEGL egl +#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryEGL egl -//======================================================================== -// GLFW platform specific types -//======================================================================== - -//------------------------------------------------------------------------ -// Platform-specific OpenGL context structure -//------------------------------------------------------------------------ +// EGL-specific per-context data +// typedef struct _GLFWcontextEGL { EGLConfig config; @@ -61,12 +56,12 @@ typedef struct _GLFWcontextEGL #if defined(_GLFW_X11) XVisualInfo* visual; #endif + } _GLFWcontextEGL; -//------------------------------------------------------------------------ -// Platform-specific library global data for EGL -//------------------------------------------------------------------------ +// EGL-specific global data +// typedef struct _GLFWlibraryEGL { EGLDisplay display; @@ -77,4 +72,14 @@ typedef struct _GLFWlibraryEGL } _GLFWlibraryEGL; -#endif // _egl_platform_h_ +int _glfwInitContextAPI(void); +void _glfwTerminateContextAPI(void); +int _glfwCreateContext(_GLFWwindow* window, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig); +void _glfwDestroyContext(_GLFWwindow* window); +int _glfwAnalyzeContext(const _GLFWwindow* window, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig); + +#endif // _egl_context_h_ diff --git a/extern/glfw/src/gamma.c b/extern/glfw/src/gamma.c deleted file mode 100644 index 8d78304..0000000 --- a/extern/glfw/src/gamma.c +++ /dev/null @@ -1,126 +0,0 @@ -//======================================================================== -// GLFW 3.0 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#include -#include -#include - -#if defined(_MSC_VER) - #include -#endif - - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size) -{ - ramp->red = calloc(size, sizeof(unsigned short)); - ramp->green = calloc(size, sizeof(unsigned short)); - ramp->blue = calloc(size, sizeof(unsigned short)); - ramp->size = size; -} - -void _glfwFreeGammaArrays(GLFWgammaramp* ramp) -{ - free(ramp->red); - free(ramp->green); - free(ramp->blue); - - memset(ramp, 0, sizeof(GLFWgammaramp)); -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW public API ////// -////////////////////////////////////////////////////////////////////////// - -GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) -{ - int i; - unsigned short values[256]; - GLFWgammaramp ramp; - - _GLFW_REQUIRE_INIT(); - - if (gamma <= 0.f) - { - _glfwInputError(GLFW_INVALID_VALUE, - "Gamma value must be greater than zero"); - return; - } - - for (i = 0; i < 256; i++) - { - double value; - - // Calculate intensity - value = i / 255.0; - // Apply gamma curve - value = pow(value, 1.0 / gamma) * 65535.0 + 0.5; - - // Clamp to value range - if (value > 65535.0) - value = 65535.0; - - values[i] = (unsigned short) value; - } - - ramp.red = values; - ramp.green = values; - ramp.blue = values; - ramp.size = 256; - - glfwSetGammaRamp(handle, &ramp); -} - -GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) -{ - _GLFWmonitor* monitor = (_GLFWmonitor*) handle; - - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - - _glfwFreeGammaArrays(&monitor->currentRamp); - _glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp); - - return &monitor->currentRamp; -} - -GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) -{ - _GLFWmonitor* monitor = (_GLFWmonitor*) handle; - - _GLFW_REQUIRE_INIT(); - - if (!monitor->originalRamp.size) - _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp); - - _glfwPlatformSetGammaRamp(monitor, ramp); -} - diff --git a/extern/glfw/src/glfw3.pc b/extern/glfw/src/glfw3.pc new file mode 100644 index 0000000..86d9446 --- /dev/null +++ b/extern/glfw/src/glfw3.pc @@ -0,0 +1,13 @@ +prefix=/usr/local +exec_prefix=${prefix} +includedir=${prefix}/include +libdir=${exec_prefix}/lib + +Name: GLFW +Description: A multi-platform library for OpenGL, window and input +Version: 3.1.0 +URL: http://www.glfw.org/ +Requires.private: x11 xrandr xinerama xi xxf86vm xcursor gl +Libs: -L${libdir} -lglfw3 +Libs.private: -lrt -lm +Cflags: -I${includedir} diff --git a/extern/glfw/src/glfw3.pc.in b/extern/glfw/src/glfw3.pc.in index d56a494..f2e4d97 100644 --- a/extern/glfw/src/glfw3.pc.in +++ b/extern/glfw/src/glfw3.pc.in @@ -4,7 +4,7 @@ includedir=${prefix}/include libdir=${exec_prefix}/lib@LIB_SUFFIX@ Name: GLFW -Description: A portable library for OpenGL, window and input +Description: A multi-platform library for OpenGL, window and input Version: @GLFW_VERSION_FULL@ URL: http://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ diff --git a/extern/glfw/src/glfw3Config.cmake b/extern/glfw/src/glfw3Config.cmake new file mode 100644 index 0000000..41a1ccc --- /dev/null +++ b/extern/glfw/src/glfw3Config.cmake @@ -0,0 +1,29 @@ +# - Config file for the glfw3 package +# It defines the following variables +# GLFW3_INCLUDE_DIR, the path where GLFW headers are located +# GLFW3_LIBRARY_DIR, folder in which the GLFW library is located +# GLFW3_LIBRARY, library to link against to use GLFW + +set(GLFW3_VERSION "3.1.0") + + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was glfw3Config.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +#################################################################################### + +set_and_check(GLFW3_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include") +set_and_check(GLFW3_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/lib") + +find_library(GLFW3_LIBRARY "glfw3" HINTS ${GLFW3_LIBRARY_DIR}) + diff --git a/extern/glfw/src/glfw3Config.cmake.in b/extern/glfw/src/glfw3Config.cmake.in new file mode 100644 index 0000000..d34df06 --- /dev/null +++ b/extern/glfw/src/glfw3Config.cmake.in @@ -0,0 +1,15 @@ +# - Config file for the glfw3 package +# It defines the following variables +# GLFW3_INCLUDE_DIR, the path where GLFW headers are located +# GLFW3_LIBRARY_DIR, folder in which the GLFW library is located +# GLFW3_LIBRARY, library to link against to use GLFW + +set(GLFW3_VERSION "@GLFW_VERSION_FULL@") + +@PACKAGE_INIT@ + +set_and_check(GLFW3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/include") +set_and_check(GLFW3_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@") + +find_library(GLFW3_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW3_LIBRARY_DIR}) + diff --git a/extern/glfw/src/glfw3ConfigVersion.cmake b/extern/glfw/src/glfw3ConfigVersion.cmake new file mode 100644 index 0000000..0f38e1d --- /dev/null +++ b/extern/glfw/src/glfw3ConfigVersion.cmake @@ -0,0 +1,46 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major version is the same as the current one. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "3.1.0") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("3.1.0" MATCHES "^([0-9]+)\\.") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + else() + set(CVF_VERSION_MAJOR "3.1.0") + endif() + + if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}") + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/extern/glfw/src/glfwConfig.cmake.in b/extern/glfw/src/glfwConfig.cmake.in deleted file mode 100644 index 796ad2c..0000000 --- a/extern/glfw/src/glfwConfig.cmake.in +++ /dev/null @@ -1,10 +0,0 @@ -# - Config file for the glfw package -# It defines the following variables -# GLFW_INCLUDE_DIR, the path where GLFW headers are located -# GLFW_LIBRARY_DIR, folder in which the GLFW library is located -# GLFW_LIBRARY, library to link against to use GLFW - -set(GLFW_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include") -set(GLFW_LIBRARY_DIR "@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@") - -find_library(GLFW_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW_LIBRARY_DIR}) diff --git a/extern/glfw/src/glfwConfigVersion.cmake.in b/extern/glfw/src/glfwConfigVersion.cmake.in deleted file mode 100644 index da8eaf6..0000000 --- a/extern/glfw/src/glfwConfigVersion.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ - -set(PACKAGE_VERSION "@GLFW_VERSION_FULL@") - -if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@GLFW_VERSION_MAJOR@") - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @GLFW_VERSION_MINOR@) - set(PACKAGE_VERSION_EXACT TRUE) - endif() -else() - set(PACKAGE_VERSION_COMPATIBLE FALSE) -endif() - diff --git a/extern/glfw/src/config.h b/extern/glfw/src/glfw_config.h similarity index 78% rename from extern/glfw/src/config.h rename to extern/glfw/src/glfw_config.h index c2e84ec..0512dda 100644 --- a/extern/glfw/src/config.h +++ b/extern/glfw/src/glfw_config.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2010 Camilla Berglund // @@ -23,13 +23,15 @@ // distribution. // //======================================================================== -// As config.h.in, this file is used by CMake to produce the config.h shared -// configuration header file. If you are adding a feature requiring -// conditional compilation, this is the proper place to add the macros. +// As glfw_config.h.in, this file is used by CMake to produce the +// glfw_config.h configuration header file. If you are adding a feature +// requiring conditional compilation, this is where to add the macro. //======================================================================== -// As config.h, this file defines compile-time build options and macros for -// all platforms supported by GLFW. As this is a generated file, don't modify -// it. Instead, you should modify the config.h.in file. +// As glfw_config.h, this file defines compile-time option macros for a +// specific platform and development environment. If you are using the +// GLFW CMake files, modify glfw_config.h.in instead of this file. If you +// are using your own build system, make this file define the appropriate +// macros in whatever way is suitable. //======================================================================== // Define this to 1 if building GLFW for X11 @@ -38,6 +40,10 @@ /* #undef _GLFW_WIN32 */ // Define this to 1 if building GLFW for Cocoa /* #undef _GLFW_COCOA */ +// Define this to 1 if building GLFW for Wayland +/* #undef _GLFW_WAYLAND */ +// Define this to 1 if building GLFW for Mir +/* #undef _GLFW_MIR */ // Define this to 1 if building GLFW for EGL /* #undef _GLFW_EGL */ @@ -51,8 +57,6 @@ // Define this to 1 if building as a shared library / dynamic library / DLL /* #undef _GLFW_BUILD_DLL */ -// Define this to 1 to disable dynamic loading of winmm -/* #undef _GLFW_NO_DLOAD_WINMM */ // Define this to 1 if glfwSwapInterval should ignore DWM compositing status /* #undef _GLFW_USE_DWM_SWAP_INTERVAL */ // Define this to 1 to force use of high-performance GPU on Optimus systems @@ -71,6 +75,8 @@ /* #undef _GLFW_USE_CHDIR */ // Define this to 1 if glfwCreateWindow should populate the menu bar /* #undef _GLFW_USE_MENUBAR */ +// Define this to 1 if windows should use full resolution on Retina displays +/* #undef _GLFW_USE_RETINA */ // Define this to 1 if using OpenGL as the client library #define _GLFW_USE_OPENGL @@ -79,6 +85,3 @@ // Define this to 1 if using OpenGL ES 2.0 as the client library /* #undef _GLFW_USE_GLESV2 */ -// The GLFW version as used by glfwGetVersionString -#define _GLFW_VERSION_FULL "3.0.2" - diff --git a/extern/glfw/src/glfw_config.h.in b/extern/glfw/src/glfw_config.h.in index a731860..485cac5 100644 --- a/extern/glfw/src/glfw_config.h.in +++ b/extern/glfw/src/glfw_config.h.in @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2010 Camilla Berglund // @@ -40,6 +40,10 @@ #cmakedefine _GLFW_WIN32 // Define this to 1 if building GLFW for Cocoa #cmakedefine _GLFW_COCOA +// Define this to 1 if building GLFW for Wayland +#cmakedefine _GLFW_WAYLAND +// Define this to 1 if building GLFW for Mir +#cmakedefine _GLFW_MIR // Define this to 1 if building GLFW for EGL #cmakedefine _GLFW_EGL @@ -53,8 +57,6 @@ // Define this to 1 if building as a shared library / dynamic library / DLL #cmakedefine _GLFW_BUILD_DLL -// Define this to 1 to disable dynamic loading of winmm -#cmakedefine _GLFW_NO_DLOAD_WINMM // Define this to 1 if glfwSwapInterval should ignore DWM compositing status #cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL // Define this to 1 to force use of high-performance GPU on Optimus systems @@ -73,6 +75,8 @@ #cmakedefine _GLFW_USE_CHDIR // Define this to 1 if glfwCreateWindow should populate the menu bar #cmakedefine _GLFW_USE_MENUBAR +// 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 diff --git a/extern/glfw/src/glx_context.c b/extern/glfw/src/glx_context.c index 6b87000..562abf7 100644 --- a/extern/glfw/src/glx_context.c +++ b/extern/glfw/src/glx_context.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 GLX - www.glfw.org +// GLFW 3.1 GLX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -42,20 +42,11 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))(); // Returns the specified attribute of the specified GLXFBConfig -// NOTE: Do not call this unless we have found GLX 1.3+ or GLX_SGIX_fbconfig // static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib) { int value; - - if (_glfw.glx.SGIX_fbconfig) - { - _glfw.glx.GetFBConfigAttribSGIX(_glfw.x11.display, - fbconfig, attrib, &value); - } - else - glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value); - + glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value); return value; } @@ -78,24 +69,11 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul trustWindowBit = GL_FALSE; } - if (_glfw.glx.SGIX_fbconfig) - { - nativeConfigs = _glfw.glx.ChooseFBConfigSGIX(_glfw.x11.display, - _glfw.x11.screen, - NULL, - &nativeCount); - } - else - { - nativeConfigs = glXGetFBConfigs(_glfw.x11.display, - _glfw.x11.screen, - &nativeCount); - } - + nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, + &nativeCount); if (!nativeCount) { - _glfwInputError(GLFW_API_UNAVAILABLE, - "GLX: No GLXFBConfigs returned"); + _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned"); return GL_FALSE; } @@ -107,10 +85,9 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul const GLXFBConfig n = nativeConfigs[i]; _GLFWfbconfig* u = usableConfigs + usableCount; - if (!getFBConfigAttrib(n, GLX_DOUBLEBUFFER) || - !getFBConfigAttrib(n, GLX_VISUAL_ID)) + if (!getFBConfigAttrib(n, GLX_VISUAL_ID)) { - // Only consider double-buffered GLXFBConfigs with associated visuals + // Only consider GLXFBConfigs with associated visuals continue; } @@ -143,7 +120,11 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul u->accumAlphaBits = getFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE); u->auxBuffers = getFBConfigAttrib(n, GLX_AUX_BUFFERS); - u->stereo = getFBConfigAttrib(n, GLX_STEREO); + + if (getFBConfigAttrib(n, GLX_STEREO)) + u->stereo = GL_TRUE; + if (getFBConfigAttrib(n, GLX_DOUBLEBUFFER)) + u->doublebuffer = GL_TRUE; if (_glfw.glx.ARB_multisample) u->samples = getFBConfigAttrib(n, GLX_SAMPLES); @@ -171,15 +152,6 @@ static GLXContext createLegacyContext(_GLFWwindow* window, GLXFBConfig fbconfig, GLXContext share) { - if (_glfw.glx.SGIX_fbconfig) - { - return _glfw.glx.CreateContextWithConfigSGIX(_glfw.x11.display, - fbconfig, - GLX_RGBA_TYPE, - share, - True); - } - return glXCreateNewContext(_glfw.x11.display, fbconfig, GLX_RGBA_TYPE, @@ -196,24 +168,11 @@ static GLXContext createLegacyContext(_GLFWwindow* window, // int _glfwInitContextAPI(void) { + if (!_glfwInitTLS()) + return GL_FALSE; + #ifdef _GLFW_DLOPEN_LIBGL - int i; - char* libGL_names[ ] = - { - "libGL.so", - "libGL.so.1", - "/usr/lib/libGL.so", - "/usr/lib/libGL.so.1", - NULL - }; - - for (i = 0; libGL_names[i] != NULL; i++) - { - _glfw.glx.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL); - if (_glfw.glx.libGL) - break; - } - + _glfw.glx.libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (!_glfw.glx.libGL) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL"); @@ -221,19 +180,11 @@ int _glfwInitContextAPI(void) } #endif - if (pthread_key_create(&_glfw.glx.current, NULL) != 0) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "GLX: Failed to create context TLS"); - return GL_FALSE; - } - - // Check if GLX is supported on this display if (!glXQueryExtension(_glfw.x11.display, &_glfw.glx.errorBase, &_glfw.glx.eventBase)) { - _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found"); + _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found"); return GL_FALSE; } @@ -246,6 +197,13 @@ int _glfwInitContextAPI(void) return GL_FALSE; } + if (_glfw.glx.versionMajor == 1 && _glfw.glx.versionMinor < 3) + { + _glfwInputError(GLFW_API_UNAVAILABLE, + "GLX: GLX version 1.3 is required"); + return GL_FALSE; + } + if (_glfwPlatformExtensionSupported("GLX_EXT_swap_control")) { _glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) @@ -273,26 +231,6 @@ int _glfwInitContextAPI(void) _glfw.glx.MESA_swap_control = GL_TRUE; } - if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig")) - { - _glfw.glx.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC) - _glfwPlatformGetProcAddress("glXGetFBConfigAttribSGIX"); - _glfw.glx.ChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC) - _glfwPlatformGetProcAddress("glXChooseFBConfigSGIX"); - _glfw.glx.CreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) - _glfwPlatformGetProcAddress("glXCreateContextWithConfigSGIX"); - _glfw.glx.GetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) - _glfwPlatformGetProcAddress("glXGetVisualFromFBConfigSGIX"); - - if (_glfw.glx.GetFBConfigAttribSGIX && - _glfw.glx.ChooseFBConfigSGIX && - _glfw.glx.CreateContextWithConfigSGIX && - _glfw.glx.GetVisualFromFBConfigSGIX) - { - _glfw.glx.SGIX_fbconfig = GL_TRUE; - } - } - if (_glfwPlatformExtensionSupported("GLX_ARB_multisample")) _glfw.glx.ARB_multisample = GL_TRUE; @@ -317,6 +255,9 @@ int _glfwInitContextAPI(void) if (_glfwPlatformExtensionSupported("GLX_EXT_create_context_es2_profile")) _glfw.glx.EXT_create_context_es2_profile = GL_TRUE; + if (_glfwPlatformExtensionSupported("GLX_ARB_context_flush_control")) + _glfw.glx.ARB_context_flush_control = GL_TRUE; + return GL_TRUE; } @@ -333,7 +274,7 @@ void _glfwTerminateContextAPI(void) } #endif - pthread_key_delete(_glfw.glx.current); + _glfwTerminateTLS(); } #define setGLXattrib(attribName, attribValue) \ @@ -343,18 +284,18 @@ void _glfwTerminateContextAPI(void) assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \ } -// Prepare for creation of the OpenGL context +// Create the OpenGL or OpenGL ES context // int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int attribs[40]; GLXFBConfig native; GLXContext share = NULL; - if (wndconfig->share) - share = wndconfig->share->glx.context; + if (ctxconfig->share) + share = ctxconfig->share->glx.context; if (!chooseFBConfig(fbconfig, &native)) { @@ -364,22 +305,15 @@ int _glfwCreateContext(_GLFWwindow* window, } // Retrieve the corresponding visual - if (_glfw.glx.SGIX_fbconfig) - { - window->glx.visual = - _glfw.glx.GetVisualFromFBConfigSGIX(_glfw.x11.display, native); - } - else - window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native); - - if (window->glx.visual == NULL) + window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native); + if (!window->glx.visual) { _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to retrieve visual for GLXFBConfig"); return GL_FALSE; } - if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + if (ctxconfig->api == GLFW_OPENGL_ES_API) { if (!_glfw.glx.ARB_create_context || !_glfw.glx.ARB_create_context_profile || @@ -392,7 +326,7 @@ int _glfwCreateContext(_GLFWwindow* window, } } - if (wndconfig->glForward) + if (ctxconfig->forward) { if (!_glfw.glx.ARB_create_context) { @@ -403,7 +337,7 @@ int _glfwCreateContext(_GLFWwindow* window, } } - if (wndconfig->glProfile) + if (ctxconfig->profile) { if (!_glfw.glx.ARB_create_context || !_glfw.glx.ARB_create_context_profile) @@ -421,46 +355,63 @@ int _glfwCreateContext(_GLFWwindow* window, { int index = 0, mask = 0, flags = 0, strategy = 0; - if (wndconfig->clientAPI == GLFW_OPENGL_API) + if (ctxconfig->api == GLFW_OPENGL_API) { - if (wndconfig->glForward) + if (ctxconfig->forward) flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - if (wndconfig->glDebug) + if (ctxconfig->debug) flags |= GLX_CONTEXT_DEBUG_BIT_ARB; - if (wndconfig->glProfile) + if (ctxconfig->profile) { - if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE) + if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE) + else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } } else mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT; - if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS) + if (ctxconfig->robustness) { if (_glfw.glx.ARB_create_context_robustness) { - if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) + if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) strategy = GLX_NO_RESET_NOTIFICATION_ARB; - else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) + else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB; flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB; } } - if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0) + if (ctxconfig->release) + { + if (_glfw.glx.ARB_context_flush_control) + { + if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE) + { + setGLXattrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB, + GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); + } + else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH) + { + setGLXattrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB, + GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB); + } + } + } + + if (ctxconfig->major != 1 || ctxconfig->minor != 0) { // NOTE: Only request an explicitly versioned context when // necessary, as explicitly requesting version 1.0 does not // always return the highest available version - setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor); - setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor); + setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major); + setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor); } if (mask) @@ -481,16 +432,16 @@ int _glfwCreateContext(_GLFWwindow* window, True, attribs); - if (window->glx.context == NULL) + if (!window->glx.context) { // HACK: This is a fallback for the broken Mesa implementation of // GLX_ARB_create_context_profile, which fails default 1.0 // context creation with a GLXBadProfileARB error in violation // of the extension spec if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB && - wndconfig->clientAPI == GLFW_OPENGL_API && - wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE && - wndconfig->glForward == GL_FALSE) + ctxconfig->api == GLFW_OPENGL_API && + ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE && + ctxconfig->forward == GL_FALSE) { window->glx.context = createLegacyContext(window, native, share); } @@ -501,7 +452,7 @@ int _glfwCreateContext(_GLFWwindow* window, _glfwReleaseXErrorHandler(); - if (window->glx.context == NULL) + if (!window->glx.context) { _glfwInputXError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context"); return GL_FALSE; @@ -545,12 +496,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) else glXMakeCurrent(_glfw.x11.display, None, NULL); - pthread_setspecific(_glfw.glx.current, window); -} - -_GLFWwindow* _glfwPlatformGetCurrentContext(void) -{ - return (_GLFWwindow*) pthread_getspecific(_glfw.glx.current); + _glfwSetCurrentContext(window); } void _glfwPlatformSwapBuffers(_GLFWwindow* window) diff --git a/extern/glfw/src/glx_platform.h b/extern/glfw/src/glx_context.h similarity index 68% rename from extern/glfw/src/glx_platform.h rename to extern/glfw/src/glx_context.h index 4b133a2..918ab00 100644 --- a/extern/glfw/src/glx_platform.h +++ b/extern/glfw/src/glx_context.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 GLX - www.glfw.org +// GLFW 3.1 GLX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -25,8 +25,8 @@ // //======================================================================== -#ifndef _glx_platform_h_ -#define _glx_platform_h_ +#ifndef _glx_context_h_ +#define _glx_context_h_ #define GLX_GLXEXT_LEGACY #include @@ -41,8 +41,6 @@ #include #endif -#include - // We support four different ways for getting addresses for GL/GLX // extension functions: glXGetProcAddress, glXGetProcAddressARB, // glXGetProcAddressEXT, and dlsym @@ -59,53 +57,40 @@ #error "No OpenGL entry point retrieval mechanism was enabled" #endif -#define _GLFW_PLATFORM_FBCONFIG GLXFBConfig glx -#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX glx -#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryGLX glx +#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 -//======================================================================== -// GLFW platform specific types -//======================================================================== - -//------------------------------------------------------------------------ -// Platform-specific OpenGL context structure -//------------------------------------------------------------------------ +// GLX-specific per-context data +// typedef struct _GLFWcontextGLX { - GLXContext context; // OpenGL rendering context - XVisualInfo* visual; // Visual for selected GLXFBConfig + // Rendering context + GLXContext context; + // Visual of selected GLXFBConfig + XVisualInfo* visual; } _GLFWcontextGLX; -//------------------------------------------------------------------------ -// Platform-specific library global data for GLX -//------------------------------------------------------------------------ +// GLX-specific global data +// typedef struct _GLFWlibraryGLX { - // Server-side GLX version int versionMajor, versionMinor; int eventBase; int errorBase; - // TLS key for per-thread current context/window - pthread_key_t current; - // GLX extensions PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; - PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX; - PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX; - PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX; - PFNGLXGETVISUALFROMFBCONFIGSGIXPROC GetVisualFromFBConfigSGIX; PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; - GLboolean SGIX_fbconfig; GLboolean SGI_swap_control; GLboolean EXT_swap_control; GLboolean MESA_swap_control; @@ -115,11 +100,21 @@ typedef struct _GLFWlibraryGLX GLboolean ARB_create_context_profile; GLboolean ARB_create_context_robustness; GLboolean EXT_create_context_es2_profile; + GLboolean ARB_context_flush_control; #if defined(_GLFW_DLOPEN_LIBGL) - void* libGL; // dlopen handle for libGL.so + // dlopen handle for libGL.so (for glfwGetProcAddress) + void* libGL; #endif + } _GLFWlibraryGLX; -#endif // _glx_platform_h_ +int _glfwInitContextAPI(void); +void _glfwTerminateContextAPI(void); +int _glfwCreateContext(_GLFWwindow* window, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig); +void _glfwDestroyContext(_GLFWwindow* window); + +#endif // _glx_context_h_ diff --git a/extern/glfw/src/init.c b/extern/glfw/src/init.c index d34abea..4a044ed 100644 --- a/extern/glfw/src/init.c +++ b/extern/glfw/src/init.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -33,14 +33,15 @@ #include +// The three global variables below comprise all global data in GLFW, except for +// various static const translation tables. Any other global variable is a bug. + // Global state shared between compilation units of GLFW // These are documented in internal.h // GLboolean _glfwInitialized = GL_FALSE; _GLFWlibrary _glfw; - -// The current error callback // This is outside of _glfw so it can be initialized and usable before // glfwInit is called, which lets that function report errors // @@ -128,7 +129,7 @@ GLFWAPI int glfwInit(void) } _glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount); - if (_glfw.monitors == NULL) + if (!_glfw.monitorCount) { _glfwInputError(GLFW_PLATFORM_ERROR, "No monitors found"); _glfwPlatformTerminate(); @@ -152,10 +153,12 @@ GLFWAPI void glfwTerminate(void) memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks)); - // Close all remaining windows while (_glfw.windowListHead) glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead); + while (_glfw.cursorListHead) + glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead); + for (i = 0; i < _glfw.monitorCount; i++) { _GLFWmonitor* monitor = _glfw.monitors[i]; @@ -163,12 +166,13 @@ GLFWAPI void glfwTerminate(void) _glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp); } - _glfwDestroyMonitors(_glfw.monitors, _glfw.monitorCount); + _glfwFreeMonitors(_glfw.monitors, _glfw.monitorCount); _glfw.monitors = NULL; _glfw.monitorCount = 0; _glfwPlatformTerminate(); + memset(&_glfw, 0, sizeof(_glfw)); _glfwInitialized = GL_FALSE; } diff --git a/extern/glfw/src/input.c b/extern/glfw/src/input.c index 866a489..74a715c 100644 --- a/extern/glfw/src/input.c +++ b/extern/glfw/src/input.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -27,6 +27,11 @@ #include "internal.h" +#include +#if defined(_MSC_VER) + #include +#endif + // Internal key state used for sticky keys #define _GLFW_STICK 3 @@ -50,27 +55,30 @@ static void setCursorMode(_GLFWwindow* window, int newMode) window->cursorMode = newMode; - if (window == _glfw.focusedWindow) + if (_glfw.focusedWindow == window) { if (oldMode == GLFW_CURSOR_DISABLED) { - window->cursorPosX = _glfw.cursorPosX; - window->cursorPosY = _glfw.cursorPosY; - - _glfwPlatformSetCursorPos(window, _glfw.cursorPosX, _glfw.cursorPosY); + _glfwPlatformSetCursorPos(window, + _glfw.cursorPosX, + _glfw.cursorPosY); } else if (newMode == GLFW_CURSOR_DISABLED) { int width, height; - _glfw.cursorPosX = window->cursorPosX; - _glfw.cursorPosY = window->cursorPosY; + _glfwPlatformGetCursorPos(window, + &_glfw.cursorPosX, + &_glfw.cursorPosY); + + window->cursorPosX = _glfw.cursorPosX; + window->cursorPosY = _glfw.cursorPosY; _glfwPlatformGetWindowSize(window, &width, &height); - _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0); + _glfwPlatformSetCursorPos(window, width / 2, height / 2); } - _glfwPlatformSetCursorMode(window, newMode); + _glfwPlatformApplyCursorMode(window); } } @@ -88,8 +96,8 @@ static void setStickyKeys(_GLFWwindow* window, int enabled) // Release all sticky keys for (i = 0; i <= GLFW_KEY_LAST; i++) { - if (window->key[i] == _GLFW_STICK) - window->key[i] = GLFW_RELEASE; + if (window->keys[i] == _GLFW_STICK) + window->keys[i] = GLFW_RELEASE; } } @@ -110,8 +118,8 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled) // Release all sticky mouse buttons for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) { - if (window->mouseButton[i] == _GLFW_STICK) - window->mouseButton[i] = GLFW_RELEASE; + if (window->mouseButtons[i] == _GLFW_STICK) + window->mouseButtons[i] = GLFW_RELEASE; } } @@ -125,36 +133,42 @@ static void setStickyMouseButtons(_GLFWwindow* window, int enabled) void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods) { - GLboolean repeated = GL_FALSE; - - if (action == GLFW_RELEASE && window->key[key] == GLFW_RELEASE) - return; - if (key >= 0 && key <= GLFW_KEY_LAST) { - if (action == GLFW_PRESS && window->key[key] == GLFW_PRESS) + GLboolean repeated = GL_FALSE; + + if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE) + return; + + if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS) repeated = GL_TRUE; if (action == GLFW_RELEASE && window->stickyKeys) - window->key[key] = _GLFW_STICK; + window->keys[key] = _GLFW_STICK; else - window->key[key] = (char) action; - } + window->keys[key] = (char) action; - if (repeated) - action = GLFW_REPEAT; + if (repeated) + action = GLFW_REPEAT; + } if (window->callbacks.key) window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods); } -void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint) +void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain) { if (codepoint < 32 || (codepoint > 126 && codepoint < 160)) return; - if (window->callbacks.character) - window->callbacks.character((GLFWwindow*) window, codepoint); + if (window->callbacks.charmods) + window->callbacks.charmods((GLFWwindow*) window, codepoint, mods); + + if (plain) + { + if (window->callbacks.character) + window->callbacks.character((GLFWwindow*) window, codepoint); + } } void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) @@ -170,9 +184,9 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods) // Register mouse button action if (action == GLFW_RELEASE && window->stickyMouseButtons) - window->mouseButton[button] = _GLFW_STICK; + window->mouseButtons[button] = _GLFW_STICK; else - window->mouseButton[button] = (char) action; + window->mouseButtons[button] = (char) action; if (window->callbacks.mouseButton) window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods); @@ -187,22 +201,13 @@ void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y) window->cursorPosX += x; window->cursorPosY += y; - } - else - { - if (window->cursorPosX == x && window->cursorPosY == y) - return; - window->cursorPosX = x; - window->cursorPosY = y; + x = window->cursorPosX; + y = window->cursorPosY; } if (window->callbacks.cursorPos) - { - window->callbacks.cursorPos((GLFWwindow*) window, - window->cursorPosX, - window->cursorPosY); - } + window->callbacks.cursorPos((GLFWwindow*) window, x, y); } void _glfwInputCursorEnter(_GLFWwindow* window, int entered) @@ -211,6 +216,12 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered) window->callbacks.cursorEnter((GLFWwindow*) window, entered); } +void _glfwInputDrop(_GLFWwindow* window, int count, const char** names) +{ + if (window->callbacks.drop) + window->callbacks.drop((GLFWwindow*) window, count, names); +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// @@ -271,14 +282,14 @@ GLFWAPI int glfwGetKey(GLFWwindow* handle, int key) return GLFW_RELEASE; } - if (window->key[key] == _GLFW_STICK) + if (window->keys[key] == _GLFW_STICK) { // Sticky mode: release key now - window->key[key] = GLFW_RELEASE; + window->keys[key] = GLFW_RELEASE; return GLFW_PRESS; } - return (int) window->key[key]; + return (int) window->keys[key]; } GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button) @@ -294,27 +305,36 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button) return GLFW_RELEASE; } - if (window->mouseButton[button] == _GLFW_STICK) + if (window->mouseButtons[button] == _GLFW_STICK) { // Sticky mode: release mouse button now - window->mouseButton[button] = GLFW_RELEASE; + window->mouseButtons[button] = GLFW_RELEASE; return GLFW_PRESS; } - return (int) window->mouseButton[button]; + return (int) window->mouseButtons[button]; } GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos) { _GLFWwindow* window = (_GLFWwindow*) handle; + if (xpos) + *xpos = 0; + if (ypos) + *ypos = 0; + _GLFW_REQUIRE_INIT(); - if (xpos) - *xpos = window->cursorPosX; - - if (ypos) - *ypos = window->cursorPosY; + if (window->cursorMode == GLFW_CURSOR_DISABLED) + { + if (xpos) + *xpos = window->cursorPosX; + if (ypos) + *ypos = window->cursorPosY; + } + else + _glfwPlatformGetCursorPos(window, xpos, ypos); } GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos) @@ -326,20 +346,102 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos) if (_glfw.focusedWindow != window) return; - // Don't do anything if the cursor position did not change - if (xpos == window->cursorPosX && ypos == window->cursorPosY) - return; - - // Set GLFW cursor position - window->cursorPosX = xpos; - window->cursorPosY = ypos; - - // Do not move physical cursor if it is disabled if (window->cursorMode == GLFW_CURSOR_DISABLED) + { + // Only update the accumulated position if the cursor is disabled + window->cursorPosX = xpos; + window->cursorPosY = ypos; + } + else + { + // Update system cursor position + _glfwPlatformSetCursorPos(window, xpos, ypos); + } +} + +GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot) +{ + _GLFWcursor* cursor; + + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + cursor = calloc(1, sizeof(_GLFWcursor)); + cursor->next = _glfw.cursorListHead; + _glfw.cursorListHead = cursor; + + if (!_glfwPlatformCreateCursor(cursor, image, xhot, yhot)) + { + glfwDestroyCursor((GLFWcursor*) cursor); + return NULL; + } + + return (GLFWcursor*) cursor; +} + +GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape) +{ + _GLFWcursor* cursor; + + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + cursor = calloc(1, sizeof(_GLFWcursor)); + cursor->next = _glfw.cursorListHead; + _glfw.cursorListHead = cursor; + + if (!_glfwPlatformCreateStandardCursor(cursor, shape)) + { + glfwDestroyCursor((GLFWcursor*) cursor); + return NULL; + } + + return (GLFWcursor*) cursor; +} + +GLFWAPI void glfwDestroyCursor(GLFWcursor* handle) +{ + _GLFWcursor* cursor = (_GLFWcursor*) handle; + + _GLFW_REQUIRE_INIT(); + + if (cursor == NULL) return; - // Update physical cursor position - _glfwPlatformSetCursorPos(window, xpos, ypos); + // Make sure the cursor is not being used by any window + { + _GLFWwindow* window; + + for (window = _glfw.windowListHead; window; window = window->next) + { + if (window->cursor == cursor) + glfwSetCursor((GLFWwindow*) window, NULL); + } + } + + _glfwPlatformDestroyCursor(cursor); + + // Unlink cursor from global linked list + { + _GLFWcursor** prev = &_glfw.cursorListHead; + + while (*prev != cursor) + prev = &((*prev)->next); + + *prev = cursor->next; + } + + free(cursor); +} + +GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle) +{ + _GLFWwindow* window = (_GLFWwindow*) windowHandle; + _GLFWcursor* cursor = (_GLFWcursor*) cursorHandle; + + _GLFW_REQUIRE_INIT(); + + _glfwPlatformSetCursor(window, cursor); + + window->cursor = cursor; } GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun) @@ -358,6 +460,14 @@ GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun) return cbfun; } +GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* handle, GLFWcharmodsfun cbfun) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + _GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun); + return cbfun; +} + GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle, GLFWmousebuttonfun cbfun) { @@ -394,3 +504,93 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle, return cbfun; } +GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + _GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun); + return cbfun; +} + +GLFWAPI int glfwJoystickPresent(int joy) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(0); + + if (joy < 0 || joy > GLFW_JOYSTICK_LAST) + { + _glfwInputError(GLFW_INVALID_ENUM, NULL); + return 0; + } + + return _glfwPlatformJoystickPresent(joy); +} + +GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count) +{ + *count = 0; + + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + if (joy < 0 || joy > GLFW_JOYSTICK_LAST) + { + _glfwInputError(GLFW_INVALID_ENUM, NULL); + return NULL; + } + + return _glfwPlatformGetJoystickAxes(joy, count); +} + +GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count) +{ + *count = 0; + + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + if (joy < 0 || joy > GLFW_JOYSTICK_LAST) + { + _glfwInputError(GLFW_INVALID_ENUM, NULL); + return NULL; + } + + return _glfwPlatformGetJoystickButtons(joy, count); +} + +GLFWAPI const char* glfwGetJoystickName(int joy) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + if (joy < 0 || joy > GLFW_JOYSTICK_LAST) + { + _glfwInputError(GLFW_INVALID_ENUM, NULL); + return NULL; + } + + return _glfwPlatformGetJoystickName(joy); +} + +GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + _GLFW_REQUIRE_INIT(); + _glfwPlatformSetClipboardString(window, string); +} + +GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + return _glfwPlatformGetClipboardString(window); +} + +GLFWAPI double glfwGetTime(void) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(0.0); + return _glfwPlatformGetTime(); +} + +GLFWAPI void glfwSetTime(double time) +{ + _GLFW_REQUIRE_INIT(); + _glfwPlatformSetTime(time); +} + diff --git a/extern/glfw/src/internal.h b/extern/glfw/src/internal.h index 8a24959..1e6977f 100644 --- a/extern/glfw/src/internal.h +++ b/extern/glfw/src/internal.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -33,7 +33,7 @@ #include "glfw_config.h" #endif -#define _GLFW_VERSION_NUMBER "3.0.4" +#define _GLFW_VERSION_NUMBER "3.1.0" #if defined(_GLFW_USE_OPENGL) // This is the default for glfw3.h @@ -58,12 +58,13 @@ #include "../deps/GL/glext.h" #endif -typedef struct _GLFWhints _GLFWhints; typedef struct _GLFWwndconfig _GLFWwndconfig; +typedef struct _GLFWctxconfig _GLFWctxconfig; typedef struct _GLFWfbconfig _GLFWfbconfig; typedef struct _GLFWwindow _GLFWwindow; typedef struct _GLFWlibrary _GLFWlibrary; typedef struct _GLFWmonitor _GLFWmonitor; +typedef struct _GLFWcursor _GLFWcursor; #if defined(_GLFW_COCOA) #include "cocoa_platform.h" @@ -71,6 +72,10 @@ typedef struct _GLFWmonitor _GLFWmonitor; #include "win32_platform.h" #elif defined(_GLFW_X11) #include "x11_platform.h" +#elif defined(_GLFW_WAYLAND) + #include "wl_platform.h" +#elif defined(_GLFW_MIR) + #include "mir_platform.h" #else #error "No supported window creation API selected" #endif @@ -107,7 +112,7 @@ typedef struct _GLFWmonitor _GLFWmonitor; // Helper macros //======================================================================== -// Checks for whether the library has been intitalized +// Checks for whether the library has been initialized #define _GLFW_REQUIRE_INIT() \ if (!_glfwInitialized) \ { \ @@ -132,14 +137,14 @@ typedef struct _GLFWmonitor _GLFWmonitor; //======================================================================== -// Internal types +// Platform-independent structures //======================================================================== -/*! @brief Window and context configuration. +/*! @brief Window configuration. * - * Parameters relating to the creation of the context and window but not - * directly related to the framebuffer. This is used to pass window and - * context creation parameters from shared code to the platform API. + * Parameters relating to the creation of the window but not directly related + * to the framebuffer. This is used to pass window creation parameters from + * shared code to the platform API. */ struct _GLFWwndconfig { @@ -149,14 +154,29 @@ struct _GLFWwndconfig GLboolean resizable; GLboolean visible; GLboolean decorated; - int clientAPI; - int glMajor; - int glMinor; - GLboolean glForward; - GLboolean glDebug; - int glProfile; - int glRobustness; + GLboolean focused; + GLboolean autoIconify; + GLboolean floating; _GLFWmonitor* monitor; +}; + + +/*! @brief Context configuration. + * + * Parameters relating to the creation of the context but not directly related + * to the framebuffer. This is used to pass context creation parameters from + * shared code to the platform API. + */ +struct _GLFWctxconfig +{ + int api; + int major; + int minor; + GLboolean forward; + GLboolean debug; + int profile; + int robustness; + int release; _GLFWwindow* share; }; @@ -164,7 +184,7 @@ struct _GLFWwndconfig /*! @brief Framebuffer configuration. * * This describes buffers and their sizes. It also contains - * a platform-specific ID used to map back to the backend API's object. + * a platform-specific ID used to map back to the backend API object. * * It is used to pass framebuffer parameters from shared code to the platform * API and also to enumerate and select available framebuffer configs. @@ -182,11 +202,12 @@ struct _GLFWfbconfig int accumBlueBits; int accumAlphaBits; int auxBuffers; - GLboolean stereo; + int stereo; int samples; - GLboolean sRGB; + int sRGB; + int doublebuffer; - // This is defined in the context API's platform.h + // This is defined in the context API's context.h _GLFW_PLATFORM_FBCONFIG; }; @@ -198,29 +219,34 @@ struct _GLFWwindow struct _GLFWwindow* next; // Window settings and state - GLboolean iconified; GLboolean resizable; GLboolean decorated; - GLboolean visible; + GLboolean autoIconify; + GLboolean floating; GLboolean closed; void* userPointer; GLFWvidmode videoMode; _GLFWmonitor* monitor; + _GLFWcursor* cursor; // Window input state GLboolean stickyKeys; GLboolean stickyMouseButtons; double cursorPosX, cursorPosY; int cursorMode; - char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; - char key[GLFW_KEY_LAST + 1]; + char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1]; + char keys[GLFW_KEY_LAST + 1]; // OpenGL extensions and context attributes - int clientAPI; - int glMajor, glMinor, glRevision; - GLboolean glForward, glDebug; - int glProfile; - int glRobustness; + 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 @@ -239,11 +265,13 @@ struct _GLFWwindow GLFWscrollfun scroll; GLFWkeyfun key; GLFWcharfun character; + GLFWcharmodsfun charmods; + GLFWdropfun drop; } callbacks; // This is defined in the window API's platform.h _GLFW_PLATFORM_WINDOW_STATE; - // This is defined in the context API's platform.h + // This is defined in the context API's context.h _GLFW_PLATFORM_CONTEXT_STATE; }; @@ -269,6 +297,16 @@ struct _GLFWmonitor }; +/*! @brief Cursor structure + */ +struct _GLFWcursor +{ + _GLFWcursor* next; + + // This is defined in the window API's platform.h + _GLFW_PLATFORM_CURSOR_STATE; +}; + /*! @brief Library global data. */ struct _GLFWlibrary @@ -285,24 +323,31 @@ struct _GLFWlibrary int accumBlueBits; int accumAlphaBits; int auxBuffers; - GLboolean stereo; - GLboolean resizable; - GLboolean visible; - GLboolean decorated; + int stereo; + int resizable; + int visible; + int decorated; + int focused; + int autoIconify; + int floating; int samples; - GLboolean sRGB; + int sRGB; int refreshRate; - int clientAPI; - int glMajor; - int glMinor; - GLboolean glForward; - GLboolean glDebug; - int glProfile; - int glRobustness; + int doublebuffer; + int api; + int major; + int minor; + int forward; + int debug; + int profile; + int robustness; + int release; } hints; double cursorPosX, cursorPosY; + _GLFWcursor* cursorListHead; + _GLFWwindow* windowListHead; _GLFWwindow* focusedWindow; @@ -315,8 +360,14 @@ struct _GLFWlibrary // This is defined in the window API's platform.h _GLFW_PLATFORM_LIBRARY_WINDOW_STATE; - // This is defined in the context API's platform.h - _GLFW_PLATFORM_LIBRARY_OPENGL_STATE; + // This is defined in the context API's context.h + _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE; + // This is defined in the platform's time.h + _GLFW_PLATFORM_LIBRARY_TIME_STATE; + // This is defined in the platform's joystick.h + _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE; + // This is defined in the platform's tls.h + _GLFW_PLATFORM_LIBRARY_TLS_STATE; }; @@ -359,17 +410,21 @@ void _glfwPlatformTerminate(void); */ const char* _glfwPlatformGetVersionString(void); +/*! @copydoc glfwGetCursorPos + * @ingroup platform + */ +void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos); + /*! @copydoc glfwSetCursorPos * @ingroup platform */ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos); -/*! @brief Sets up the specified cursor mode for the specified window. - * @param[in] window The window whose cursor mode to change. - * @param[in] mode The desired cursor mode. +/*! @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); +void _glfwPlatformApplyCursorMode(_GLFWwindow* window); /*! @copydoc glfwGetMonitors * @ingroup platform @@ -457,6 +512,7 @@ void _glfwPlatformSetTime(double time); */ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); /*! @ingroup platform @@ -493,6 +549,11 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); */ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height); +/*! @copydoc glfwGetWindowFrameSize + * @ingroup platform + */ +void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom); + /*! @copydoc glfwIconifyWindow * @ingroup platform */ @@ -508,11 +569,30 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window); */ void _glfwPlatformShowWindow(_GLFWwindow* window); +/*! @ingroup platform + */ +void _glfwPlatformUnhideWindow(_GLFWwindow* window); + /*! @copydoc glfwHideWindow * @ingroup platform */ void _glfwPlatformHideWindow(_GLFWwindow* window); +/*! @brief Returns whether the window is focused. + * @ingroup platform + */ +int _glfwPlatformWindowFocused(_GLFWwindow* window); + +/*! @brief Returns whether the window is iconified. + * @ingroup platform + */ +int _glfwPlatformWindowIconified(_GLFWwindow* window); + +/*! @brief Returns whether the window is visible. + * @ingroup platform + */ +int _glfwPlatformWindowVisible(_GLFWwindow* window); + /*! @copydoc glfwPollEvents * @ingroup platform */ @@ -523,6 +603,11 @@ void _glfwPlatformPollEvents(void); */ void _glfwPlatformWaitEvents(void); +/*! @copydoc glfwPostEmptyEvent + * @ingroup platform + */ +void _glfwPlatformPostEmptyEvent(void); + /*! @copydoc glfwMakeContextCurrent * @ingroup platform */ @@ -543,7 +628,8 @@ void _glfwPlatformSwapBuffers(_GLFWwindow* window); */ void _glfwPlatformSwapInterval(int interval); -/*! @ingroup platform +/*! @copydoc glfwExtensionSupported + * @ingroup platform */ int _glfwPlatformExtensionSupported(const char* extension); @@ -552,6 +638,26 @@ int _glfwPlatformExtensionSupported(const char* extension); */ GLFWglproc _glfwPlatformGetProcAddress(const char* procname); +/*! @copydoc glfwCreateCursor + * @ingroup platform + */ +int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); + +/*! @copydoc glfwCreateStandardCursor + * @ingroup platform + */ +int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape); + +/*! @copydoc glfwDestroyCursor + * @ingroup platform + */ +void _glfwPlatformDestroyCursor(_GLFWcursor* cursor); + +/*! @copydoc glfwSetCursor + * @ingroup platform + */ +void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor); + //======================================================================== // Event API functions @@ -597,14 +703,6 @@ void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height); */ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified); -/*! @brief Notifies shared code of a window show/hide event. - * @param[in] window The window that received the event. - * @param[in] visible `GL_TRUE` if the window was shown, or `GL_FALSE` if it - * was hidden. - * @ingroup event - */ -void _glfwInputWindowVisibility(_GLFWwindow* window, int visible); - /*! @brief Notifies shared code of a window damage event. * @param[in] window The window that received the event. */ @@ -629,9 +727,12 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m /*! @brief Notifies shared code of a Unicode character input event. * @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 `GL_TRUE` if the character is regular text input, or + * `GL_FALSE` otherwise. * @ingroup event */ -void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint); +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. @@ -679,6 +780,14 @@ void _glfwInputMonitorChange(void); */ void _glfwInputError(int error, const char* format, ...); +/*! @brief Notifies dropped object over window. + * @param[in] window The window that received the event. + * @param[in] count The number of dropped objects. + * @param[in] names The names of the dropped objects. + * @ingroup event + */ +void _glfwInputDrop(_GLFWwindow* window, int count, const char** names); + //======================================================================== // Utility functions @@ -720,13 +829,14 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, unsigned int count); /*! @brief Retrieves the attributes of the current context. + * @param[in] ctxconfig The desired context attributes. * @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable. * @ingroup utility */ -GLboolean _glfwRefreshContextAttribs(void); +GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig); /*! @brief Checks whether the desired context attributes are valid. - * @param[in] wndconfig The context attributes to check. + * @param[in] ctxconfig The context attributes to check. * @return `GL_TRUE` if the context attributes are valid, or `GL_FALSE` * otherwise. * @ingroup utility @@ -735,16 +845,16 @@ GLboolean _glfwRefreshContextAttribs(void); * exists and whether all relevant options have supported and non-conflicting * values. */ -GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig); +GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); /*! @brief Checks whether the current context fulfils the specified hard * constraints. - * @param[in] wndconfig The desired context attributes. + * @param[in] ctxconfig The desired context attributes. * @return `GL_TRUE` if the context fulfils the hard constraints, or `GL_FALSE` * otherwise. * @ingroup utility */ -GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig); +GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig); /*! @ingroup utility */ @@ -762,15 +872,15 @@ void _glfwFreeGammaArrays(GLFWgammaramp* ramp); * @return The newly created object. * @ingroup utility */ -_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM); +_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM); /*! @brief Frees a monitor object and any data associated with it. * @ingroup utility */ -void _glfwDestroyMonitor(_GLFWmonitor* monitor); +void _glfwFreeMonitor(_GLFWmonitor* monitor); /*! @ingroup utility */ -void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count); +void _glfwFreeMonitors(_GLFWmonitor** monitors, int count); #endif // _internal_h_ diff --git a/extern/glfw/src/iokit_joystick.h b/extern/glfw/src/iokit_joystick.h new file mode 100644 index 0000000..c08809f --- /dev/null +++ b/extern/glfw/src/iokit_joystick.h @@ -0,0 +1,61 @@ +//======================================================================== +// GLFW 3.1 IOKit - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2006-2014 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _iokit_joystick_h_ +#define _iokit_joystick_h_ + +#include +#include +#include +#include + +#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ + _GLFWjoystickIOKit iokit_js[GLFW_JOYSTICK_LAST + 1] + + +// IOKit-specific per-joystick data +// +typedef struct _GLFWjoystickIOKit +{ + int present; + char name[256]; + + IOHIDDeviceInterface** interface; + + CFMutableArrayRef axisElements; + CFMutableArrayRef buttonElements; + CFMutableArrayRef hatElements; + + float* axes; + unsigned char* buttons; + +} _GLFWjoystickIOKit; + + +void _glfwInitJoysticks(void); +void _glfwTerminateJoysticks(void); + +#endif // _iokit_joystick_h_ diff --git a/extern/glfw/src/cocoa_joystick.m b/extern/glfw/src/iokit_joystick.m similarity index 87% rename from extern/glfw/src/cocoa_joystick.m rename to extern/glfw/src/iokit_joystick.m index 7af1042..5ff67dd 100644 --- a/extern/glfw/src/cocoa_joystick.m +++ b/extern/glfw/src/iokit_joystick.m @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 IOKit - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // Copyright (c) 2012 Torsten Walluhn @@ -58,7 +58,7 @@ static void getElementsCFArrayHandler(const void* value, void* parameter); // Adds an element to the specified joystick // -static void addJoystickElement(_GLFWjoy* joystick, CFTypeRef elementRef) +static void addJoystickElement(_GLFWjoystickIOKit* joystick, CFTypeRef elementRef) { long elementType, usagePage, usage; CFMutableArrayRef elementsArray = NULL; @@ -146,12 +146,12 @@ static void addJoystickElement(_GLFWjoy* joystick, CFTypeRef elementRef) static void getElementsCFArrayHandler(const void* value, void* parameter) { if (CFGetTypeID(value) == CFDictionaryGetTypeID()) - addJoystickElement((_GLFWjoy*) parameter, (CFTypeRef) value); + addJoystickElement((_GLFWjoystickIOKit*) parameter, (CFTypeRef) value); } // Returns the value of the specified element of the specified joystick // -static long getElementValue(_GLFWjoy* joystick, _GLFWjoyelement* element) +static long getElementValue(_GLFWjoystickIOKit* joystick, _GLFWjoyelement* element) { IOReturn result = kIOReturnSuccess; IOHIDEventStruct hidEvent; @@ -178,7 +178,7 @@ static long getElementValue(_GLFWjoy* joystick, _GLFWjoyelement* element) // Removes the specified joystick // -static void removeJoystick(_GLFWjoy* joystick) +static void removeJoystick(_GLFWjoystickIOKit* joystick) { int i; @@ -203,14 +203,14 @@ static void removeJoystick(_GLFWjoy* joystick) (*(joystick->interface))->close(joystick->interface); (*(joystick->interface))->Release(joystick->interface); - memset(joystick, 0, sizeof(_GLFWjoy)); + memset(joystick, 0, sizeof(_GLFWjoystickIOKit)); } // Callback for user-initiated joystick removal // static void removalCallback(void* target, IOReturn result, void* refcon, void* sender) { - removeJoystick((_GLFWjoy*) refcon); + removeJoystick((_GLFWjoystickIOKit*) refcon); } // Polls for joystick events and updates GLFW state @@ -223,7 +223,7 @@ static void pollJoystickEvents(void) { CFIndex i; int buttonIndex = 0; - _GLFWjoy* joystick = _glfw.ns.joysticks + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; if (!joystick->present) continue; @@ -324,49 +324,50 @@ void _glfwInitJoysticks(void) HRESULT plugInResult = S_OK; SInt32 score = 0; - long usagePage, usage; + long usagePage = 0; + long usage = 0; - // Check device type + valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject, + CFSTR(kIOHIDPrimaryUsagePageKey), + kCFAllocatorDefault, kNilOptions); + if (valueRef) + { + CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage); + CFRelease(valueRef); + } + + valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject, + CFSTR(kIOHIDPrimaryUsageKey), + kCFAllocatorDefault, kNilOptions); + if (valueRef) + { + CFNumberGetValue(valueRef, kCFNumberLongType, &usage); + CFRelease(valueRef); + } + + if (usagePage != kHIDPage_GenericDesktop) + { + // This device is not relevant to GLFW + continue; + } + + if ((usage != kHIDUsage_GD_Joystick && + usage != kHIDUsage_GD_GamePad && + usage != kHIDUsage_GD_MultiAxisController)) + { + // This device is not relevant to GLFW + continue; + } + result = IORegistryEntryCreateCFProperties(ioHIDDeviceObject, &propsRef, kCFAllocatorDefault, kNilOptions); - + if (result != kIOReturnSuccess) continue; - valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsagePageKey)); - if (valueRef) - { - CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage); - if (usagePage != kHIDPage_GenericDesktop) - { - // This device is not relevant to GLFW - CFRelease(valueRef); - continue; - } - - CFRelease(valueRef); - } - - valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsageKey)); - if (valueRef) - { - CFNumberGetValue(valueRef, kCFNumberLongType, &usage); - - if ((usage != kHIDUsage_GD_Joystick && - usage != kHIDUsage_GD_GamePad && - usage != kHIDUsage_GD_MultiAxisController)) - { - // This device is not relevant to GLFW - CFRelease(valueRef); - continue; - } - - CFRelease(valueRef); - } - - _GLFWjoy* joystick = _glfw.ns.joysticks + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; joystick->present = GL_TRUE; result = IOCreatePlugInInterfaceForService(ioHIDDeviceObject, @@ -376,7 +377,10 @@ void _glfwInitJoysticks(void) &score); if (kIOReturnSuccess != result) + { + CFRelease(propsRef); return; + } plugInResult = (*ppPlugInInterface)->QueryInterface( ppPlugInInterface, @@ -384,7 +388,10 @@ void _glfwInitJoysticks(void) (void *) &(joystick->interface)); if (plugInResult != S_OK) + { + CFRelease(propsRef); return; + } (*ppPlugInInterface)->Release(ppPlugInInterface); @@ -402,7 +409,6 @@ void _glfwInitJoysticks(void) joystick->name, sizeof(joystick->name), kCFStringEncodingUTF8); - CFRelease(valueRef); } joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL); @@ -417,9 +423,10 @@ void _glfwInitJoysticks(void) range, getElementsCFArrayHandler, (void*) joystick); - CFRelease(valueRef); } + CFRelease(propsRef); + joystick->axes = calloc(CFArrayGetCount(joystick->axisElements), sizeof(float)); joystick->buttons = calloc(CFArrayGetCount(joystick->buttonElements) + @@ -439,8 +446,15 @@ void _glfwTerminateJoysticks(void) for (i = 0; i < GLFW_JOYSTICK_LAST + 1; i++) { - _GLFWjoy* joystick = &_glfw.ns.joysticks[i]; + _GLFWjoystickIOKit* joystick = &_glfw.iokit_js[i]; removeJoystick(joystick); + + if (joystick->axisElements) + CFRelease(joystick->axisElements); + if (joystick->buttonElements) + CFRelease(joystick->buttonElements); + if (joystick->hatElements) + CFRelease(joystick->hatElements); } } @@ -453,12 +467,12 @@ int _glfwPlatformJoystickPresent(int joy) { pollJoystickEvents(); - return _glfw.ns.joysticks[joy].present; + return _glfw.iokit_js[joy].present; } const float* _glfwPlatformGetJoystickAxes(int joy, int* count) { - _GLFWjoy* joystick = _glfw.ns.joysticks + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; pollJoystickEvents(); @@ -471,7 +485,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count) const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) { - _GLFWjoy* joystick = _glfw.ns.joysticks + joy; + _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; pollJoystickEvents(); @@ -487,6 +501,6 @@ const char* _glfwPlatformGetJoystickName(int joy) { pollJoystickEvents(); - return _glfw.ns.joysticks[joy].name; + return _glfw.iokit_js[joy].name; } diff --git a/extern/glfw/src/joystick.c b/extern/glfw/src/joystick.c deleted file mode 100644 index b53ea11..0000000 --- a/extern/glfw/src/joystick.c +++ /dev/null @@ -1,90 +0,0 @@ -//======================================================================== -// GLFW 3.0 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2002-2006 Marcus Geelnard -// Copyright (c) 2006-2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - - -////////////////////////////////////////////////////////////////////////// -////// GLFW public API ////// -////////////////////////////////////////////////////////////////////////// - -GLFWAPI int glfwJoystickPresent(int joy) -{ - _GLFW_REQUIRE_INIT_OR_RETURN(0); - - if (joy < 0 || joy > GLFW_JOYSTICK_LAST) - { - _glfwInputError(GLFW_INVALID_ENUM, NULL); - return 0; - } - - return _glfwPlatformJoystickPresent(joy); -} - -GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count) -{ - *count = 0; - - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - - if (joy < 0 || joy > GLFW_JOYSTICK_LAST) - { - _glfwInputError(GLFW_INVALID_ENUM, NULL); - return NULL; - } - - return _glfwPlatformGetJoystickAxes(joy, count); -} - -GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count) -{ - *count = 0; - - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - - if (joy < 0 || joy > GLFW_JOYSTICK_LAST) - { - _glfwInputError(GLFW_INVALID_ENUM, NULL); - return NULL; - } - - return _glfwPlatformGetJoystickButtons(joy, count); -} - -GLFWAPI const char* glfwGetJoystickName(int joy) -{ - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - - if (joy < 0 || joy > GLFW_JOYSTICK_LAST) - { - _glfwInputError(GLFW_INVALID_ENUM, NULL); - return NULL; - } - - return _glfwPlatformGetJoystickName(joy); -} - diff --git a/extern/glfw/src/libglfw3.a b/extern/glfw/src/libglfw3.a new file mode 100644 index 0000000000000000000000000000000000000000..4b2f09a281ff19e917c3aafef3e2d7d3c84c0457 GIT binary patch literal 151730 zcmeFa3w%|@xi-FX5u#vLR8EVEb*oVmMa%|N;-$?__9iPDAd+yYs1TAM(U7Fcj(}B3 znjK|z6G&UHy_{0*IrX&mNN<{2t3eR3UP`^Rwpyk2QnvAKMZA&kd1lS5J!@qzw6^DW zzW?|8&o9|C^UOQ%ymOy5*JIAE?`T;5`GZakc~yA&)YHSKmrN^}77CRJC;c}RntsL^ zGaMgF4l)d5&@c}B{3riE>rBJg-~ag+8^-_k|J4^5#=r9aNBM^Ff8+n(jx~&c|E#mN z8K3xn+1*Cg|K|UnuQ9UTxIg26wt0i${vYwak*)t9pKoM;{Qu%hT9&P>>YQKS(%e|l z)*5eG6^FL0`4U68R4i|6>uj1?u47(mhpsl>(cF4TRcmZjys5RbxvkX!404}Ue_4}a z-PO_2)EXCXWmCMuu}VjQ)~>8?FYj8mtf`~ZwO2u`j?3#?1dtA)tG&IgBi_`gxYcyD zHAEU4JDNH>9iiqnErVsbWFLt`#--A!skz)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njdrRp`boX9Ud%a8Wo>?E74~|2>)*spKU1N-yOm?dys-heKh~a zA^blm`TYJ-{V7$@}XSi`C=SvDtD121mRSN&L!+Dvh@YfZ8iNa5JU2cY3 zt#IGreC{VI{9?ubn8H^m{z(dN4&nDGKF7Eu-BKa^LB&5s@zWvvFDd>z6@Oa@{~pCZ zRq?+U!r!O(W~|E9gFgu2|A*qgOUeIL2>%a?&%TAE&mTkh(^%NS@OkmOKH;C@a6VuC zycR0{dllad{NbK_{hl@|{`(Yvm6EUdeTvVq7tv>(;#VmA8;XCL!tV;<|5)*(ihm%4 zU&O*4hUs%Uexgr_!x>+#&wRx{L-7-euj5y)1KdSiuq~7<%3Xj50!*t+J4C_Q1!KH6FXyGg_{p@W4T>8@^0bKgWKMCN{4@Oth z7ztPUyTP+-rTn%WY4(9Ti( z33r3@A5haqI-bq5O#nCI-pv_)Aph=0~eG;D(fpFQ#C=m2wr qy=4D``tv@hJIU+VD1ec(diglY@C$~|Vklqut62%cYz{aE!~Y+XQ*mbi literal 0 HcmV?d00001 diff --git a/extern/glfw/src/linux_joystick.c b/extern/glfw/src/linux_joystick.c new file mode 100644 index 0000000..5f46519 --- /dev/null +++ b/extern/glfw/src/linux_joystick.c @@ -0,0 +1,322 @@ +//======================================================================== +// GLFW 3.1 Linux - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2002-2006 Marcus Geelnard +// Copyright (c) 2006-2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#if defined(__linux__) +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif // __linux__ + + +// Attempt to open the specified joystick device +// +static void openJoystickDevice(const char* path) +{ +#if defined(__linux__) + char axisCount, buttonCount; + char name[256]; + int joy, fd, version; + + for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++) + { + if (!_glfw.linux_js.js[joy].present) + continue; + + if (strcmp(_glfw.linux_js.js[joy].path, path) == 0) + return; + } + + for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++) + { + if (!_glfw.linux_js.js[joy].present) + break; + } + + if (joy > GLFW_JOYSTICK_LAST) + return; + + fd = open(path, O_RDONLY | O_NONBLOCK); + if (fd == -1) + return; + + _glfw.linux_js.js[joy].fd = fd; + + // Verify that the joystick driver version is at least 1.0 + ioctl(fd, JSIOCGVERSION, &version); + if (version < 0x010000) + { + // It's an old 0.x interface (we don't support it) + close(fd); + return; + } + + if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) + strncpy(name, "Unknown", sizeof(name)); + + _glfw.linux_js.js[joy].name = strdup(name); + _glfw.linux_js.js[joy].path = strdup(path); + + ioctl(fd, JSIOCGAXES, &axisCount); + _glfw.linux_js.js[joy].axisCount = (int) axisCount; + + ioctl(fd, JSIOCGBUTTONS, &buttonCount); + _glfw.linux_js.js[joy].buttonCount = (int) buttonCount; + + _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 = GL_TRUE; +#endif // __linux__ +} + +// Polls for and processes events for all present joysticks +// +static void pollJoystickEvents(void) +{ +#if defined(__linux__) + int i; + struct js_event e; + ssize_t offset = 0; + char buffer[16384]; + + const ssize_t size = read(_glfw.linux_js.inotify, buffer, sizeof(buffer)); + + while (size > offset) + { + regmatch_t match; + const struct inotify_event* e = (struct inotify_event*) (buffer + offset); + + if (regexec(&_glfw.linux_js.regex, e->name, 1, &match, 0) == 0) + { + char path[20]; + snprintf(path, sizeof(path), "/dev/input/%s", e->name); + openJoystickDevice(path); + } + + offset += sizeof(struct inotify_event) + e->len; + } + + for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) + { + if (!_glfw.linux_js.js[i].present) + continue; + + // Read all queued events (non-blocking) + for (;;) + { + errno = 0; + if (read(_glfw.linux_js.js[i].fd, &e, sizeof(e)) < 0) + { + if (errno == ENODEV) + { + // The joystick was disconnected + + free(_glfw.linux_js.js[i].axes); + free(_glfw.linux_js.js[i].buttons); + free(_glfw.linux_js.js[i].name); + free(_glfw.linux_js.js[i].path); + + memset(&_glfw.linux_js.js[i], 0, sizeof(_glfw.linux_js.js[i])); + } + + break; + } + + // We don't care if it's an init event or not + e.type &= ~JS_EVENT_INIT; + + switch (e.type) + { + case JS_EVENT_AXIS: + _glfw.linux_js.js[i].axes[e.number] = + (float) e.value / 32767.0f; + break; + + case JS_EVENT_BUTTON: + _glfw.linux_js.js[i].buttons[e.number] = + e.value ? GLFW_PRESS : GLFW_RELEASE; + break; + + default: + break; + } + } + } +#endif // __linux__ +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +// Initialize joystick interface +// +int _glfwInitJoysticks(void) +{ +#if defined(__linux__) + const char* dirname = "/dev/input"; + DIR* dir; + + _glfw.linux_js.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); + if (_glfw.linux_js.inotify == -1) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Linux: Failed to initialize inotify: %s", + strerror(errno)); + return GL_FALSE; + } + + // HACK: Register for IN_ATTRIB as well to get notified when udev is done + // This works well in practice but the true way is libudev + + _glfw.linux_js.watch = inotify_add_watch(_glfw.linux_js.inotify, + dirname, + IN_CREATE | IN_ATTRIB); + if (_glfw.linux_js.watch == -1) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Linux: Failed to watch for joystick connections in %s: %s", + dirname, + strerror(errno)); + // Continue without device connection notifications + } + + if (regcomp(&_glfw.linux_js.regex, "^js[0-9]\\+$", 0) != 0) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex"); + return GL_FALSE; + } + + dir = opendir(dirname); + if (dir) + { + struct dirent* entry; + + while ((entry = readdir(dir))) + { + char path[20]; + regmatch_t match; + + if (regexec(&_glfw.linux_js.regex, entry->d_name, 1, &match, 0) != 0) + continue; + + snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name); + openJoystickDevice(path); + } + + closedir(dir); + } + else + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Linux: Failed to open joystick device directory %s: %s", + dirname, + strerror(errno)); + // Continue with no joysticks detected + } + +#endif // __linux__ + + return GL_TRUE; +} + +// Close all opened joystick handles +// +void _glfwTerminateJoysticks(void) +{ +#if defined(__linux__) + int i; + + for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) + { + if (_glfw.linux_js.js[i].present) + { + close(_glfw.linux_js.js[i].fd); + free(_glfw.linux_js.js[i].axes); + free(_glfw.linux_js.js[i].buttons); + free(_glfw.linux_js.js[i].name); + free(_glfw.linux_js.js[i].path); + } + } + + regfree(&_glfw.linux_js.regex); + + if (_glfw.linux_js.watch > 0) + close(_glfw.linux_js.watch); + + if (_glfw.linux_js.inotify > 0) + close(_glfw.linux_js.inotify); +#endif // __linux__ +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwPlatformJoystickPresent(int joy) +{ + pollJoystickEvents(); + + return _glfw.linux_js.js[joy].present; +} + +const float* _glfwPlatformGetJoystickAxes(int joy, int* count) +{ + pollJoystickEvents(); + + *count = _glfw.linux_js.js[joy].axisCount; + return _glfw.linux_js.js[joy].axes; +} + +const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) +{ + pollJoystickEvents(); + + *count = _glfw.linux_js.js[joy].buttonCount; + return _glfw.linux_js.js[joy].buttons; +} + +const char* _glfwPlatformGetJoystickName(int joy) +{ + pollJoystickEvents(); + + return _glfw.linux_js.js[joy].name; +} + diff --git a/extern/glfw/src/linux_joystick.h b/extern/glfw/src/linux_joystick.h new file mode 100644 index 0000000..163b07c --- /dev/null +++ b/extern/glfw/src/linux_joystick.h @@ -0,0 +1,63 @@ +//======================================================================== +// GLFW 3.1 Linux - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Jonas Ådahl +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _linux_joystick_h_ +#define _linux_joystick_h_ + +#include + +#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ + _GLFWjoystickLinux linux_js + + +// Linux-specific joystick API data +// +typedef struct _GLFWjoystickLinux +{ + struct + { + int present; + int fd; + float* axes; + int axisCount; + unsigned char* buttons; + int buttonCount; + char* name; + char* path; + } js[GLFW_JOYSTICK_LAST + 1]; + +#if defined(__linux__) + int inotify; + int watch; + regex_t regex; +#endif /*__linux__*/ +} _GLFWjoystickLinux; + + +int _glfwInitJoysticks(void); +void _glfwTerminateJoysticks(void); + +#endif // _linux_joystick_h_ diff --git a/extern/glfw/src/cocoa_time.c b/extern/glfw/src/mach_time.c similarity index 85% rename from extern/glfw/src/cocoa_time.c rename to extern/glfw/src/mach_time.c index cb294cb..59916bb 100644 --- a/extern/glfw/src/cocoa_time.c +++ b/extern/glfw/src/mach_time.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 OS X - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // @@ -48,8 +48,8 @@ void _glfwInitTimer(void) mach_timebase_info_data_t info; mach_timebase_info(&info); - _glfw.ns.timer.resolution = (double) info.numer / (info.denom * 1.0e9); - _glfw.ns.timer.base = getRawTime(); + _glfw.ns_time.resolution = (double) info.numer / (info.denom * 1.0e9); + _glfw.ns_time.base = getRawTime(); } @@ -59,13 +59,13 @@ void _glfwInitTimer(void) double _glfwPlatformGetTime(void) { - return (double) (getRawTime() - _glfw.ns.timer.base) * - _glfw.ns.timer.resolution; + return (double) (getRawTime() - _glfw.ns_time.base) * + _glfw.ns_time.resolution; } void _glfwPlatformSetTime(double time) { - _glfw.ns.timer.base = getRawTime() - - (uint64_t) (time / _glfw.ns.timer.resolution); + _glfw.ns_time.base = getRawTime() - + (uint64_t) (time / _glfw.ns_time.resolution); } diff --git a/extern/glfw/src/mir_init.c b/extern/glfw/src/mir_init.c new file mode 100644 index 0000000..a3c8de9 --- /dev/null +++ b/extern/glfw/src/mir_init.c @@ -0,0 +1,101 @@ +//======================================================================== +// GLFW 3.1 Mir - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Brandon Schaefer +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include + + +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwPlatformInit(void) +{ + int error; + + _glfw.mir.connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__); + + if (!mir_connection_is_valid(_glfw.mir.connection)) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unable to connect to server: %s", + mir_connection_get_error_message(_glfw.mir.connection)); + + return GL_FALSE; + } + + _glfw.mir.display = + mir_connection_get_egl_native_display(_glfw.mir.connection); + + if (!_glfwInitContextAPI()) + return GL_FALSE; + + _glfwInitTimer(); + _glfwInitJoysticks(); + + _glfw.mir.event_queue = calloc(1, sizeof(EventQueue)); + _glfwInitEventQueue(_glfw.mir.event_queue); + + error = pthread_mutex_init(&_glfw.mir.event_mutex, NULL); + if (error) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Failed to create event mutex: %s\n", + strerror(error)); + return GL_FALSE; + } + + return GL_TRUE; +} + +void _glfwPlatformTerminate(void) +{ + _glfwTerminateContextAPI(); + _glfwTerminateJoysticks(); + + _glfwDeleteEventQueue(_glfw.mir.event_queue); + + pthread_mutex_destroy(&_glfw.mir.event_mutex); + + mir_connection_release(_glfw.mir.connection); +} + +const char* _glfwPlatformGetVersionString(void) +{ + const char* version = _GLFW_VERSION_NUMBER " Mir EGL" +#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) + " clock_gettime" +#endif +#if defined(_GLFW_BUILD_DLL) + " shared" +#endif + ; + + return version; +} + diff --git a/extern/glfw/src/mir_monitor.c b/extern/glfw/src/mir_monitor.c new file mode 100644 index 0000000..9776b10 --- /dev/null +++ b/extern/glfw/src/mir_monitor.c @@ -0,0 +1,138 @@ +//======================================================================== +// GLFW 3.1 Mir - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Brandon Schaefer +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +_GLFWmonitor** _glfwPlatformGetMonitors(int* count) +{ + int i, found = 0; + _GLFWmonitor** monitors = NULL; + MirDisplayConfiguration* displayConfig = + mir_connection_create_display_config(_glfw.mir.connection); + + *count = 0; + + for (i = 0; i < displayConfig->num_outputs; i++) + { + const MirDisplayOutput* out = displayConfig->outputs + i; + + if (out->used && + out->connected && + out->num_modes && + out->current_mode < out->num_modes) + { + found++; + monitors = realloc(monitors, sizeof(_GLFWmonitor*) * found); + monitors[i] = _glfwAllocMonitor("Unknown", + out->physical_width_mm, + out->physical_height_mm); + + monitors[i]->mir.x = out->position_x; + monitors[i]->mir.y = out->position_y; + monitors[i]->mir.output_id = out->output_id; + monitors[i]->mir.cur_mode = out->current_mode; + + monitors[i]->modes = _glfwPlatformGetVideoModes(monitors[i], + &monitors[i]->modeCount); + } + } + + mir_display_config_destroy(displayConfig); + + *count = found; + return monitors; +} + +GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second) +{ + return first->mir.output_id == second->mir.output_id; +} + +void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) +{ + if (xpos) + *xpos = monitor->mir.x; + if (ypos) + *ypos = monitor->mir.y; +} + +GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) +{ + int i; + GLFWvidmode* modes = NULL; + MirDisplayConfiguration* displayConfig = + mir_connection_create_display_config(_glfw.mir.connection); + + for (i = 0; i < displayConfig->num_outputs; i++) + { + const MirDisplayOutput* out = displayConfig->outputs + i; + if (out->output_id != monitor->mir.output_id) + continue; + + modes = calloc(out->num_modes, sizeof(GLFWvidmode)); + + for (*found = 0; *found < out->num_modes; (*found)++) + { + modes[*found].width = out->modes[*found].horizontal_resolution; + modes[*found].height = out->modes[*found].vertical_resolution; + modes[*found].refreshRate = out->modes[*found].refresh_rate; + modes[*found].redBits = 8; + modes[*found].greenBits = 8; + modes[*found].blueBits = 8; + } + + break; + } + + mir_display_config_destroy(displayConfig); + + return modes; +} + +void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) +{ + *mode = monitor->modes[monitor->mir.cur_mode]; +} + +void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + diff --git a/extern/glfw/src/mir_platform.h b/extern/glfw/src/mir_platform.h new file mode 100644 index 0000000..76399c2 --- /dev/null +++ b/extern/glfw/src/mir_platform.h @@ -0,0 +1,110 @@ +//======================================================================== +// GLFW 3.1 Mir - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Brandon Schaefer +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _mir_platform_h_ +#define _mir_platform_h_ + +#include + +#include "posix_tls.h" +#include "posix_time.h" +#include "linux_joystick.h" + +#include + +#include + +#if defined(_GLFW_EGL) + #include "egl_context.h" +#else + #error "The Mir backend depends on EGL platform support" +#endif + +#define _GLFW_EGL_NATIVE_WINDOW window->mir.window +#define _GLFW_EGL_NATIVE_DISPLAY _glfw.mir.display + +#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowMir mir +#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorMir mir +#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryMir mir +#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorMir mir + +// Mir-specific Event Queue +// +typedef struct EventQueue +{ + TAILQ_HEAD(, EventNode) head; +} EventQueue; + +// Mir-specific per-window data +// +typedef struct _GLFWwindowMir +{ + MirSurface* surface; + int width; + int height; + MirEGLNativeWindowType window; + +} _GLFWwindowMir; + + +// Mir-specific per-monitor data +// +typedef struct _GLFWmonitorMir +{ + int cur_mode; + int output_id; + int x; + int y; + +} _GLFWmonitorMir; + + +// Mir-specific global data +// +typedef struct _GLFWlibraryMir +{ + MirConnection* connection; + MirEGLNativeDisplayType display; + EventQueue* event_queue; + + pthread_mutex_t event_mutex; + pthread_cond_t event_cond; + +} _GLFWlibraryMir; + + +// Mir-specific per-cursor data +// TODO: Only system cursors are implemented in Mir atm. Need to wait for support. +// +typedef struct _GLFWcursorMir +{ +} _GLFWcursorMir; + + +extern void _glfwInitEventQueue(EventQueue* queue); +extern void _glfwDeleteEventQueue(EventQueue* queue); + +#endif // _mir_platform_h_ diff --git a/extern/glfw/src/mir_window.c b/extern/glfw/src/mir_window.c new file mode 100644 index 0000000..f2890cb --- /dev/null +++ b/extern/glfw/src/mir_window.c @@ -0,0 +1,687 @@ +//======================================================================== +// GLFW 3.1 Mir - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Brandon Schaefer +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" +#include "xkb_unicode.h" + +#include +#include +#include + + +typedef struct EventNode +{ + TAILQ_ENTRY(EventNode) entries; + MirEvent* event; + _GLFWwindow* window; +} EventNode; + +static void deleteNode(EventQueue* queue, EventNode* node) +{ + free(node->event); + free(node); +} + +static int emptyEventQueue(EventQueue* queue) +{ + return queue->head.tqh_first == NULL ? GL_TRUE : GL_FALSE; +} + +static EventNode* newEventNode(MirEvent const* event, _GLFWwindow* context) +{ + EventNode* new_node = calloc(1, sizeof(EventNode)); + new_node->event = calloc(1, sizeof(MirEvent)); + new_node->window = context; + + memcpy(new_node->event, event, sizeof(MirEvent)); + return new_node; +} + +static void enqueueEvent(MirEvent const* event, _GLFWwindow* context) +{ + pthread_mutex_lock(&_glfw.mir.event_mutex); + + EventNode* new_node = newEventNode(event, context); + TAILQ_INSERT_TAIL(&_glfw.mir.event_queue->head, new_node, entries); + + pthread_cond_signal(&_glfw.mir.event_cond); + + pthread_mutex_unlock(&_glfw.mir.event_mutex); +} + +static EventNode* dequeueEvent(EventQueue* queue) +{ + EventNode* node = NULL; + + pthread_mutex_lock(&_glfw.mir.event_mutex); + + node = queue->head.tqh_first; + + if (node) + TAILQ_REMOVE(&queue->head, node, entries); + + pthread_mutex_unlock(&_glfw.mir.event_mutex); + + return node; +} + +static MirPixelFormat findValidPixelFormat(void) +{ + unsigned int i, validFormats, mirPixelFormats = 32; + MirPixelFormat formats[mir_pixel_formats]; + + mir_connection_get_available_surface_formats(_glfw.mir.connection, formats, + mirPixelFormats, &validFormats); + + for (i = 0; i < validFormats; i++) + { + if (formats[i] == mir_pixel_format_abgr_8888 || + formats[i] == mir_pixel_format_xbgr_8888 || + formats[i] == mir_pixel_format_argb_8888 || + formats[i] == mir_pixel_format_xrgb_8888) + { + return formats[i]; + } + } + + return mir_pixel_format_invalid; +} + +static int mirModToGLFWMod(uint32_t mods) +{ + int publicMods = 0x0; + + if (mods & mir_key_modifier_alt) + publicMods |= GLFW_MOD_ALT; + else if (mods & mir_key_modifier_shift) + publicMods |= GLFW_MOD_SHIFT; + else if (mods & mir_key_modifier_ctrl) + publicMods |= GLFW_MOD_CONTROL; + else if (mods & mir_key_modifier_meta) + publicMods |= GLFW_MOD_SUPER; + + return publicMods; +} + +// Taken from wl_init.c +static int toGLFWKeyCode(uint32_t key) +{ + switch (key) + { + case KEY_GRAVE: return GLFW_KEY_GRAVE_ACCENT; + case KEY_1: return GLFW_KEY_1; + case KEY_2: return GLFW_KEY_2; + case KEY_3: return GLFW_KEY_3; + case KEY_4: return GLFW_KEY_4; + case KEY_5: return GLFW_KEY_5; + case KEY_6: return GLFW_KEY_6; + case KEY_7: return GLFW_KEY_7; + case KEY_8: return GLFW_KEY_8; + case KEY_9: return GLFW_KEY_9; + case KEY_0: return GLFW_KEY_0; + case KEY_MINUS: return GLFW_KEY_MINUS; + case KEY_EQUAL: return GLFW_KEY_EQUAL; + case KEY_Q: return GLFW_KEY_Q; + case KEY_W: return GLFW_KEY_W; + case KEY_E: return GLFW_KEY_E; + case KEY_R: return GLFW_KEY_R; + case KEY_T: return GLFW_KEY_T; + case KEY_Y: return GLFW_KEY_Y; + case KEY_U: return GLFW_KEY_U; + case KEY_I: return GLFW_KEY_I; + case KEY_O: return GLFW_KEY_O; + case KEY_P: return GLFW_KEY_P; + case KEY_LEFTBRACE: return GLFW_KEY_LEFT_BRACKET; + case KEY_RIGHTBRACE: return GLFW_KEY_RIGHT_BRACKET; + case KEY_A: return GLFW_KEY_A; + case KEY_S: return GLFW_KEY_S; + case KEY_D: return GLFW_KEY_D; + case KEY_F: return GLFW_KEY_F; + case KEY_G: return GLFW_KEY_G; + case KEY_H: return GLFW_KEY_H; + case KEY_J: return GLFW_KEY_J; + case KEY_K: return GLFW_KEY_K; + case KEY_L: return GLFW_KEY_L; + case KEY_SEMICOLON: return GLFW_KEY_SEMICOLON; + case KEY_APOSTROPHE: return GLFW_KEY_APOSTROPHE; + case KEY_Z: return GLFW_KEY_Z; + case KEY_X: return GLFW_KEY_X; + case KEY_C: return GLFW_KEY_C; + case KEY_V: return GLFW_KEY_V; + case KEY_B: return GLFW_KEY_B; + case KEY_N: return GLFW_KEY_N; + case KEY_M: return GLFW_KEY_M; + case KEY_COMMA: return GLFW_KEY_COMMA; + case KEY_DOT: return GLFW_KEY_PERIOD; + case KEY_SLASH: return GLFW_KEY_SLASH; + case KEY_BACKSLASH: return GLFW_KEY_BACKSLASH; + case KEY_ESC: return GLFW_KEY_ESCAPE; + case KEY_TAB: return GLFW_KEY_TAB; + case KEY_LEFTSHIFT: return GLFW_KEY_LEFT_SHIFT; + case KEY_RIGHTSHIFT: return GLFW_KEY_RIGHT_SHIFT; + case KEY_LEFTCTRL: return GLFW_KEY_LEFT_CONTROL; + case KEY_RIGHTCTRL: return GLFW_KEY_RIGHT_CONTROL; + case KEY_LEFTALT: return GLFW_KEY_LEFT_ALT; + case KEY_RIGHTALT: return GLFW_KEY_RIGHT_ALT; + case KEY_LEFTMETA: return GLFW_KEY_LEFT_SUPER; + case KEY_RIGHTMETA: return GLFW_KEY_RIGHT_SUPER; + case KEY_MENU: return GLFW_KEY_MENU; + case KEY_NUMLOCK: return GLFW_KEY_NUM_LOCK; + case KEY_CAPSLOCK: return GLFW_KEY_CAPS_LOCK; + case KEY_PRINT: return GLFW_KEY_PRINT_SCREEN; + case KEY_SCROLLLOCK: return GLFW_KEY_SCROLL_LOCK; + case KEY_PAUSE: return GLFW_KEY_PAUSE; + case KEY_DELETE: return GLFW_KEY_DELETE; + case KEY_BACKSPACE: return GLFW_KEY_BACKSPACE; + case KEY_ENTER: return GLFW_KEY_ENTER; + case KEY_HOME: return GLFW_KEY_HOME; + case KEY_END: return GLFW_KEY_END; + case KEY_PAGEUP: return GLFW_KEY_PAGE_UP; + case KEY_PAGEDOWN: return GLFW_KEY_PAGE_DOWN; + case KEY_INSERT: return GLFW_KEY_INSERT; + case KEY_LEFT: return GLFW_KEY_LEFT; + case KEY_RIGHT: return GLFW_KEY_RIGHT; + case KEY_DOWN: return GLFW_KEY_DOWN; + case KEY_UP: return GLFW_KEY_UP; + case KEY_F1: return GLFW_KEY_F1; + case KEY_F2: return GLFW_KEY_F2; + case KEY_F3: return GLFW_KEY_F3; + case KEY_F4: return GLFW_KEY_F4; + case KEY_F5: return GLFW_KEY_F5; + case KEY_F6: return GLFW_KEY_F6; + case KEY_F7: return GLFW_KEY_F7; + case KEY_F8: return GLFW_KEY_F8; + case KEY_F9: return GLFW_KEY_F9; + case KEY_F10: return GLFW_KEY_F10; + case KEY_F11: return GLFW_KEY_F11; + case KEY_F12: return GLFW_KEY_F12; + case KEY_F13: return GLFW_KEY_F13; + case KEY_F14: return GLFW_KEY_F14; + case KEY_F15: return GLFW_KEY_F15; + case KEY_F16: return GLFW_KEY_F16; + case KEY_F17: return GLFW_KEY_F17; + case KEY_F18: return GLFW_KEY_F18; + case KEY_F19: return GLFW_KEY_F19; + case KEY_F20: return GLFW_KEY_F20; + case KEY_F21: return GLFW_KEY_F21; + case KEY_F22: return GLFW_KEY_F22; + case KEY_F23: return GLFW_KEY_F23; + case KEY_F24: return GLFW_KEY_F24; + case KEY_KPSLASH: return GLFW_KEY_KP_DIVIDE; + case KEY_KPDOT: return GLFW_KEY_KP_MULTIPLY; + case KEY_KPMINUS: return GLFW_KEY_KP_SUBTRACT; + case KEY_KPPLUS: return GLFW_KEY_KP_ADD; + case KEY_KP0: return GLFW_KEY_KP_0; + case KEY_KP1: return GLFW_KEY_KP_1; + case KEY_KP2: return GLFW_KEY_KP_2; + case KEY_KP3: return GLFW_KEY_KP_3; + case KEY_KP4: return GLFW_KEY_KP_4; + case KEY_KP5: return GLFW_KEY_KP_5; + case KEY_KP6: return GLFW_KEY_KP_6; + case KEY_KP7: return GLFW_KEY_KP_7; + case KEY_KP8: return GLFW_KEY_KP_8; + case KEY_KP9: return GLFW_KEY_KP_9; + case KEY_KPCOMMA: return GLFW_KEY_KP_DECIMAL; + case KEY_KPEQUAL: return GLFW_KEY_KP_EQUAL; + case KEY_KPENTER: return GLFW_KEY_KP_ENTER; + default: return GLFW_KEY_UNKNOWN; + } +} + +static void handleKeyEvent(const MirKeyEvent key, _GLFWwindow* window) +{ + const int pressed = key.action == mir_key_action_up ? GLFW_RELEASE : GLFW_PRESS; + const int mods = mirModToGLFWMod(key.modifiers); + const long text = _glfwKeySym2Unicode(key.key_code); + const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); + + _glfwInputKey(window, toGLFWKeyCode(key.scan_code), key.scan_code, pressed, mods); + + if (text != -1) + _glfwInputChar(window, text, mods, plain); +} + +static void handleMouseButton(_GLFWwindow* window, + int pressed, int mods, MirMotionButton button) +{ + static int lastButton; + int publicButton; + const int publicMods = mirModToGLFWMod(mods); + + switch (button) + { + case mir_motion_button_primary: + publicButton = GLFW_MOUSE_BUTTON_LEFT; + break; + case mir_motion_button_secondary: + publicButton = GLFW_MOUSE_BUTTON_RIGHT; + break; + case mir_motion_button_tertiary: + publicButton = GLFW_MOUSE_BUTTON_MIDDLE; + break; + case mir_motion_button_forward: + // FIXME What is the forward button? + publicButton = GLFW_MOUSE_BUTTON_4; + break; + case mir_motion_button_back: + // FIXME What is the back button? + publicButton = GLFW_MOUSE_BUTTON_5; + break; + default: + publicButton = lastButton; + break; + } + + lastButton = publicButton; + + _glfwInputMouseClick(window, publicButton, pressed, publicMods); +} + +static void handleMouseMotion(_GLFWwindow* window, int x, int y) +{ + _glfwInputCursorMotion(window, x, y); +} + +static void handleMouseScroll(_GLFWwindow* window, int dx, int dy) +{ + _glfwInputScroll(window, dx, dy); +} + +static void handleMouseEvent(const MirMotionEvent motion, + int cord_index, + _GLFWwindow* window) +{ + switch (motion.action) + { + case mir_motion_action_down: + case mir_motion_action_pointer_down: + handleMouseButton(window, GLFW_PRESS, + motion.modifiers, motion.button_state); + break; + case mir_motion_action_up: + case mir_motion_action_pointer_up: + handleMouseButton(window, GLFW_RELEASE, + motion.modifiers, motion.button_state); + break; + case mir_motion_action_hover_move: + case mir_motion_action_move: + handleMouseMotion(window, + motion.pointer_coordinates[cord_index].x, + motion.pointer_coordinates[cord_index].y); + break; + case mir_motion_action_outside: + break; + case mir_motion_action_scroll: + handleMouseScroll(window, + motion.pointer_coordinates[cord_index].hscroll, + motion.pointer_coordinates[cord_index].vscroll); + break; + case mir_motion_action_cancel: + case mir_motion_action_hover_enter: + case mir_motion_action_hover_exit: + break; + default: + break; + + } +} + +static void handleMotionEvent(const MirMotionEvent motion, _GLFWwindow* window) +{ + int i; + for (i = 0; i < motion.pointer_count; i++) + handleMouseEvent(motion, i, window); +} + +static void handleInput(MirEvent const* event, _GLFWwindow* window) +{ + switch (event->type) + { + case mir_event_type_key: + handleKeyEvent(event->key, window); + break; + case mir_event_type_motion: + handleMotionEvent(event->motion, window); + break; + default: + break; + } +} + +static void addNewEvent(MirSurface* surface, MirEvent const* event, void* context) +{ + enqueueEvent(event, context); +} + +static int createSurface(_GLFWwindow* window) +{ + MirSurfaceParameters params = + { + .name = "MirSurface", + .width = window->mir.width, + .height = window->mir.height, + .pixel_format = mir_pixel_format_invalid, + .buffer_usage = mir_buffer_usage_hardware, + .output_id = mir_display_output_id_invalid + }; + + MirEventDelegate delegate = + { + addNewEvent, + window + }; + + params.pixel_format = findValidPixelFormat(); + if (params.pixel_format == mir_pixel_format_invalid) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unable to find a correct pixel format"); + return GL_FALSE; + } + + window->mir.surface = + mir_connection_create_surface_sync(_glfw.mir.connection, ¶ms); + if (!mir_surface_is_valid(window->mir.surface)) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unable to create surface: %s", + mir_surface_get_error_message(window->mir.surface)); + + return GL_FALSE; + } + + mir_surface_set_event_handler(window->mir.surface, &delegate); + + return GL_TRUE; +} + +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +void _glfwInitEventQueue(EventQueue* queue) +{ + TAILQ_INIT(&queue->head); +} + +void _glfwDeleteEventQueue(EventQueue* queue) +{ + if (queue) + { + EventNode* node, *node_next; + node = queue->head.tqh_first; + + while (node != NULL) + { + node_next = node->entries.tqe_next; + + TAILQ_REMOVE(&queue->head, node, entries); + deleteNode(queue, node); + + node = node_next; + } + + free(queue); + } +} + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwPlatformCreateWindow(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) +{ + if (!_glfwCreateContext(window, ctxconfig, fbconfig)) + return GL_FALSE; + + if (wndconfig->monitor) + { + GLFWvidmode mode; + _glfwPlatformGetVideoMode(wndconfig->monitor, &mode); + + mir_surface_set_state(window->mir.surface, mir_surface_state_fullscreen); + + if (wndconfig->width > mode.width || wndconfig->height > mode.height) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Requested surface size is to large (%i %i)", + wndconfig->width, wndconfig->height); + + return GL_FALSE; + } + } + + window->mir.width = wndconfig->width; + window->mir.height = wndconfig->height; + + if (!createSurface(window)) + return GL_FALSE; + + window->mir.window = mir_surface_get_egl_native_window(window->mir.surface); + + return GL_TRUE; +} + +void _glfwPlatformDestroyWindow(_GLFWwindow* window) +{ + if (mir_surface_is_valid(window->mir.surface)) + { + mir_surface_release_sync(window->mir.surface); + window->mir.surface = NULL; + } + + _glfwDestroyContext(window); +} + +void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + int* left, int* top, + int* right, int* bottom) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) +{ + if (width) + *width = window->mir.width; + if (height) + *height = window->mir.height; +} + +void _glfwPlatformIconifyWindow(_GLFWwindow* window) +{ + mir_surface_set_state(window->mir.surface, mir_surface_state_minimized); +} + +void _glfwPlatformRestoreWindow(_GLFWwindow* window) +{ + mir_surface_set_state(window->mir.surface, mir_surface_state_restored); +} + +void _glfwPlatformHideWindow(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformShowWindow(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformUnhideWindow(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +int _glfwPlatformWindowFocused(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); + return GL_FALSE; +} + +int _glfwPlatformWindowIconified(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); + return GL_FALSE; +} + +int _glfwPlatformWindowVisible(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); + return GL_FALSE; +} + +void _glfwPlatformPollEvents(void) +{ + EventNode* node = NULL; + + while ((node = dequeueEvent(_glfw.mir.event_queue))) + { + handleInput(node->event, node->window); + deleteNode(_glfw.mir.event_queue, node); + } +} + +void _glfwPlatformWaitEvents(void) +{ + pthread_mutex_lock(&_glfw.mir.event_mutex); + + if (emptyEventQueue(_glfw.mir.event_queue)) + pthread_cond_wait(&_glfw.mir.event_cond, &_glfw.mir.event_mutex); + + pthread_mutex_unlock(&_glfw.mir.event_mutex); + + _glfwPlatformPollEvents(); +} + +void _glfwPlatformPostEmptyEvent(void) +{ +} + +void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) +{ + if (width) + *width = window->mir.width; + if (height) + *height = window->mir.height; +} + +int _glfwPlatformCreateCursor(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); + + return GL_FALSE; +} + +int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); + + return GL_FALSE; +} + +void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformApplyCursorMode(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); +} + +const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) +{ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Mir: Unsupported function %s!", __PRETTY_FUNCTION__); + + return NULL; +} + diff --git a/extern/glfw/src/monitor.c b/extern/glfw/src/monitor.c index f80d5e9..1ab5748 100644 --- a/extern/glfw/src/monitor.c +++ b/extern/glfw/src/monitor.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -27,46 +27,33 @@ #include "internal.h" +#include #include #include #include -#if defined(_MSC_VER) - #include - #define strdup _strdup -#endif - // Lexical comparison function for GLFW video modes, used by qsort // static int compareVideoModes(const void* firstPtr, const void* secondPtr) { int firstBPP, secondBPP, firstSize, secondSize; - GLFWvidmode* first = (GLFWvidmode*) firstPtr; - GLFWvidmode* second = (GLFWvidmode*) secondPtr; + const GLFWvidmode* first = firstPtr; + const GLFWvidmode* second = secondPtr; // First sort on color bits per pixel - - firstBPP = first->redBits + - first->greenBits + - first->blueBits; - secondBPP = second->redBits + - second->greenBits + - second->blueBits; - + firstBPP = first->redBits + first->greenBits + first->blueBits; + secondBPP = second->redBits + second->greenBits + second->blueBits; if (firstBPP != secondBPP) return firstBPP - secondBPP; // Then sort on screen area, in pixels - firstSize = first->width * first->height; secondSize = second->width * second->height; - if (firstSize != secondSize) return firstSize - secondSize; // Lastly sort on refresh rate - return first->refreshRate - second->refreshRate; } @@ -113,7 +100,7 @@ void _glfwInputMonitorChange(void) { if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j])) { - _glfwDestroyMonitor(_glfw.monitors[i]); + _glfwFreeMonitor(_glfw.monitors[i]); _glfw.monitors[i] = monitors[j]; break; } @@ -167,7 +154,7 @@ void _glfwInputMonitorChange(void) _glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED); } - _glfwDestroyMonitors(monitors, monitorCount); + _glfwFreeMonitors(monitors, monitorCount); } @@ -175,7 +162,7 @@ void _glfwInputMonitorChange(void) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM) +_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM) { _GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor)); monitor->name = strdup(name); @@ -185,7 +172,7 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM) return monitor; } -void _glfwDestroyMonitor(_GLFWmonitor* monitor) +void _glfwFreeMonitor(_GLFWmonitor* monitor) { if (monitor == NULL) return; @@ -198,12 +185,29 @@ void _glfwDestroyMonitor(_GLFWmonitor* monitor) free(monitor); } -void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count) +void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size) +{ + ramp->red = calloc(size, sizeof(unsigned short)); + ramp->green = calloc(size, sizeof(unsigned short)); + ramp->blue = calloc(size, sizeof(unsigned short)); + ramp->size = size; +} + +void _glfwFreeGammaArrays(GLFWgammaramp* ramp) +{ + free(ramp->red); + free(ramp->green); + free(ramp->blue); + + memset(ramp, 0, sizeof(GLFWgammaramp)); +} + +void _glfwFreeMonitors(_GLFWmonitor** monitors, int count) { int i; for (i = 0; i < count; i++) - _glfwDestroyMonitor(monitors[i]); + _glfwFreeMonitor(monitors[i]); free(monitors); } @@ -225,15 +229,21 @@ const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor, { current = monitor->modes + i; - colorDiff = abs((current->redBits + current->greenBits + current->blueBits) - - (desired->redBits + desired->greenBits + desired->blueBits)); + colorDiff = 0; + + if (desired->redBits != GLFW_DONT_CARE) + colorDiff += abs(current->redBits - desired->redBits); + if (desired->greenBits != GLFW_DONT_CARE) + colorDiff += abs(current->greenBits - desired->greenBits); + if (desired->blueBits != GLFW_DONT_CARE) + colorDiff += abs(current->blueBits - desired->blueBits); sizeDiff = abs((current->width - desired->width) * (current->width - desired->width) + (current->height - desired->height) * (current->height - desired->height)); - if (desired->refreshRate) + if (desired->refreshRate != GLFW_DONT_CARE) rateDiff = abs(current->refreshRate - desired->refreshRate); else rateDiff = UINT_MAX - current->refreshRate; @@ -300,20 +310,32 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void) GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + + if (xpos) + *xpos = 0; + if (ypos) + *ypos = 0; + _GLFW_REQUIRE_INIT(); + _glfwPlatformGetMonitorPos(monitor, xpos, ypos); } -GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* width, int* height) +GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + if (widthMM) + *widthMM = 0; + if (heightMM) + *heightMM = 0; + _GLFW_REQUIRE_INIT(); - if (width) - *width = monitor->widthMM; - if (height) - *height = monitor->heightMM; + if (widthMM) + *widthMM = monitor->widthMM; + if (heightMM) + *heightMM = monitor->heightMM; } GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle) @@ -355,3 +377,66 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle) return &monitor->currentMode; } +GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) +{ + int i; + unsigned short values[256]; + GLFWgammaramp ramp; + + _GLFW_REQUIRE_INIT(); + + if (gamma <= 0.f) + { + _glfwInputError(GLFW_INVALID_VALUE, + "Gamma value must be greater than zero"); + return; + } + + for (i = 0; i < 256; i++) + { + double value; + + // Calculate intensity + value = i / 255.0; + // Apply gamma curve + value = pow(value, 1.0 / gamma) * 65535.0 + 0.5; + + // Clamp to value range + if (value > 65535.0) + value = 65535.0; + + values[i] = (unsigned short) value; + } + + ramp.red = values; + ramp.green = values; + ramp.blue = values; + ramp.size = 256; + + glfwSetGammaRamp(handle, &ramp); +} + +GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + _glfwFreeGammaArrays(&monitor->currentRamp); + _glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp); + + return &monitor->currentRamp; +} + +GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + + _GLFW_REQUIRE_INIT(); + + if (!monitor->originalRamp.size) + _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp); + + _glfwPlatformSetGammaRamp(monitor, ramp); +} + diff --git a/extern/glfw/src/nsgl_platform.h b/extern/glfw/src/nsgl_context.h similarity index 59% rename from extern/glfw/src/nsgl_platform.h rename to extern/glfw/src/nsgl_context.h index 31da2f6..fd04535 100644 --- a/extern/glfw/src/nsgl_platform.h +++ b/extern/glfw/src/nsgl_context.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 OS X - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // @@ -24,41 +24,39 @@ // //======================================================================== -#ifndef _nsgl_platform_h_ -#define _nsgl_platform_h_ - +#ifndef _nsgl_context_h_ +#define _nsgl_context_h_ #define _GLFW_PLATFORM_FBCONFIG -#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl -#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryNSGL nsgl +#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl +#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl -//======================================================================== -// GLFW platform specific types -//======================================================================== - -//------------------------------------------------------------------------ -// Platform-specific OpenGL context structure -//------------------------------------------------------------------------ +// NSGL-specific per-context data +// typedef struct _GLFWcontextNSGL { id pixelFormat; id context; + } _GLFWcontextNSGL; -//------------------------------------------------------------------------ -// Platform-specific library global data for NSGL -//------------------------------------------------------------------------ +// NSGL-specific global data +// typedef struct _GLFWlibraryNSGL { - // dlopen handle for dynamically loading OpenGL extension entry points + // dlopen handle for OpenGL.framework (for glfwGetProcAddress) void* framework; - // TLS key for per-thread current context/window - pthread_key_t current; - } _GLFWlibraryNSGL; -#endif // _nsgl_platform_h_ +int _glfwInitContextAPI(void); +void _glfwTerminateContextAPI(void); +int _glfwCreateContext(_GLFWwindow* window, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig); +void _glfwDestroyContext(_GLFWwindow* window); + +#endif // _nsgl_context_h_ diff --git a/extern/glfw/src/nsgl_context.m b/extern/glfw/src/nsgl_context.m index 71638ad..0f0fb86 100644 --- a/extern/glfw/src/nsgl_context.m +++ b/extern/glfw/src/nsgl_context.m @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 OS X - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2009-2010 Camilla Berglund // @@ -26,8 +26,6 @@ #include "internal.h" -#include - ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// @@ -37,12 +35,8 @@ // int _glfwInitContextAPI(void) { - if (pthread_key_create(&_glfw.nsgl.current, NULL) != 0) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "NSGL: Failed to create context TLS"); + if (!_glfwInitTLS()) return GL_FALSE; - } _glfw.nsgl.framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")); @@ -60,25 +54,18 @@ int _glfwInitContextAPI(void) // void _glfwTerminateContextAPI(void) { - pthread_key_delete(_glfw.nsgl.current); + _glfwTerminateTLS(); } // Create the OpenGL context // int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { unsigned int attributeCount = 0; - // OS X needs non-zero color size, so set resonable values - int colorBits = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits; - if (colorBits == 0) - colorBits = 24; - else if (colorBits < 15) - colorBits = 15; - - if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + if (ctxconfig->api == GLFW_OPENGL_ES_API) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: This API does not support OpenGL ES"); @@ -86,7 +73,7 @@ int _glfwCreateContext(_GLFWwindow* window, } #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (wndconfig->glMajor == 3 && wndconfig->glMinor < 2) + if (ctxconfig->major == 3 && ctxconfig->minor < 2) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: The targeted version of OS X does not " @@ -94,9 +81,9 @@ int _glfwCreateContext(_GLFWwindow* window, return GL_FALSE; } - if (wndconfig->glMajor > 2) + if (ctxconfig->major > 2) { - if (!wndconfig->glForward) + if (!ctxconfig->forward) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: The targeted version of OS X only " @@ -105,7 +92,7 @@ int _glfwCreateContext(_GLFWwindow* window, return GL_FALSE; } - if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE) + if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: The targeted version of OS X only " @@ -116,7 +103,7 @@ int _glfwCreateContext(_GLFWwindow* window, } #else // Fail if OpenGL 3.0 or above was requested - if (wndconfig->glMajor > 2) + if (ctxconfig->major > 2) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "NSGL: The targeted version of OS X does not " @@ -125,14 +112,11 @@ int _glfwCreateContext(_GLFWwindow* window, } #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ - // Fail if a robustness strategy was requested - if (wndconfig->glRobustness) - { - _glfwInputError(GLFW_VERSION_UNAVAILABLE, - "NSGL: OS X does not support OpenGL robustness " - "strategies"); - return GL_FALSE; - } + // Context robustness modes (GL_KHR_robustness) are not yet supported on + // OS X but are not a hard constraint, so ignore and continue + + // Context release behaviors (GL_KHR_context_flush_control) are not yet + // supported on OS X but are not a hard constraint, so ignore and continue #define ADD_ATTR(x) { attributes[attributeCount++] = x; } #define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); } @@ -140,45 +124,89 @@ int _glfwCreateContext(_GLFWwindow* window, // Arbitrary array size here NSOpenGLPixelFormatAttribute attributes[40]; - ADD_ATTR(NSOpenGLPFADoubleBuffer); + ADD_ATTR(NSOpenGLPFAAccelerated); ADD_ATTR(NSOpenGLPFAClosestPolicy); #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (wndconfig->glMajor > 2) +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 + if (ctxconfig->major >= 4) + { + ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core); + } + else +#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ + if (ctxconfig->major >= 3) + { ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core); + } #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ - ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); + if (ctxconfig->major <= 2) + { + if (fbconfig->auxBuffers != GLFW_DONT_CARE) + ADD_ATTR2(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers); - if (fbconfig->alphaBits > 0) + if (fbconfig->accumRedBits != GLFW_DONT_CARE && + fbconfig->accumGreenBits != GLFW_DONT_CARE && + fbconfig->accumBlueBits != GLFW_DONT_CARE && + fbconfig->accumAlphaBits != GLFW_DONT_CARE) + { + const int accumBits = fbconfig->accumRedBits + + fbconfig->accumGreenBits + + fbconfig->accumBlueBits + + fbconfig->accumAlphaBits; + + ADD_ATTR2(NSOpenGLPFAAccumSize, accumBits); + } + } + + if (fbconfig->redBits != GLFW_DONT_CARE && + fbconfig->greenBits != GLFW_DONT_CARE && + fbconfig->blueBits != GLFW_DONT_CARE) + { + int colorBits = fbconfig->redBits + + fbconfig->greenBits + + fbconfig->blueBits; + + // OS X needs non-zero color size, so set reasonable values + if (colorBits == 0) + colorBits = 24; + else if (colorBits < 15) + colorBits = 15; + + ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); + } + + if (fbconfig->alphaBits != GLFW_DONT_CARE) ADD_ATTR2(NSOpenGLPFAAlphaSize, fbconfig->alphaBits); - if (fbconfig->depthBits > 0) + if (fbconfig->depthBits != GLFW_DONT_CARE) ADD_ATTR2(NSOpenGLPFADepthSize, fbconfig->depthBits); - if (fbconfig->stencilBits > 0) + if (fbconfig->stencilBits != GLFW_DONT_CARE) ADD_ATTR2(NSOpenGLPFAStencilSize, fbconfig->stencilBits); - int accumBits = fbconfig->accumRedBits + fbconfig->accumGreenBits + - fbconfig->accumBlueBits + fbconfig->accumAlphaBits; - - if (accumBits > 0) - ADD_ATTR2(NSOpenGLPFAAccumSize, accumBits); - - if (fbconfig->auxBuffers > 0) - ADD_ATTR2(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers); - if (fbconfig->stereo) ADD_ATTR(NSOpenGLPFAStereo); - if (fbconfig->samples > 0) + if (fbconfig->doublebuffer) + ADD_ATTR(NSOpenGLPFADoubleBuffer); + + if (fbconfig->samples != GLFW_DONT_CARE) { - ADD_ATTR2(NSOpenGLPFASampleBuffers, 1); - ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples); + if (fbconfig->samples == 0) + { + ADD_ATTR2(NSOpenGLPFASampleBuffers, 0); + } + else + { + ADD_ATTR2(NSOpenGLPFASampleBuffers, 1); + ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples); + } } // NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB - // frambuffer, so there's no need (and no way) to request it + // framebuffer, so there's no need (and no way) to request it ADD_ATTR(0); @@ -196,8 +224,8 @@ int _glfwCreateContext(_GLFWwindow* window, NSOpenGLContext* share = NULL; - if (wndconfig->share) - share = wndconfig->share->nsgl.context; + if (ctxconfig->share) + share = ctxconfig->share->nsgl.context; window->nsgl.context = [[NSOpenGLContext alloc] initWithFormat:window->nsgl.pixelFormat @@ -235,12 +263,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) else [NSOpenGLContext clearCurrentContext]; - pthread_setspecific(_glfw.nsgl.current, window); -} - -_GLFWwindow* _glfwPlatformGetCurrentContext(void) -{ - return (_GLFWwindow*) pthread_getspecific(_glfw.nsgl.current); + _glfwSetCurrentContext(window); } void _glfwPlatformSwapBuffers(_GLFWwindow* window) diff --git a/extern/glfw/src/x11_time.c b/extern/glfw/src/posix_time.c similarity index 84% rename from extern/glfw/src/x11_time.c rename to extern/glfw/src/posix_time.c index d787d89..53ea794 100644 --- a/extern/glfw/src/x11_time.c +++ b/extern/glfw/src/posix_time.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 X11 - www.glfw.org +// GLFW 3.1 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -30,13 +30,12 @@ #include #include - // Return raw time // static uint64_t getRawTime(void) { #if defined(CLOCK_MONOTONIC) - if (_glfw.x11.timer.monotonic) + if (_glfw.posix_time.monotonic) { struct timespec ts; @@ -67,16 +66,16 @@ void _glfwInitTimer(void) if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { - _glfw.x11.timer.monotonic = GL_TRUE; - _glfw.x11.timer.resolution = 1e-9; + _glfw.posix_time.monotonic = GL_TRUE; + _glfw.posix_time.resolution = 1e-9; } else #endif { - _glfw.x11.timer.resolution = 1e-6; + _glfw.posix_time.resolution = 1e-6; } - _glfw.x11.timer.base = getRawTime(); + _glfw.posix_time.base = getRawTime(); } @@ -86,13 +85,13 @@ void _glfwInitTimer(void) double _glfwPlatformGetTime(void) { - return (double) (getRawTime() - _glfw.x11.timer.base) * - _glfw.x11.timer.resolution; + return (double) (getRawTime() - _glfw.posix_time.base) * + _glfw.posix_time.resolution; } void _glfwPlatformSetTime(double time) { - _glfw.x11.timer.base = getRawTime() - - (uint64_t) (time / _glfw.x11.timer.resolution); + _glfw.posix_time.base = getRawTime() - + (uint64_t) (time / _glfw.posix_time.resolution); } diff --git a/extern/glfw/src/time.c b/extern/glfw/src/posix_time.h similarity index 71% rename from extern/glfw/src/time.c rename to extern/glfw/src/posix_time.h index 6af4813..3e0955a 100644 --- a/extern/glfw/src/time.c +++ b/extern/glfw/src/posix_time.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -25,22 +25,25 @@ // //======================================================================== -#include "internal.h" +#ifndef _posix_time_h_ +#define _posix_time_h_ + +#define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimePOSIX posix_time + +#include -////////////////////////////////////////////////////////////////////////// -////// GLFW public API ////// -////////////////////////////////////////////////////////////////////////// - -GLFWAPI double glfwGetTime(void) +// POSIX-specific global timer data +// +typedef struct _GLFWtimePOSIX { - _GLFW_REQUIRE_INIT_OR_RETURN(0.0); - return _glfwPlatformGetTime(); -} + GLboolean monotonic; + double resolution; + uint64_t base; -GLFWAPI void glfwSetTime(double time) -{ - _GLFW_REQUIRE_INIT(); - _glfwPlatformSetTime(time); -} +} _GLFWtimePOSIX; + +void _glfwInitTimer(void); + +#endif // _posix_time_h_ diff --git a/extern/glfw/src/posix_tls.c b/extern/glfw/src/posix_tls.c new file mode 100644 index 0000000..70fe19b --- /dev/null +++ b/extern/glfw/src/posix_tls.c @@ -0,0 +1,66 @@ +//======================================================================== +// GLFW 3.1 POSIX - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2002-2006 Marcus Geelnard +// Copyright (c) 2006-2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + + +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwInitTLS(void) +{ + if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "POSIX: Failed to create context TLS"); + return GL_FALSE; + } + + return GL_TRUE; +} + +void _glfwTerminateTLS(void) +{ + pthread_key_delete(_glfw.posix_tls.context); +} + +void _glfwSetCurrentContext(_GLFWwindow* context) +{ + pthread_setspecific(_glfw.posix_tls.context, context); +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +_GLFWwindow* _glfwPlatformGetCurrentContext(void) +{ + return pthread_getspecific(_glfw.posix_tls.context); +} + diff --git a/extern/glfw/src/clipboard.c b/extern/glfw/src/posix_tls.h similarity index 58% rename from extern/glfw/src/clipboard.c rename to extern/glfw/src/posix_tls.h index f28c5c6..d6fa000 100644 --- a/extern/glfw/src/clipboard.c +++ b/extern/glfw/src/posix_tls.h @@ -1,7 +1,8 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 POSIX - www.glfw.org //------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund +// Copyright (c) 2002-2006 Marcus Geelnard +// Copyright (c) 2006-2010 Camilla Berglund // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -24,27 +25,25 @@ // //======================================================================== -#include "internal.h" +#ifndef _posix_tls_h_ +#define _posix_tls_h_ -#include -#include +#include + +#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls -////////////////////////////////////////////////////////////////////////// -////// GLFW public API ////// -////////////////////////////////////////////////////////////////////////// - -GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string) +// POSIX-specific global TLS data +// +typedef struct _GLFWtlsPOSIX { - _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT(); - _glfwPlatformSetClipboardString(window, string); -} + pthread_key_t context; -GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle) -{ - _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - return _glfwPlatformGetClipboardString(window); -} +} _GLFWtlsPOSIX; + +int _glfwInitTLS(void); +void _glfwTerminateTLS(void); +void _glfwSetCurrentContext(_GLFWwindow* context); + +#endif // _posix_tls_h_ diff --git a/extern/glfw/src/wgl_context.c b/extern/glfw/src/wgl_context.c index 0b3610b..7b3b9c9 100644 --- a/extern/glfw/src/wgl_context.c +++ b/extern/glfw/src/wgl_context.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 WGL - www.glfw.org +// GLFW 3.1 WGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -57,6 +57,7 @@ static void initWGLExtensions(_GLFWwindow* window) window->wgl.ARB_create_context_robustness = GL_FALSE; window->wgl.EXT_swap_control = GL_FALSE; window->wgl.ARB_pixel_format = GL_FALSE; + window->wgl.ARB_context_flush_control = GL_FALSE; window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) wglGetProcAddress("wglGetExtensionsStringEXT"); @@ -119,6 +120,9 @@ static void initWGLExtensions(_GLFWwindow* window) if (window->wgl.GetPixelFormatAttribivARB) window->wgl.ARB_pixel_format = GL_TRUE; } + + if (_glfwPlatformExtensionSupported("WGL_ARB_context_flush_control")) + window->wgl.ARB_context_flush_control = GL_TRUE; } // Returns the specified attribute of the specified pixel format @@ -181,8 +185,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, { // Get pixel format attributes through WGL_ARB_pixel_format if (!getPixelFormatAttrib(window, n, WGL_SUPPORT_OPENGL_ARB) || - !getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB) || - !getPixelFormatAttrib(window, n, WGL_DOUBLE_BUFFER_ARB)) + !getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB)) { continue; } @@ -213,13 +216,20 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, u->accumAlphaBits = getPixelFormatAttrib(window, n, WGL_ACCUM_ALPHA_BITS_ARB); u->auxBuffers = getPixelFormatAttrib(window, n, WGL_AUX_BUFFERS_ARB); - u->stereo = getPixelFormatAttrib(window, n, WGL_STEREO_ARB); + + if (getPixelFormatAttrib(window, n, WGL_STEREO_ARB)) + u->stereo = GL_TRUE; + if (getPixelFormatAttrib(window, n, WGL_DOUBLE_BUFFER_ARB)) + u->doublebuffer = GL_TRUE; if (window->wgl.ARB_multisample) u->samples = getPixelFormatAttrib(window, n, WGL_SAMPLES_ARB); if (window->wgl.ARB_framebuffer_sRGB) - u->sRGB = getPixelFormatAttrib(window, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); + { + if (getPixelFormatAttrib(window, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB)) + u->sRGB = GL_TRUE; + } } else { @@ -236,8 +246,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, } if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) || - !(pfd.dwFlags & PFD_SUPPORT_OPENGL) || - !(pfd.dwFlags & PFD_DOUBLEBUFFER)) + !(pfd.dwFlags & PFD_SUPPORT_OPENGL)) { continue; } @@ -265,7 +274,11 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, u->accumAlphaBits = pfd.cAccumAlphaBits; u->auxBuffers = pfd.cAuxBuffers; - u->stereo = (pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE; + + if (pfd.dwFlags & PFD_STEREO) + u->stereo = GL_TRUE; + if (pfd.dwFlags & PFD_DOUBLEBUFFER) + u->doublebuffer = GL_TRUE; } u->wgl = n; @@ -306,23 +319,16 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, // int _glfwInitContextAPI(void) { - _glfw.wgl.opengl32.instance = LoadLibrary(L"opengl32.dll"); + if (!_glfwInitTLS()) + return GL_FALSE; + + _glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll"); if (!_glfw.wgl.opengl32.instance) { _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to load opengl32.dll"); return GL_FALSE; } - _glfw.wgl.current = TlsAlloc(); - if (_glfw.wgl.current == TLS_OUT_OF_INDEXES) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "WGL: Failed to allocate TLS index"); - return GL_FALSE; - } - - _glfw.wgl.hasTLS = GL_TRUE; - return GL_TRUE; } @@ -330,11 +336,10 @@ int _glfwInitContextAPI(void) // void _glfwTerminateContextAPI(void) { - if (_glfw.wgl.hasTLS) - TlsFree(_glfw.wgl.current); - if (_glfw.wgl.opengl32.instance) FreeLibrary(_glfw.wgl.opengl32.instance); + + _glfwTerminateTLS(); } #define setWGLattrib(attribName, attribValue) \ @@ -344,10 +349,10 @@ void _glfwTerminateContextAPI(void) assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \ } -// Prepare for creation of the OpenGL context +// Create the OpenGL or OpenGL ES context // int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int attribs[40]; @@ -355,8 +360,8 @@ int _glfwCreateContext(_GLFWwindow* window, PIXELFORMATDESCRIPTOR pfd; HGLRC share = NULL; - if (wndconfig->share) - share = wndconfig->share->wgl.context; + if (ctxconfig->share) + share = ctxconfig->share->wgl.context; window->wgl.dc = GetDC(window->win32.handle); if (!window->wgl.dc) @@ -388,42 +393,63 @@ int _glfwCreateContext(_GLFWwindow* window, { int index = 0, mask = 0, flags = 0, strategy = 0; - if (wndconfig->clientAPI == GLFW_OPENGL_API) + if (ctxconfig->api == GLFW_OPENGL_API) { - if (wndconfig->glForward) + if (ctxconfig->forward) flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - if (wndconfig->glDebug) + if (ctxconfig->debug) flags |= WGL_CONTEXT_DEBUG_BIT_ARB; - if (wndconfig->glProfile) + if (ctxconfig->profile) { - if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE) + if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB; - else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE) + else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) mask |= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; } } else mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT; - if (wndconfig->glRobustness) + if (ctxconfig->robustness) { if (window->wgl.ARB_create_context_robustness) { - if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) + if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) strategy = WGL_NO_RESET_NOTIFICATION_ARB; - else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) + else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) strategy = WGL_LOSE_CONTEXT_ON_RESET_ARB; flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB; } } - if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0) + if (ctxconfig->release) { - setWGLattrib(WGL_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor); - setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor); + if (window->wgl.ARB_context_flush_control) + { + if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE) + { + setWGLattrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB, + WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); + } + else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH) + { + setWGLattrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB, + WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB); + } + } + } + + if (ctxconfig->major != 1 || ctxconfig->minor != 0) + { + // NOTE: Only request an explicitly versioned context when + // necessary, as explicitly requesting version 1.0 does not + // always return the highest available version + + setWGLattrib(WGL_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major); + setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor); } if (flags) @@ -497,14 +523,14 @@ void _glfwDestroyContext(_GLFWwindow* window) // Analyzes the specified context for possible recreation // int _glfwAnalyzeContext(const _GLFWwindow* window, - const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { GLboolean required = GL_FALSE; - if (wndconfig->clientAPI == GLFW_OPENGL_API) + if (ctxconfig->api == GLFW_OPENGL_API) { - if (wndconfig->glForward) + if (ctxconfig->forward) { if (!window->wgl.ARB_create_context) { @@ -518,7 +544,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, required = GL_TRUE; } - if (wndconfig->glProfile) + if (ctxconfig->profile) { if (!window->wgl.ARB_create_context_profile) { @@ -530,6 +556,12 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, required = GL_TRUE; } + + if (ctxconfig->release) + { + if (window->wgl.ARB_context_flush_control) + required = GL_TRUE; + } } else { @@ -546,13 +578,13 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, required = GL_TRUE; } - if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0) + if (ctxconfig->major != 1 || ctxconfig->minor != 0) { if (window->wgl.ARB_create_context) required = GL_TRUE; } - if (wndconfig->glDebug) + if (ctxconfig->debug) { if (window->wgl.ARB_create_context) required = GL_TRUE; @@ -570,6 +602,18 @@ int _glfwAnalyzeContext(const _GLFWwindow* window, } } + if (fbconfig->sRGB) + { + // We want sRGB, but can we get it? + // sRGB is not a hard constraint, so otherwise we just don't care + + if (window->wgl.ARB_framebuffer_sRGB && window->wgl.ARB_pixel_format) + { + // We appear to have both the extension and the means to ask for it + required = GL_TRUE; + } + } + if (required) return _GLFW_RECREATION_REQUIRED; @@ -588,12 +632,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) else wglMakeCurrent(NULL, NULL); - TlsSetValue(_glfw.wgl.current, window); -} - -_GLFWwindow* _glfwPlatformGetCurrentContext(void) -{ - return TlsGetValue(_glfw.wgl.current); + _glfwSetCurrentContext(window); } void _glfwPlatformSwapBuffers(_GLFWwindow* window) diff --git a/extern/glfw/src/wgl_platform.h b/extern/glfw/src/wgl_context.h similarity index 71% rename from extern/glfw/src/wgl_platform.h rename to extern/glfw/src/wgl_context.h index bffdf74..3fc29e7 100644 --- a/extern/glfw/src/wgl_platform.h +++ b/extern/glfw/src/wgl_context.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 WGL - www.glfw.org +// GLFW 3.1 WGL - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -25,34 +25,27 @@ // //======================================================================== -#ifndef _wgl_platform_h_ -#define _wgl_platform_h_ +#ifndef _wgl_context_h_ +#define _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 _GLFW_PLATFORM_FBCONFIG int wgl -#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl -#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryWGL wgl +#define _GLFW_PLATFORM_FBCONFIG int wgl +#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl +#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl -//======================================================================== -// GLFW platform specific types -//======================================================================== - -//------------------------------------------------------------------------ -// Platform-specific OpenGL context structure -//------------------------------------------------------------------------ +// WGL-specific per-context data +// typedef struct _GLFWcontextWGL { - // Platform specific window resources HDC dc; // Private GDI device context HGLRC context; // Permanent rendering context - // Platform specific extensions (context specific) + // WGL extensions (context specific) PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT; PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB; PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; @@ -66,18 +59,16 @@ typedef struct _GLFWcontextWGL GLboolean ARB_create_context_profile; GLboolean EXT_create_context_es2_profile; GLboolean ARB_create_context_robustness; + GLboolean ARB_context_flush_control; + } _GLFWcontextWGL; -//------------------------------------------------------------------------ -// Platform-specific library global data for WGL -//------------------------------------------------------------------------ +// WGL-specific global data +// typedef struct _GLFWlibraryWGL { - GLboolean hasTLS; - DWORD current; - - // opengl32.dll + // opengl32.dll (for glfwGetProcAddress) struct { HINSTANCE instance; } opengl32; @@ -85,4 +76,14 @@ typedef struct _GLFWlibraryWGL } _GLFWlibraryWGL; -#endif // _wgl_platform_h_ +int _glfwInitContextAPI(void); +void _glfwTerminateContextAPI(void); +int _glfwCreateContext(_GLFWwindow* window, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig); +void _glfwDestroyContext(_GLFWwindow* window); +int _glfwAnalyzeContext(const _GLFWwindow* window, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig); + +#endif // _wgl_context_h_ diff --git a/extern/glfw/src/win32_clipboard.c b/extern/glfw/src/win32_clipboard.c deleted file mode 100644 index 8fcba46..0000000 --- a/extern/glfw/src/win32_clipboard.c +++ /dev/null @@ -1,127 +0,0 @@ -//======================================================================== -// GLFW 3.0 Win32 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) -{ - WCHAR* wideString; - HANDLE stringHandle; - size_t wideSize; - - wideString = _glfwCreateWideStringFromUTF8(string); - if (!wideString) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Win32: Failed to convert clipboard string to " - "wide string"); - return; - } - - wideSize = (wcslen(wideString) + 1) * sizeof(WCHAR); - - stringHandle = GlobalAlloc(GMEM_MOVEABLE, wideSize); - if (!stringHandle) - { - free(wideString); - - _glfwInputError(GLFW_PLATFORM_ERROR, - "Win32: Failed to allocate global handle for clipboard"); - return; - } - - memcpy(GlobalLock(stringHandle), wideString, wideSize); - GlobalUnlock(stringHandle); - - if (!OpenClipboard(window->win32.handle)) - { - GlobalFree(stringHandle); - free(wideString); - - _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); - return; - } - - EmptyClipboard(); - SetClipboardData(CF_UNICODETEXT, stringHandle); - CloseClipboard(); - - free(wideString); -} - -const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) -{ - HANDLE stringHandle; - - if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) - { - _glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL); - return NULL; - } - - if (!OpenClipboard(window->win32.handle)) - { - _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); - return NULL; - } - - stringHandle = GetClipboardData(CF_UNICODETEXT); - if (!stringHandle) - { - CloseClipboard(); - - _glfwInputError(GLFW_PLATFORM_ERROR, - "Win32: Failed to retrieve clipboard data"); - return NULL; - } - - free(_glfw.win32.clipboardString); - _glfw.win32.clipboardString = - _glfwCreateUTF8FromWideString(GlobalLock(stringHandle)); - - GlobalUnlock(stringHandle); - CloseClipboard(); - - if (!_glfw.win32.clipboardString) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Win32: Failed to convert wide string to UTF-8"); - return NULL; - } - - return _glfw.win32.clipboardString; -} - diff --git a/extern/glfw/src/win32_gamma.c b/extern/glfw/src/win32_gamma.c deleted file mode 100644 index b062bcf..0000000 --- a/extern/glfw/src/win32_gamma.c +++ /dev/null @@ -1,82 +0,0 @@ -//======================================================================== -// GLFW 3.0 Win32 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#include - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) -{ - HDC dc; - WORD values[768]; - DISPLAY_DEVICE display; - - ZeroMemory(&display, sizeof(DISPLAY_DEVICE)); - display.cb = sizeof(DISPLAY_DEVICE); - EnumDisplayDevices(monitor->win32.name, 0, &display, 0); - - dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL); - GetDeviceGammaRamp(dc, values); - DeleteDC(dc); - - _glfwAllocGammaArrays(ramp, 256); - - memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short)); - memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short)); - memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short)); -} - -void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) -{ - HDC dc; - WORD values[768]; - DISPLAY_DEVICE display; - - if (ramp->size != 256) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Win32: Gamma ramp size must be 256"); - return; - } - - memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short)); - memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short)); - memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short)); - - ZeroMemory(&display, sizeof(DISPLAY_DEVICE)); - display.cb = sizeof(DISPLAY_DEVICE); - EnumDisplayDevices(monitor->win32.name, 0, &display, 0); - - dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL); - SetDeviceGammaRamp(dc, values); - DeleteDC(dc); -} - diff --git a/extern/glfw/src/win32_init.c b/extern/glfw/src/win32_init.c index aae46a9..964b23a 100644 --- a/extern/glfw/src/win32_init.c +++ b/extern/glfw/src/win32_init.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 Win32 - www.glfw.org +// GLFW 3.1 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -39,9 +39,9 @@ #if defined(_GLFW_USE_OPTIMUS_HPG) // Applications exporting this symbol with this value will be automatically -// directed to the high-performance GPU on nVidia Optimus systems +// directed to the high-performance GPU on Nvidia Optimus systems // -GLFWAPI DWORD NvOptimusEnablement = 0x00000001; +__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; #endif // _GLFW_USE_OPTIMUS_HPG @@ -60,12 +60,13 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) // static GLboolean initLibraries(void) { -#ifndef _GLFW_NO_DLOAD_WINMM - // winmm.dll (for joystick and timer support) - - _glfw.win32.winmm.instance = LoadLibrary(L"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 GL_FALSE; + } _glfw.win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T) GetProcAddress(_glfw.win32.winmm.instance, "joyGetDevCapsW"); @@ -81,18 +82,21 @@ static GLboolean initLibraries(void) !_glfw.win32.winmm.joyGetPosEx || !_glfw.win32.winmm.timeGetTime) { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to load winmm functions"); return GL_FALSE; } -#endif // _GLFW_NO_DLOAD_WINMM - _glfw.win32.user32.instance = LoadLibrary(L"user32.dll"); + _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 = LoadLibrary(L"dwmapi.dll"); + _glfw.win32.dwmapi.instance = LoadLibraryW(L"dwmapi.dll"); if (_glfw.win32.dwmapi.instance) { _glfw.win32.dwmapi.DwmIsCompositionEnabled = (DWMISCOMPOSITIONENABLED_T) @@ -106,13 +110,8 @@ static GLboolean initLibraries(void) // static void terminateLibraries(void) { -#ifndef _GLFW_NO_DLOAD_WINMM - if (_glfw.win32.winmm.instance != NULL) - { + if (_glfw.win32.winmm.instance) FreeLibrary(_glfw.win32.winmm.instance); - _glfw.win32.winmm.instance = NULL; - } -#endif // _GLFW_NO_DLOAD_WINMM if (_glfw.win32.user32.instance) FreeLibrary(_glfw.win32.user32.instance); @@ -121,6 +120,134 @@ static void terminateLibraries(void) FreeLibrary(_glfw.win32.dwmapi.instance); } +// Create key code translation tables +// +static void createKeyTables(void) +{ + memset(_glfw.win32.publicKeys, -1, sizeof(_glfw.win32.publicKeys)); + + _glfw.win32.publicKeys[0x00B] = GLFW_KEY_0; + _glfw.win32.publicKeys[0x002] = GLFW_KEY_1; + _glfw.win32.publicKeys[0x003] = GLFW_KEY_2; + _glfw.win32.publicKeys[0x004] = GLFW_KEY_3; + _glfw.win32.publicKeys[0x005] = GLFW_KEY_4; + _glfw.win32.publicKeys[0x006] = GLFW_KEY_5; + _glfw.win32.publicKeys[0x007] = GLFW_KEY_6; + _glfw.win32.publicKeys[0x008] = GLFW_KEY_7; + _glfw.win32.publicKeys[0x009] = GLFW_KEY_8; + _glfw.win32.publicKeys[0x00A] = GLFW_KEY_9; + _glfw.win32.publicKeys[0x01E] = GLFW_KEY_A; + _glfw.win32.publicKeys[0x030] = GLFW_KEY_B; + _glfw.win32.publicKeys[0x02E] = GLFW_KEY_C; + _glfw.win32.publicKeys[0x020] = GLFW_KEY_D; + _glfw.win32.publicKeys[0x012] = GLFW_KEY_E; + _glfw.win32.publicKeys[0x021] = GLFW_KEY_F; + _glfw.win32.publicKeys[0x022] = GLFW_KEY_G; + _glfw.win32.publicKeys[0x023] = GLFW_KEY_H; + _glfw.win32.publicKeys[0x017] = GLFW_KEY_I; + _glfw.win32.publicKeys[0x024] = GLFW_KEY_J; + _glfw.win32.publicKeys[0x025] = GLFW_KEY_K; + _glfw.win32.publicKeys[0x026] = GLFW_KEY_L; + _glfw.win32.publicKeys[0x032] = GLFW_KEY_M; + _glfw.win32.publicKeys[0x031] = GLFW_KEY_N; + _glfw.win32.publicKeys[0x018] = GLFW_KEY_O; + _glfw.win32.publicKeys[0x019] = GLFW_KEY_P; + _glfw.win32.publicKeys[0x010] = GLFW_KEY_Q; + _glfw.win32.publicKeys[0x013] = GLFW_KEY_R; + _glfw.win32.publicKeys[0x01F] = GLFW_KEY_S; + _glfw.win32.publicKeys[0x014] = GLFW_KEY_T; + _glfw.win32.publicKeys[0x016] = GLFW_KEY_U; + _glfw.win32.publicKeys[0x02F] = GLFW_KEY_V; + _glfw.win32.publicKeys[0x011] = GLFW_KEY_W; + _glfw.win32.publicKeys[0x02D] = GLFW_KEY_X; + _glfw.win32.publicKeys[0x015] = GLFW_KEY_Y; + _glfw.win32.publicKeys[0x02C] = GLFW_KEY_Z; + + _glfw.win32.publicKeys[0x028] = GLFW_KEY_APOSTROPHE; + _glfw.win32.publicKeys[0x02B] = GLFW_KEY_BACKSLASH; + _glfw.win32.publicKeys[0x033] = GLFW_KEY_COMMA; + _glfw.win32.publicKeys[0x00D] = GLFW_KEY_EQUAL; + _glfw.win32.publicKeys[0x029] = GLFW_KEY_GRAVE_ACCENT; + _glfw.win32.publicKeys[0x01A] = GLFW_KEY_LEFT_BRACKET; + _glfw.win32.publicKeys[0x00C] = GLFW_KEY_MINUS; + _glfw.win32.publicKeys[0x034] = GLFW_KEY_PERIOD; + _glfw.win32.publicKeys[0x01B] = GLFW_KEY_RIGHT_BRACKET; + _glfw.win32.publicKeys[0x027] = GLFW_KEY_SEMICOLON; + _glfw.win32.publicKeys[0x035] = GLFW_KEY_SLASH; + _glfw.win32.publicKeys[0x056] = GLFW_KEY_WORLD_2; + + _glfw.win32.publicKeys[0x00E] = GLFW_KEY_BACKSPACE; + _glfw.win32.publicKeys[0x153] = GLFW_KEY_DELETE; + _glfw.win32.publicKeys[0x14F] = GLFW_KEY_END; + _glfw.win32.publicKeys[0x01C] = GLFW_KEY_ENTER; + _glfw.win32.publicKeys[0x001] = GLFW_KEY_ESCAPE; + _glfw.win32.publicKeys[0x147] = GLFW_KEY_HOME; + _glfw.win32.publicKeys[0x152] = GLFW_KEY_INSERT; + _glfw.win32.publicKeys[0x15D] = GLFW_KEY_MENU; + _glfw.win32.publicKeys[0x151] = GLFW_KEY_PAGE_DOWN; + _glfw.win32.publicKeys[0x149] = GLFW_KEY_PAGE_UP; + _glfw.win32.publicKeys[0x045] = GLFW_KEY_PAUSE; + _glfw.win32.publicKeys[0x039] = GLFW_KEY_SPACE; + _glfw.win32.publicKeys[0x00F] = GLFW_KEY_TAB; + _glfw.win32.publicKeys[0x03A] = GLFW_KEY_CAPS_LOCK; + _glfw.win32.publicKeys[0x145] = GLFW_KEY_NUM_LOCK; + _glfw.win32.publicKeys[0x046] = GLFW_KEY_SCROLL_LOCK; + _glfw.win32.publicKeys[0x03B] = GLFW_KEY_F1; + _glfw.win32.publicKeys[0x03C] = GLFW_KEY_F2; + _glfw.win32.publicKeys[0x03D] = GLFW_KEY_F3; + _glfw.win32.publicKeys[0x03E] = GLFW_KEY_F4; + _glfw.win32.publicKeys[0x03F] = GLFW_KEY_F5; + _glfw.win32.publicKeys[0x040] = GLFW_KEY_F6; + _glfw.win32.publicKeys[0x041] = GLFW_KEY_F7; + _glfw.win32.publicKeys[0x042] = GLFW_KEY_F8; + _glfw.win32.publicKeys[0x043] = GLFW_KEY_F9; + _glfw.win32.publicKeys[0x044] = GLFW_KEY_F10; + _glfw.win32.publicKeys[0x057] = GLFW_KEY_F11; + _glfw.win32.publicKeys[0x058] = GLFW_KEY_F12; + _glfw.win32.publicKeys[0x064] = GLFW_KEY_F13; + _glfw.win32.publicKeys[0x065] = GLFW_KEY_F14; + _glfw.win32.publicKeys[0x066] = GLFW_KEY_F15; + _glfw.win32.publicKeys[0x067] = GLFW_KEY_F16; + _glfw.win32.publicKeys[0x068] = GLFW_KEY_F17; + _glfw.win32.publicKeys[0x069] = GLFW_KEY_F18; + _glfw.win32.publicKeys[0x06A] = GLFW_KEY_F19; + _glfw.win32.publicKeys[0x06B] = GLFW_KEY_F20; + _glfw.win32.publicKeys[0x06C] = GLFW_KEY_F21; + _glfw.win32.publicKeys[0x06D] = GLFW_KEY_F22; + _glfw.win32.publicKeys[0x06E] = GLFW_KEY_F23; + _glfw.win32.publicKeys[0x076] = GLFW_KEY_F24; + _glfw.win32.publicKeys[0x038] = GLFW_KEY_LEFT_ALT; + _glfw.win32.publicKeys[0x01D] = GLFW_KEY_LEFT_CONTROL; + _glfw.win32.publicKeys[0x02A] = GLFW_KEY_LEFT_SHIFT; + _glfw.win32.publicKeys[0x15B] = GLFW_KEY_LEFT_SUPER; + _glfw.win32.publicKeys[0x137] = GLFW_KEY_PRINT_SCREEN; + _glfw.win32.publicKeys[0x138] = GLFW_KEY_RIGHT_ALT; + _glfw.win32.publicKeys[0x11D] = GLFW_KEY_RIGHT_CONTROL; + _glfw.win32.publicKeys[0x036] = GLFW_KEY_RIGHT_SHIFT; + _glfw.win32.publicKeys[0x15C] = GLFW_KEY_RIGHT_SUPER; + _glfw.win32.publicKeys[0x150] = GLFW_KEY_DOWN; + _glfw.win32.publicKeys[0x14B] = GLFW_KEY_LEFT; + _glfw.win32.publicKeys[0x14D] = GLFW_KEY_RIGHT; + _glfw.win32.publicKeys[0x148] = GLFW_KEY_UP; + + _glfw.win32.publicKeys[0x052] = GLFW_KEY_KP_0; + _glfw.win32.publicKeys[0x04F] = GLFW_KEY_KP_1; + _glfw.win32.publicKeys[0x050] = GLFW_KEY_KP_2; + _glfw.win32.publicKeys[0x051] = GLFW_KEY_KP_3; + _glfw.win32.publicKeys[0x04B] = GLFW_KEY_KP_4; + _glfw.win32.publicKeys[0x04C] = GLFW_KEY_KP_5; + _glfw.win32.publicKeys[0x04D] = GLFW_KEY_KP_6; + _glfw.win32.publicKeys[0x047] = GLFW_KEY_KP_7; + _glfw.win32.publicKeys[0x048] = GLFW_KEY_KP_8; + _glfw.win32.publicKeys[0x049] = GLFW_KEY_KP_9; + _glfw.win32.publicKeys[0x04E] = GLFW_KEY_KP_ADD; + _glfw.win32.publicKeys[0x053] = GLFW_KEY_KP_DECIMAL; + _glfw.win32.publicKeys[0x135] = GLFW_KEY_KP_DIVIDE; + _glfw.win32.publicKeys[0x11C] = GLFW_KEY_KP_ENTER; + _glfw.win32.publicKeys[0x037] = GLFW_KEY_KP_MULTIPLY; + _glfw.win32.publicKeys[0x04A] = GLFW_KEY_KP_SUBTRACT; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// @@ -152,9 +279,9 @@ WCHAR* _glfwCreateWideStringFromUTF8(const char* source) if (!length) return NULL; - target = calloc(length + 1, sizeof(WCHAR)); + target = calloc(length, sizeof(WCHAR)); - if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length + 1)) + if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length)) { free(target); return NULL; @@ -174,9 +301,9 @@ char* _glfwCreateUTF8FromWideString(const WCHAR* source) if (!length) return NULL; - target = calloc(length + 1, sizeof(char)); + target = calloc(length, sizeof(char)); - if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length + 1, NULL, NULL)) + if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length, NULL, NULL)) { free(target); return NULL; @@ -195,14 +322,16 @@ int _glfwPlatformInit(void) // To make SetForegroundWindow work as we want, we need to fiddle // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early // as possible in the hope of still being the foreground process) - SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, - &_glfw.win32.foregroundLockTimeout, 0); - SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0), - SPIF_SENDCHANGE); + SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, + &_glfw.win32.foregroundLockTimeout, 0); + SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0), + SPIF_SENDCHANGE); if (!initLibraries()) return GL_FALSE; + createKeyTables(); + if (_glfw_SetProcessDPIAware) _glfw_SetProcessDPIAware(); @@ -212,6 +341,9 @@ int _glfwPlatformInit(void) _control87(MCW_EM, MCW_EM); #endif + if (!_glfwRegisterWindowClass()) + return GL_FALSE; + if (!_glfwInitContextAPI()) return GL_FALSE; @@ -223,16 +355,12 @@ int _glfwPlatformInit(void) void _glfwPlatformTerminate(void) { - if (_glfw.win32.classAtom) - { - UnregisterClass(_GLFW_WNDCLASSNAME, GetModuleHandle(NULL)); - _glfw.win32.classAtom = 0; - } + _glfwUnregisterWindowClass(); // Restore previous foreground lock timeout system setting - SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, - UIntToPtr(_glfw.win32.foregroundLockTimeout), - SPIF_SENDCHANGE); + SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, + UIntToPtr(_glfw.win32.foregroundLockTimeout), + SPIF_SENDCHANGE); free(_glfw.win32.clipboardString); @@ -256,9 +384,6 @@ const char* _glfwPlatformGetVersionString(void) #elif defined(__BORLANDC__) " BorlandC" #endif -#if !defined(_GLFW_NO_DLOAD_WINMM) - " LoadLibrary(winmm)" -#endif #if defined(_GLFW_BUILD_DLL) " DLL" #endif diff --git a/extern/glfw/src/win32_monitor.c b/extern/glfw/src/win32_monitor.c index c7ec314..0690dc1 100644 --- a/extern/glfw/src/win32_monitor.c +++ b/extern/glfw/src/win32_monitor.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 Win32 - www.glfw.org +// GLFW 3.1 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -51,16 +51,15 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) { GLFWvidmode current; const GLFWvidmode* best; - DEVMODE dm; + DEVMODEW dm; best = _glfwChooseVideoMode(monitor, desired); - _glfwPlatformGetVideoMode(monitor, ¤t); if (_glfwCompareVideoModes(¤t, best) == 0) return GL_TRUE; ZeroMemory(&dm, sizeof(dm)); - dm.dmSize = sizeof(DEVMODE); + dm.dmSize = sizeof(DEVMODEW); dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY; dm.dmPelsWidth = best->width; @@ -71,16 +70,17 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) if (dm.dmBitsPerPel < 15 || dm.dmBitsPerPel >= 24) dm.dmBitsPerPel = 32; - if (ChangeDisplaySettingsEx(monitor->win32.name, - &dm, - NULL, - CDS_FULLSCREEN, - NULL) != DISP_CHANGE_SUCCESSFUL) + if (ChangeDisplaySettingsExW(monitor->win32.adapterName, + &dm, + NULL, + CDS_FULLSCREEN, + NULL) != DISP_CHANGE_SUCCESSFUL) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to set video mode"); return GL_FALSE; } + monitor->win32.modeChanged = GL_TRUE; return GL_TRUE; } @@ -88,8 +88,12 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) // void _glfwRestoreVideoMode(_GLFWmonitor* monitor) { - ChangeDisplaySettingsEx(monitor->win32.name, - NULL, NULL, CDS_FULLSCREEN, NULL); + if (monitor->win32.modeChanged) + { + ChangeDisplaySettingsExW(monitor->win32.adapterName, + NULL, NULL, CDS_FULLSCREEN, NULL); + monitor->win32.modeChanged = GL_FALSE; + } } @@ -101,77 +105,81 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) { int size = 0, found = 0; _GLFWmonitor** monitors = NULL; - DWORD adapterIndex = 0; - int primaryIndex = 0; + DWORD adapterIndex, displayIndex; *count = 0; - for (;;) + for (adapterIndex = 0; ; adapterIndex++) { - DISPLAY_DEVICE adapter, display; - char* name; - HDC dc; + DISPLAY_DEVICEW adapter; - ZeroMemory(&adapter, sizeof(DISPLAY_DEVICE)); - adapter.cb = sizeof(DISPLAY_DEVICE); + ZeroMemory(&adapter, sizeof(DISPLAY_DEVICEW)); + adapter.cb = sizeof(DISPLAY_DEVICEW); - if (!EnumDisplayDevices(NULL, adapterIndex, &adapter, 0)) + if (!EnumDisplayDevicesW(NULL, adapterIndex, &adapter, 0)) break; - adapterIndex++; - - if ((adapter.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) || - !(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE)) - { + if (!(adapter.StateFlags & DISPLAY_DEVICE_ACTIVE)) continue; - } - if (found == size) + for (displayIndex = 0; ; displayIndex++) { - if (size) - size *= 2; - else - size = 4; + DISPLAY_DEVICEW display; + char* name; + HDC dc; - monitors = (_GLFWmonitor**) realloc(monitors, sizeof(_GLFWmonitor*) * size); + ZeroMemory(&display, sizeof(DISPLAY_DEVICEW)); + display.cb = sizeof(DISPLAY_DEVICEW); + + if (!EnumDisplayDevicesW(adapter.DeviceName, displayIndex, &display, 0)) + break; + + if (found == size) + { + size += 4; + monitors = realloc(monitors, sizeof(_GLFWmonitor*) * size); + } + + name = _glfwCreateUTF8FromWideString(display.DeviceString); + if (!name) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Failed to convert string to UTF-8"); + continue; + } + + dc = CreateDCW(L"DISPLAY", adapter.DeviceName, NULL, NULL); + + monitors[found] = _glfwAllocMonitor(name, + GetDeviceCaps(dc, HORZSIZE), + GetDeviceCaps(dc, VERTSIZE)); + + DeleteDC(dc); + free(name); + + wcscpy(monitors[found]->win32.adapterName, adapter.DeviceName); + wcscpy(monitors[found]->win32.displayName, display.DeviceName); + + WideCharToMultiByte(CP_UTF8, 0, + adapter.DeviceName, -1, + monitors[found]->win32.publicAdapterName, + sizeof(monitors[found]->win32.publicAdapterName), + NULL, NULL); + + WideCharToMultiByte(CP_UTF8, 0, + display.DeviceName, -1, + monitors[found]->win32.publicDisplayName, + sizeof(monitors[found]->win32.publicDisplayName), + NULL, NULL); + + if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE && + displayIndex == 0) + { + _GLFW_SWAP_POINTERS(monitors[0], monitors[found]); + } + + found++; } - - ZeroMemory(&display, sizeof(DISPLAY_DEVICE)); - display.cb = sizeof(DISPLAY_DEVICE); - - EnumDisplayDevices(adapter.DeviceName, 0, &display, 0); - dc = CreateDC(L"DISPLAY", display.DeviceString, NULL, NULL); - - if (adapter.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) - primaryIndex = found; - - name = _glfwCreateUTF8FromWideString(display.DeviceString); - if (!name) - { - _glfwDestroyMonitors(monitors, found); - _glfwInputError(GLFW_PLATFORM_ERROR, - "Failed to convert string to UTF-8"); - - free(monitors); - return NULL; - } - - monitors[found] = _glfwCreateMonitor(name, - GetDeviceCaps(dc, HORZSIZE), - GetDeviceCaps(dc, VERTSIZE)); - - free(name); - DeleteDC(dc); - - wcscpy(monitors[found]->win32.name, adapter.DeviceName); - found++; - } - - if (primaryIndex > 0) - { - _GLFWmonitor* temp = monitors[0]; - monitors[0] = monitors[primaryIndex]; - monitors[primaryIndex] = temp; } *count = found; @@ -180,19 +188,19 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second) { - return wcscmp(first->win32.name, second->win32.name) == 0; + return wcscmp(first->win32.displayName, second->win32.displayName) == 0; } void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { - DEVMODE settings; - ZeroMemory(&settings, sizeof(DEVMODE)); - settings.dmSize = sizeof(DEVMODE); + DEVMODEW settings; + ZeroMemory(&settings, sizeof(DEVMODEW)); + settings.dmSize = sizeof(DEVMODEW); - EnumDisplaySettingsEx(monitor->win32.name, - ENUM_CURRENT_SETTINGS, - &settings, - EDS_ROTATEDMODE); + EnumDisplaySettingsExW(monitor->win32.adapterName, + ENUM_CURRENT_SETTINGS, + &settings, + EDS_ROTATEDMODE); if (xpos) *xpos = settings.dmPosition.x; @@ -211,12 +219,12 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) { int i; GLFWvidmode mode; - DEVMODE dm; + DEVMODEW dm; - ZeroMemory(&dm, sizeof(DEVMODE)); - dm.dmSize = sizeof(DEVMODE); + ZeroMemory(&dm, sizeof(DEVMODEW)); + dm.dmSize = sizeof(DEVMODEW); - if (!EnumDisplaySettings(monitor->win32.name, modeIndex, &dm)) + if (!EnumDisplaySettingsW(monitor->win32.adapterName, modeIndex, &dm)) break; modeIndex++; @@ -266,12 +274,12 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { - DEVMODE dm; + DEVMODEW dm; - ZeroMemory(&dm, sizeof(DEVMODE)); - dm.dmSize = sizeof(DEVMODE); + ZeroMemory(&dm, sizeof(DEVMODEW)); + dm.dmSize = sizeof(DEVMODEW); - EnumDisplaySettings(monitor->win32.name, ENUM_CURRENT_SETTINGS, &dm); + EnumDisplaySettingsW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm); mode->width = dm.dmPelsWidth; mode->height = dm.dmPelsHeight; @@ -282,3 +290,59 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) &mode->blueBits); } +void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +{ + HDC dc; + WORD values[768]; + + dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL); + GetDeviceGammaRamp(dc, values); + DeleteDC(dc); + + _glfwAllocGammaArrays(ramp, 256); + + memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short)); + memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short)); + memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short)); +} + +void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) +{ + HDC dc; + WORD values[768]; + + if (ramp->size != 256) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Gamma ramp size must be 256"); + return; + } + + memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short)); + memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short)); + memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short)); + + dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL); + SetDeviceGammaRamp(dc, values); + DeleteDC(dc); +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW native API ////// +////////////////////////////////////////////////////////////////////////// + +GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* handle) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + return monitor->win32.publicAdapterName; +} + +GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + return monitor->win32.publicDisplayName; +} + diff --git a/extern/glfw/src/win32_platform.h b/extern/glfw/src/win32_platform.h index 11d774b..861d2bc 100644 --- a/extern/glfw/src/win32_platform.h +++ b/extern/glfw/src/win32_platform.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 Win32 - www.glfw.org +// GLFW 3.1 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -42,9 +42,9 @@ #define WIN32_LEAN_AND_MEAN #endif -// This is a workaround for the fact that glfw3.h needs to export APIENTRY (to -// correctly declare a GL_ARB_debug_output callback, for example) but windows.h -// thinks it is the only one that gets to do so +// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for +// example to allow applications to correctly declare a GL_ARB_debug_output +// callback) but windows.h assumes no one will define APIENTRY before it does #undef APIENTRY // GLFW on Windows is Unicode only and does not work in MBCS mode @@ -66,10 +66,13 @@ #include #include +#if defined(_MSC_VER) + #include + #define strdup _strdup +#endif -//======================================================================== -// Hack: Define things that some windows.h variants don't -//======================================================================== + +// HACK: Define macros that some older windows.h variants don't #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E @@ -77,107 +80,101 @@ #ifndef WM_DWMCOMPOSITIONCHANGED #define WM_DWMCOMPOSITIONCHANGED 0x031E #endif +#ifndef WM_COPYGLOBALDATA + #define WM_COPYGLOBALDATA 0x0049 +#endif +#ifndef WM_UNICHAR + #define WM_UNICHAR 0x0109 +#endif +#ifndef UNICODE_NOCHAR + #define UNICODE_NOCHAR 0xFFFF +#endif +#if WINVER < 0x0601 +typedef struct tagCHANGEFILTERSTRUCT +{ + DWORD cbSize; + DWORD ExtStatus; + +} CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT; +#ifndef MSGFLT_ALLOW + #define MSGFLT_ALLOW 1 +#endif +#endif /*Windows 7*/ -//======================================================================== -// DLLs that are loaded at glfwInit() -//======================================================================== // winmm.dll function pointer typedefs -#ifndef _GLFW_NO_DLOAD_WINMM -typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT); -typedef MMRESULT (WINAPI * JOYGETPOS_T) (UINT,LPJOYINFO); -typedef MMRESULT (WINAPI * JOYGETPOSEX_T) (UINT,LPJOYINFOEX); -typedef DWORD (WINAPI * TIMEGETTIME_T) (void); -#endif // _GLFW_NO_DLOAD_WINMM - - -// winmm.dll shortcuts -#ifndef _GLFW_NO_DLOAD_WINMM - #define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps - #define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos - #define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx - #define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime -#else - #define _glfw_joyGetDevCaps joyGetDevCaps - #define _glfw_joyGetPos joyGetPos - #define _glfw_joyGetPosEx joyGetPosEx - #define _glfw_timeGetTime timeGetTime -#endif // _GLFW_NO_DLOAD_WINMM +typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT); +typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO); +typedef MMRESULT (WINAPI * JOYGETPOSEX_T)(UINT,LPJOYINFOEX); +typedef DWORD (WINAPI * TIMEGETTIME_T)(void); +#define _glfw_joyGetDevCaps _glfw.win32.winmm.joyGetDevCaps +#define _glfw_joyGetPos _glfw.win32.winmm.joyGetPos +#define _glfw_joyGetPosEx _glfw.win32.winmm.joyGetPosEx +#define _glfw_timeGetTime _glfw.win32.winmm.timeGetTime // user32.dll function pointer typedefs typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void); +typedef BOOL (WINAPI * CHANGEWINDOWMESSAGEFILTEREX_T)(HWND,UINT,DWORD,PCHANGEFILTERSTRUCT); #define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware +#define _glfw_ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx // dwmapi.dll function pointer typedefs typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*); #define _glfw_DwmIsCompositionEnabled _glfw.win32.dwmapi.DwmIsCompositionEnabled -// We use versioned window class names in order not to cause conflicts -// between applications using different versions of GLFW -#define _GLFW_WNDCLASSNAME L"GLFW30" - #define _GLFW_RECREATION_NOT_NEEDED 0 #define _GLFW_RECREATION_REQUIRED 1 #define _GLFW_RECREATION_IMPOSSIBLE 2 +#include "win32_tls.h" + #if defined(_GLFW_WGL) - #include "wgl_platform.h" + #include "wgl_context.h" #elif defined(_GLFW_EGL) #define _GLFW_EGL_NATIVE_WINDOW window->win32.handle #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY - #include "egl_platform.h" + #include "egl_context.h" #else #error "No supported context creation API selected" #endif +#include "winmm_joystick.h" + #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 win32 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32 +#define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimeWin32 win32_time #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 win32 +#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32 -//======================================================================== -// GLFW platform specific types -//======================================================================== - - -//------------------------------------------------------------------------ -// Platform-specific window structure -//------------------------------------------------------------------------ +// Win32-specific per-window data +// typedef struct _GLFWwindowWin32 { - // Platform specific window resources - HWND handle; // Window handle - DWORD dwStyle; // Window styles used for window creation - DWORD dwExStyle; // --"-- + HWND handle; + DWORD dwStyle; + DWORD dwExStyle; - // Various platform specific internal variables - GLboolean cursorCentered; GLboolean cursorInside; - GLboolean cursorHidden; - int oldCursorX, oldCursorY; + GLboolean iconified; + + // The last received cursor position, regardless of source + int cursorPosX, cursorPosY; + } _GLFWwindowWin32; -//------------------------------------------------------------------------ -// Platform-specific library global data for Win32 -//------------------------------------------------------------------------ +// Win32-specific global data +// typedef struct _GLFWlibraryWin32 { - ATOM classAtom; DWORD foregroundLockTimeout; char* clipboardString; + short int publicKeys[512]; - // Timer data - struct { - GLboolean hasPC; - double resolution; - unsigned __int64 base; - } timer; - -#ifndef _GLFW_NO_DLOAD_WINMM // winmm.dll struct { HINSTANCE instance; @@ -186,12 +183,12 @@ typedef struct _GLFWlibraryWin32 JOYGETPOSEX_T joyGetPosEx; TIMEGETTIME_T timeGetTime; } winmm; -#endif // _GLFW_NO_DLOAD_WINMM // user32.dll struct { HINSTANCE instance; SETPROCESSDPIAWARE_T SetProcessDPIAware; + CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx; } user32; // dwmapi.dll @@ -200,58 +197,54 @@ typedef struct _GLFWlibraryWin32 DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled; } dwmapi; - struct { - float axes[6]; - unsigned char buttons[36]; // 32 buttons plus one hat - char* name; - } joystick[GLFW_JOYSTICK_LAST + 1]; - } _GLFWlibraryWin32; -//------------------------------------------------------------------------ -// Platform-specific monitor structure -//------------------------------------------------------------------------ +// Win32-specific per-monitor data +// typedef struct _GLFWmonitorWin32 { // This size matches the static size of DISPLAY_DEVICE.DeviceName - WCHAR name[32]; + WCHAR adapterName[32]; + WCHAR displayName[32]; + char publicAdapterName[64]; + char publicDisplayName[64]; + GLboolean modeChanged; } _GLFWmonitorWin32; -//======================================================================== -// Prototypes for platform specific internal functions -//======================================================================== +// Win32-specific per-cursor data +// +typedef struct _GLFWcursorWin32 +{ + HCURSOR handle; + +} _GLFWcursorWin32; + + +// Win32-specific global timer data +// +typedef struct _GLFWtimeWin32 +{ + GLboolean hasPC; + double resolution; + unsigned __int64 base; + +} _GLFWtimeWin32; + + +GLboolean _glfwRegisterWindowClass(void); +void _glfwUnregisterWindowClass(void); -// Desktop compositing BOOL _glfwIsCompositionEnabled(void); -// Wide strings WCHAR* _glfwCreateWideStringFromUTF8(const char* source); char* _glfwCreateUTF8FromWideString(const WCHAR* source); -// Time void _glfwInitTimer(void); -// Joystick input -void _glfwInitJoysticks(void); -void _glfwTerminateJoysticks(void); - -// OpenGL support -int _glfwInitContextAPI(void); -void _glfwTerminateContextAPI(void); -int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig); -void _glfwDestroyContext(_GLFWwindow* window); -int _glfwAnalyzeContext(const _GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig); - -// Fullscreen support GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoMode(_GLFWmonitor* monitor); - #endif // _win32_platform_h_ diff --git a/extern/glfw/src/win32_time.c b/extern/glfw/src/win32_time.c index 6c90895..5f7adf8 100644 --- a/extern/glfw/src/win32_time.c +++ b/extern/glfw/src/win32_time.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 Win32 - www.glfw.org +// GLFW 3.1 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -32,7 +32,7 @@ // static unsigned __int64 getRawTime(void) { - if (_glfw.win32.timer.hasPC) + if (_glfw.win32_time.hasPC) { unsigned __int64 time; QueryPerformanceCounter((LARGE_INTEGER*) &time); @@ -55,16 +55,16 @@ void _glfwInitTimer(void) if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) { - _glfw.win32.timer.hasPC = GL_TRUE; - _glfw.win32.timer.resolution = 1.0 / (double) frequency; + _glfw.win32_time.hasPC = GL_TRUE; + _glfw.win32_time.resolution = 1.0 / (double) frequency; } else { - _glfw.win32.timer.hasPC = GL_FALSE; - _glfw.win32.timer.resolution = 0.001; // winmm resolution is 1 ms + _glfw.win32_time.hasPC = GL_FALSE; + _glfw.win32_time.resolution = 0.001; // winmm resolution is 1 ms } - _glfw.win32.timer.base = getRawTime(); + _glfw.win32_time.base = getRawTime(); } @@ -74,13 +74,13 @@ void _glfwInitTimer(void) double _glfwPlatformGetTime(void) { - return (double) (getRawTime() - _glfw.win32.timer.base) * - _glfw.win32.timer.resolution; + return (double) (getRawTime() - _glfw.win32_time.base) * + _glfw.win32_time.resolution; } void _glfwPlatformSetTime(double time) { - _glfw.win32.timer.base = getRawTime() - - (unsigned __int64) (time / _glfw.win32.timer.resolution); + _glfw.win32_time.base = getRawTime() - + (unsigned __int64) (time / _glfw.win32_time.resolution); } diff --git a/extern/glfw/src/cocoa_clipboard.m b/extern/glfw/src/win32_tls.c similarity index 56% rename from extern/glfw/src/cocoa_clipboard.m rename to extern/glfw/src/win32_tls.c index a58eb5c..088e25d 100644 --- a/extern/glfw/src/cocoa_clipboard.m +++ b/extern/glfw/src/win32_tls.c @@ -1,7 +1,8 @@ //======================================================================== -// GLFW 3.0 OS X - www.glfw.org +// GLFW 3.1 Win32 - www.glfw.org //------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund +// Copyright (c) 2002-2006 Marcus Geelnard +// Copyright (c) 2006-2010 Camilla Berglund // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -26,45 +27,43 @@ #include "internal.h" -#include -#include + +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwInitTLS(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 GL_FALSE; + } + + _glfw.win32_tls.allocated = GL_TRUE; + return GL_TRUE; +} + +void _glfwTerminateTLS(void) +{ + if (_glfw.win32_tls.allocated) + TlsFree(_glfw.win32_tls.context); +} + +void _glfwSetCurrentContext(_GLFWwindow* context) +{ + TlsSetValue(_glfw.win32_tls.context, context); +} ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// -void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) +_GLFWwindow* _glfwPlatformGetCurrentContext(void) { - NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil]; - - NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; - [pasteboard declareTypes:types owner:nil]; - [pasteboard setString:[NSString stringWithUTF8String:string] - forType:NSStringPboardType]; -} - -const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) -{ - NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; - - if (![[pasteboard types] containsObject:NSStringPboardType]) - { - _glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL); - return NULL; - } - - NSString* object = [pasteboard stringForType:NSStringPboardType]; - if (!object) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Cocoa: Failed to retrieve object from pasteboard"); - return NULL; - } - - free(_glfw.ns.clipboardString); - _glfw.ns.clipboardString = strdup([object UTF8String]); - - return _glfw.ns.clipboardString; + return TlsGetValue(_glfw.win32_tls.context); } diff --git a/extern/glfw/src/win32_tls.h b/extern/glfw/src/win32_tls.h new file mode 100644 index 0000000..3ffef72 --- /dev/null +++ b/extern/glfw/src/win32_tls.h @@ -0,0 +1,48 @@ +//======================================================================== +// GLFW 3.1 Win32 - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2002-2006 Marcus Geelnard +// Copyright (c) 2006-2010 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _win32_tls_h_ +#define _win32_tls_h_ + +#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsWin32 win32_tls + + +// Win32-specific global TLS data +// +typedef struct _GLFWtlsWin32 +{ + GLboolean allocated; + DWORD context; + +} _GLFWtlsWin32; + + +int _glfwInitTLS(void); +void _glfwTerminateTLS(void); +void _glfwSetCurrentContext(_GLFWwindow* context); + +#endif // _win32_tls_h_ diff --git a/extern/glfw/src/win32_window.c b/extern/glfw/src/win32_window.c index 6803f70..176ed59 100644 --- a/extern/glfw/src/win32_window.c +++ b/extern/glfw/src/win32_window.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 Win32 - www.glfw.org +// GLFW 3.1 Win32 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -29,10 +29,14 @@ #include #include +#include #include +#include #define _GLFW_KEY_INVALID -2 +#define _GLFW_WNDCLASSNAME L"GLFW30" + // Updates the cursor clip rect // @@ -45,21 +49,14 @@ static void updateClipRect(_GLFWwindow* window) ClipCursor(&clipRect); } -// Hide mouse cursor +// Hide the mouse cursor // static void hideCursor(_GLFWwindow* window) { POINT pos; - ReleaseCapture(); ClipCursor(NULL); - if (window->win32.cursorHidden) - { - ShowCursor(TRUE); - window->win32.cursorHidden = GL_FALSE; - } - if (GetCursorPos(&pos)) { if (WindowFromPoint(pos) == window->win32.handle) @@ -67,42 +64,64 @@ static void hideCursor(_GLFWwindow* window) } } -// Capture mouse cursor +// Disable the mouse cursor // -static void captureCursor(_GLFWwindow* window) -{ - if (!window->win32.cursorHidden) - { - ShowCursor(FALSE); - window->win32.cursorHidden = GL_TRUE; - } - - updateClipRect(window); - SetCapture(window->win32.handle); -} - -// Show mouse cursor -// -static void showCursor(_GLFWwindow* window) +static void disableCursor(_GLFWwindow* window) { POINT pos; - ReleaseCapture(); - ClipCursor(NULL); - - if (window->win32.cursorHidden) - { - ShowCursor(TRUE); - window->win32.cursorHidden = GL_FALSE; - } + updateClipRect(window); if (GetCursorPos(&pos)) { if (WindowFromPoint(pos) == window->win32.handle) - SetCursor(LoadCursor(NULL, IDC_ARROW)); + 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) +{ + switch (shape) + { + case GLFW_ARROW_CURSOR: + return IDC_ARROW; + case GLFW_IBEAM_CURSOR: + return IDC_IBEAM; + case GLFW_CROSSHAIR_CURSOR: + return IDC_CROSS; + case GLFW_HAND_CURSOR: + return IDC_HAND; + case GLFW_HRESIZE_CURSOR: + return IDC_SIZEWE; + case GLFW_VRESIZE_CURSOR: + return IDC_SIZENS; + } + + return NULL; +} + // Retrieves and translates modifier keys // static int getKeyMods(void) @@ -143,224 +162,70 @@ static int getAsyncKeyMods(void) // static int translateKey(WPARAM wParam, LPARAM lParam) { - // Check for numeric keypad keys - // NOTE: This way we always force "NumLock = ON", which is intentional since - // the returned key code should correspond to a physical location. - if ((HIWORD(lParam) & 0x100) == 0) + if (wParam == VK_CONTROL) { - switch (MapVirtualKey(HIWORD(lParam) & 0xFF, 1)) - { - case VK_INSERT: return GLFW_KEY_KP_0; - case VK_END: return GLFW_KEY_KP_1; - case VK_DOWN: return GLFW_KEY_KP_2; - case VK_NEXT: return GLFW_KEY_KP_3; - case VK_LEFT: return GLFW_KEY_KP_4; - case VK_CLEAR: return GLFW_KEY_KP_5; - case VK_RIGHT: return GLFW_KEY_KP_6; - case VK_HOME: return GLFW_KEY_KP_7; - case VK_UP: return GLFW_KEY_KP_8; - case VK_PRIOR: return GLFW_KEY_KP_9; - case VK_DIVIDE: return GLFW_KEY_KP_DIVIDE; - case VK_MULTIPLY: return GLFW_KEY_KP_MULTIPLY; - case VK_SUBTRACT: return GLFW_KEY_KP_SUBTRACT; - case VK_ADD: return GLFW_KEY_KP_ADD; - case VK_DELETE: return GLFW_KEY_KP_DECIMAL; - default: break; - } - } - - // Check which key was pressed or released - switch (wParam) - { - // The SHIFT keys require special handling - case VK_SHIFT: - { - // Compare scan code for this key with that of VK_RSHIFT in - // order to determine which shift key was pressed (left or - // right) - const DWORD scancode = MapVirtualKey(VK_RSHIFT, 0); - if ((DWORD) ((lParam & 0x01ff0000) >> 16) == scancode) - return GLFW_KEY_RIGHT_SHIFT; - - return GLFW_KEY_LEFT_SHIFT; - } - // The CTRL keys require special handling - case VK_CONTROL: + + MSG next; + DWORD time; + + // Is this an extended key (i.e. right key)? + if (lParam & 0x01000000) + return GLFW_KEY_RIGHT_CONTROL; + + // Here is a trick: "Alt Gr" sends LCTRL, then RALT. We only + // want the RALT message, so we try to see if the next message + // is a RALT message. In that case, this is a false LCTRL! + time = GetMessageTime(); + + if (PeekMessageW(&next, NULL, 0, 0, PM_NOREMOVE)) { - MSG next; - DWORD time; - - // Is this an extended key (i.e. right key)? - if (lParam & 0x01000000) - return GLFW_KEY_RIGHT_CONTROL; - - // Here is a trick: "Alt Gr" sends LCTRL, then RALT. We only - // want the RALT message, so we try to see if the next message - // is a RALT message. In that case, this is a false LCTRL! - time = GetMessageTime(); - - if (PeekMessage(&next, NULL, 0, 0, PM_NOREMOVE)) + if (next.message == WM_KEYDOWN || + next.message == WM_SYSKEYDOWN || + next.message == WM_KEYUP || + next.message == WM_SYSKEYUP) { - if (next.message == WM_KEYDOWN || - next.message == WM_SYSKEYDOWN || - next.message == WM_KEYUP || - next.message == WM_SYSKEYUP) + if (next.wParam == VK_MENU && + (next.lParam & 0x01000000) && + next.time == time) { - if (next.wParam == VK_MENU && - (next.lParam & 0x01000000) && - next.time == time) - { - // Next message is a RALT down message, which - // means that this is not a proper LCTRL message - return _GLFW_KEY_INVALID; - } + // Next message is a RALT down message, which + // means that this is not a proper LCTRL message + return _GLFW_KEY_INVALID; } } - - return GLFW_KEY_LEFT_CONTROL; } - // The ALT keys require special handling - case VK_MENU: - { - // Is this an extended key (i.e. right key)? - if (lParam & 0x01000000) - return GLFW_KEY_RIGHT_ALT; - - return GLFW_KEY_LEFT_ALT; - } - - // The ENTER keys require special handling - case VK_RETURN: - { - // Is this an extended key (i.e. right key)? - if (lParam & 0x01000000) - return GLFW_KEY_KP_ENTER; - - return GLFW_KEY_ENTER; - } - - // Funcion keys (non-printable keys) - case VK_ESCAPE: return GLFW_KEY_ESCAPE; - case VK_TAB: return GLFW_KEY_TAB; - case VK_BACK: return GLFW_KEY_BACKSPACE; - case VK_HOME: return GLFW_KEY_HOME; - case VK_END: return GLFW_KEY_END; - case VK_PRIOR: return GLFW_KEY_PAGE_UP; - case VK_NEXT: return GLFW_KEY_PAGE_DOWN; - case VK_INSERT: return GLFW_KEY_INSERT; - case VK_DELETE: return GLFW_KEY_DELETE; - case VK_LEFT: return GLFW_KEY_LEFT; - case VK_UP: return GLFW_KEY_UP; - case VK_RIGHT: return GLFW_KEY_RIGHT; - case VK_DOWN: return GLFW_KEY_DOWN; - case VK_F1: return GLFW_KEY_F1; - case VK_F2: return GLFW_KEY_F2; - case VK_F3: return GLFW_KEY_F3; - case VK_F4: return GLFW_KEY_F4; - case VK_F5: return GLFW_KEY_F5; - case VK_F6: return GLFW_KEY_F6; - case VK_F7: return GLFW_KEY_F7; - case VK_F8: return GLFW_KEY_F8; - case VK_F9: return GLFW_KEY_F9; - case VK_F10: return GLFW_KEY_F10; - case VK_F11: return GLFW_KEY_F11; - case VK_F12: return GLFW_KEY_F12; - case VK_F13: return GLFW_KEY_F13; - case VK_F14: return GLFW_KEY_F14; - case VK_F15: return GLFW_KEY_F15; - case VK_F16: return GLFW_KEY_F16; - case VK_F17: return GLFW_KEY_F17; - case VK_F18: return GLFW_KEY_F18; - case VK_F19: return GLFW_KEY_F19; - case VK_F20: return GLFW_KEY_F20; - case VK_F21: return GLFW_KEY_F21; - case VK_F22: return GLFW_KEY_F22; - case VK_F23: return GLFW_KEY_F23; - case VK_F24: return GLFW_KEY_F24; - case VK_NUMLOCK: return GLFW_KEY_NUM_LOCK; - case VK_CAPITAL: return GLFW_KEY_CAPS_LOCK; - case VK_SNAPSHOT: return GLFW_KEY_PRINT_SCREEN; - case VK_SCROLL: return GLFW_KEY_SCROLL_LOCK; - case VK_PAUSE: return GLFW_KEY_PAUSE; - case VK_LWIN: return GLFW_KEY_LEFT_SUPER; - case VK_RWIN: return GLFW_KEY_RIGHT_SUPER; - case VK_APPS: return GLFW_KEY_MENU; - - // Numeric keypad - case VK_NUMPAD0: return GLFW_KEY_KP_0; - case VK_NUMPAD1: return GLFW_KEY_KP_1; - case VK_NUMPAD2: return GLFW_KEY_KP_2; - case VK_NUMPAD3: return GLFW_KEY_KP_3; - case VK_NUMPAD4: return GLFW_KEY_KP_4; - case VK_NUMPAD5: return GLFW_KEY_KP_5; - case VK_NUMPAD6: return GLFW_KEY_KP_6; - case VK_NUMPAD7: return GLFW_KEY_KP_7; - case VK_NUMPAD8: return GLFW_KEY_KP_8; - case VK_NUMPAD9: return GLFW_KEY_KP_9; - case VK_DIVIDE: return GLFW_KEY_KP_DIVIDE; - case VK_MULTIPLY: return GLFW_KEY_KP_MULTIPLY; - case VK_SUBTRACT: return GLFW_KEY_KP_SUBTRACT; - case VK_ADD: return GLFW_KEY_KP_ADD; - case VK_DECIMAL: return GLFW_KEY_KP_DECIMAL; - - // Printable keys are mapped according to US layout - case VK_SPACE: return GLFW_KEY_SPACE; - case 0x30: return GLFW_KEY_0; - case 0x31: return GLFW_KEY_1; - case 0x32: return GLFW_KEY_2; - case 0x33: return GLFW_KEY_3; - case 0x34: return GLFW_KEY_4; - case 0x35: return GLFW_KEY_5; - case 0x36: return GLFW_KEY_6; - case 0x37: return GLFW_KEY_7; - case 0x38: return GLFW_KEY_8; - case 0x39: return GLFW_KEY_9; - case 0x41: return GLFW_KEY_A; - case 0x42: return GLFW_KEY_B; - case 0x43: return GLFW_KEY_C; - case 0x44: return GLFW_KEY_D; - case 0x45: return GLFW_KEY_E; - case 0x46: return GLFW_KEY_F; - case 0x47: return GLFW_KEY_G; - case 0x48: return GLFW_KEY_H; - case 0x49: return GLFW_KEY_I; - case 0x4A: return GLFW_KEY_J; - case 0x4B: return GLFW_KEY_K; - case 0x4C: return GLFW_KEY_L; - case 0x4D: return GLFW_KEY_M; - case 0x4E: return GLFW_KEY_N; - case 0x4F: return GLFW_KEY_O; - case 0x50: return GLFW_KEY_P; - case 0x51: return GLFW_KEY_Q; - case 0x52: return GLFW_KEY_R; - case 0x53: return GLFW_KEY_S; - case 0x54: return GLFW_KEY_T; - case 0x55: return GLFW_KEY_U; - case 0x56: return GLFW_KEY_V; - case 0x57: return GLFW_KEY_W; - case 0x58: return GLFW_KEY_X; - case 0x59: return GLFW_KEY_Y; - case 0x5A: return GLFW_KEY_Z; - case 0xBD: return GLFW_KEY_MINUS; - case 0xBB: return GLFW_KEY_EQUAL; - case 0xDB: return GLFW_KEY_LEFT_BRACKET; - case 0xDD: return GLFW_KEY_RIGHT_BRACKET; - case 0xDC: return GLFW_KEY_BACKSLASH; - case 0xBA: return GLFW_KEY_SEMICOLON; - case 0xDE: return GLFW_KEY_APOSTROPHE; - case 0xC0: return GLFW_KEY_GRAVE_ACCENT; - case 0xBC: return GLFW_KEY_COMMA; - case 0xBE: return GLFW_KEY_PERIOD; - case 0xBF: return GLFW_KEY_SLASH; - case 0xDF: return GLFW_KEY_WORLD_1; - case 0xE2: return GLFW_KEY_WORLD_2; - default: break; + return GLFW_KEY_LEFT_CONTROL; } - // No matching translation was found - return GLFW_KEY_UNKNOWN; + return _glfw.win32.publicKeys[HIWORD(lParam) & 0x1FF]; +} + +// Enter full screen mode +// +static GLboolean enterFullscreenMode(_GLFWwindow* window) +{ + GLFWvidmode mode; + GLboolean status; + int xpos, ypos; + + status = _glfwSetVideoMode(window->monitor, &window->videoMode); + + _glfwPlatformGetVideoMode(window->monitor, &mode); + _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); + + SetWindowPos(window->win32.handle, HWND_TOPMOST, + xpos, ypos, mode.width, mode.height, SWP_NOCOPYBITS); + + return status; +} + +// Leave full screen mode +// +static void leaveFullscreenMode(_GLFWwindow* window) +{ + _glfwRestoreVideoMode(window->monitor); } // Window callback function (handles window events) @@ -368,99 +233,44 @@ static int translateKey(WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - _GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtr(hWnd, 0); + _GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtrW(hWnd, 0); switch (uMsg) { - case WM_CREATE: + case WM_NCCREATE: { - CREATESTRUCT* cs = (CREATESTRUCT*) lParam; - SetWindowLongPtr(hWnd, 0, (LONG_PTR) cs->lpCreateParams); + CREATESTRUCTW* cs = (CREATESTRUCTW*) lParam; + SetWindowLongPtrW(hWnd, 0, (LONG_PTR) cs->lpCreateParams); break; } - case WM_ACTIVATE: + case WM_SETFOCUS: { - // Window was (de)focused and/or (de)iconified + if (window->cursorMode != GLFW_CURSOR_NORMAL) + _glfwPlatformApplyCursorMode(window); - BOOL focused = LOWORD(wParam) != WA_INACTIVE; - BOOL iconified = HIWORD(wParam) ? TRUE : FALSE; + if (window->monitor && window->autoIconify) + enterFullscreenMode(window); - if (focused && iconified) - { - if (window->iconified && _glfw.focusedWindow != window) - { - // This is a workaround for window restoration using the - // Win+D hot key leading to windows being told they're - // focused and iconified and then never told they're - // restored - iconified = FALSE; - } - else - { - // This is a workaround for window iconification using the - // taskbar leading to windows being told they're focused and - // iconified and then never told they're defocused - focused = FALSE; - } - } - - if (!focused && _glfw.focusedWindow == window) - { - // The window was defocused (or iconified, see above) - - if (window->cursorMode != GLFW_CURSOR_NORMAL) - showCursor(window); - - if (window->monitor) - { - if (!iconified) - { - // Iconify the (on top, borderless, oddly positioned) - // window or the user will be annoyed - _glfwPlatformIconifyWindow(window); - } - - _glfwRestoreVideoMode(window->monitor); - } - } - else if (focused && _glfw.focusedWindow != window) - { - // The window was focused - - if (window->cursorMode == GLFW_CURSOR_DISABLED) - captureCursor(window); - else if (window->cursorMode == GLFW_CURSOR_HIDDEN) - hideCursor(window); - - if (window->monitor) - _glfwSetVideoMode(window->monitor, &window->videoMode); - } - - _glfwInputWindowFocus(window, focused); - _glfwInputWindowIconify(window, iconified); + _glfwInputWindowFocus(window, GL_TRUE); return 0; } - case WM_ACTIVATEAPP: + case WM_KILLFOCUS: { - if (!wParam && IsIconic(hWnd)) + if (window->cursorMode != GLFW_CURSOR_NORMAL) + restoreCursor(window); + + if (window->monitor && window->autoIconify) { - // This is a workaround for full screen windows losing focus - // through Alt+Tab leading to windows being told they're - // unfocused and restored and then never told they're iconified - _glfwInputWindowIconify(window, GL_TRUE); + _glfwPlatformIconifyWindow(window); + leaveFullscreenMode(window); } + _glfwInputWindowFocus(window, GL_FALSE); return 0; } - case WM_SHOWWINDOW: - { - _glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE); - break; - } - case WM_SYSCOMMAND: { switch (wParam & 0xfff0) @@ -470,7 +280,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, { if (window->monitor) { - // We are running in fullscreen mode, so disallow + // We are running in full screen mode, so disallow // screen saver and screen blanking return 0; } @@ -494,7 +304,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_KEYDOWN: case WM_SYSKEYDOWN: { - const int scancode = (lParam >> 16) & 0xff; + const int scancode = (lParam >> 16) & 0x1ff; const int key = translateKey(wParam, lParam); if (key == _GLFW_KEY_INVALID) break; @@ -504,9 +314,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, } case WM_CHAR: + { + _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GL_TRUE); + return 0; + } + case WM_SYSCHAR: { - _glfwInputChar(window, (unsigned int) wParam); + _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GL_FALSE); return 0; } @@ -521,7 +336,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, return TRUE; } - _glfwInputChar(window, (unsigned int) wParam); + _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GL_TRUE); return FALSE; } @@ -529,7 +344,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_SYSKEYUP: { const int mods = getKeyMods(); - const int scancode = (lParam >> 16) & 0xff; + const int scancode = (lParam >> 16) & 0x1ff; const int key = translateKey(wParam, lParam); if (key == _GLFW_KEY_INVALID) break; @@ -611,34 +426,23 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_MOUSEMOVE: { - const int newCursorX = GET_X_LPARAM(lParam); - const int newCursorY = GET_Y_LPARAM(lParam); + const int x = GET_X_LPARAM(lParam); + const int y = GET_Y_LPARAM(lParam); - if (newCursorX != window->win32.oldCursorX || - newCursorY != window->win32.oldCursorY) + if (window->cursorMode == GLFW_CURSOR_DISABLED) { - int x, y; + if (_glfw.focusedWindow != window) + break; - if (window->cursorMode == GLFW_CURSOR_DISABLED) - { - if (_glfw.focusedWindow != window) - return 0; - - x = newCursorX - window->win32.oldCursorX; - y = newCursorY - window->win32.oldCursorY; - } - else - { - x = newCursorX; - y = newCursorY; - } - - window->win32.oldCursorX = newCursorX; - window->win32.oldCursorY = newCursorY; - window->win32.cursorCentered = GL_FALSE; - - _glfwInputCursorMotion(window, x, y); + _glfwInputCursorMotion(window, + x - window->win32.cursorPosX, + y - window->win32.cursorPosY); } + else + _glfwInputCursorMotion(window, x, y); + + window->win32.cursorPosX = x; + window->win32.cursorPosY = y; if (!window->win32.cursorInside) { @@ -672,16 +476,29 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_MOUSEHWHEEL: { // This message is only sent on Windows Vista and later - _glfwInputScroll(window, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA, 0.0); + // NOTE: The X-axis is inverted for consistency with OS X and X11. + _glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0); return 0; } case WM_SIZE: { - if (window->cursorMode == GLFW_CURSOR_DISABLED && - _glfw.focusedWindow == window) + if (_glfw.focusedWindow == window) { - updateClipRect(window); + if (window->cursorMode == GLFW_CURSOR_DISABLED) + updateClipRect(window); + } + + if (!window->win32.iconified && wParam == SIZE_MINIMIZED) + { + window->win32.iconified = GL_TRUE; + _glfwInputWindowIconify(window, GL_TRUE); + } + else if (window->win32.iconified && + (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)) + { + window->win32.iconified = GL_FALSE; + _glfwInputWindowIconify(window, GL_FALSE); } _glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); @@ -691,10 +508,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_MOVE: { - if (window->cursorMode == GLFW_CURSOR_DISABLED && - _glfw.focusedWindow == window) + if (_glfw.focusedWindow == window) { - updateClipRect(window); + if (window->cursorMode == GLFW_CURSOR_DISABLED) + updateClipRect(window); } // NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as @@ -711,14 +528,26 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, break; } + case WM_ERASEBKGND: + { + return TRUE; + } + case WM_SETCURSOR: { - if (window->cursorMode != GLFW_CURSOR_NORMAL && - _glfw.focusedWindow == window && - LOWORD(lParam) == HTCLIENT) + if (_glfw.focusedWindow == window && LOWORD(lParam) == HTCLIENT) { - SetCursor(NULL); - return TRUE; + if (window->cursorMode == GLFW_CURSOR_HIDDEN || + window->cursorMode == GLFW_CURSOR_DISABLED) + { + SetCursor(NULL); + return TRUE; + } + else if (window->cursor) + { + SetCursor(window->cursor->win32.handle); + return TRUE; + } } break; @@ -747,6 +576,40 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, // TODO: Restore vsync if compositing was disabled break; } + + case WM_DROPFILES: + { + HDROP hDrop = (HDROP) wParam; + POINT pt; + int i; + + const int count = DragQueryFileW(hDrop, 0xffffffff, NULL, 0); + char** names = calloc(count, sizeof(char*)); + + // Move the mouse to the position of the drop + DragQueryPoint(hDrop, &pt); + _glfwInputCursorMotion(window, pt.x, pt.y); + + for (i = 0; i < count; i++) + { + const UINT length = DragQueryFileW(hDrop, i, NULL, 0); + WCHAR* buffer = calloc(length + 1, sizeof(WCHAR)); + + DragQueryFileW(hDrop, i, buffer, length + 1); + names[i] = _glfwCreateUTF8FromWideString(buffer); + + free(buffer); + } + + _glfwInputDrop(window, count, (const char**) names); + + for (i = 0; i < count; i++) + free(names[i]); + free(names); + + DragFinish(hDrop); + return 0; + } } return DefWindowProc(hWnd, uMsg, wParam, lParam); @@ -765,47 +628,11 @@ static void getFullWindowSize(_GLFWwindow* window, *fullHeight = rect.bottom - rect.top; } -// Registers the GLFW window class -// -static ATOM registerWindowClass(void) -{ - WNDCLASS wc; - ATOM classAtom; - - // Set window class parameters - wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = (WNDPROC) windowProc; - wc.cbClsExtra = 0; // No extra class data - wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer - wc.hInstance = GetModuleHandle(NULL); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = NULL; // No background - wc.lpszMenuName = NULL; // No menu - wc.lpszClassName = _GLFW_WNDCLASSNAME; - - // Load user-provided icon if available - wc.hIcon = LoadIcon(GetModuleHandle(NULL), L"GLFW_ICON"); - if (!wc.hIcon) - { - // No user-provided icon found, load default icon - wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); - } - - classAtom = RegisterClass(&wc); - if (!classAtom) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Win32: Failed to register window class"); - return 0; - } - - return classAtom; -} - // Creates the GLFW window and rendering context // static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int xpos, ypos, fullWidth, fullHeight; @@ -818,6 +645,9 @@ static int createWindow(_GLFWwindow* window, { window->win32.dwStyle |= WS_POPUP; + // NOTE: This window placement is temporary and approximate, as the + // correct position and size cannot be known until the monitor + // video mode has been set _glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos); fullWidth = wndconfig->width; fullHeight = wndconfig->height; @@ -841,8 +671,8 @@ static int createWindow(_GLFWwindow* window, ypos = CW_USEDEFAULT; getFullWindowSize(window, - wndconfig->width, wndconfig->height, - &fullWidth, &fullHeight); + wndconfig->width, wndconfig->height, + &fullWidth, &fullHeight); } wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title); @@ -853,16 +683,16 @@ static int createWindow(_GLFWwindow* window, return GL_FALSE; } - window->win32.handle = CreateWindowEx(window->win32.dwExStyle, - _GLFW_WNDCLASSNAME, - wideTitle, - window->win32.dwStyle, - xpos, ypos, - fullWidth, fullHeight, - NULL, // No parent window - NULL, // No window menu - GetModuleHandle(NULL), - window); // Pass object to WM_CREATE + window->win32.handle = CreateWindowExW(window->win32.dwExStyle, + _GLFW_WNDCLASSNAME, + wideTitle, + window->win32.dwStyle, + xpos, ypos, + fullWidth, fullHeight, + NULL, // No parent window + NULL, // No window menu + GetModuleHandleW(NULL), + window); // Pass object to WM_CREATE free(wideTitle); @@ -872,7 +702,27 @@ static int createWindow(_GLFWwindow* window, return GL_FALSE; } - if (!_glfwCreateContext(window, wndconfig, fbconfig)) + if (_glfw_ChangeWindowMessageFilterEx) + { + _glfw_ChangeWindowMessageFilterEx(window->win32.handle, + WM_DROPFILES, MSGFLT_ALLOW, NULL); + _glfw_ChangeWindowMessageFilterEx(window->win32.handle, + WM_COPYDATA, MSGFLT_ALLOW, NULL); + _glfw_ChangeWindowMessageFilterEx(window->win32.handle, + WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); + } + + if (wndconfig->floating && !wndconfig->monitor) + { + SetWindowPos(window->win32.handle, + HWND_TOPMOST, + 0, 0, 0, 0, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); + } + + DragAcceptFiles(window->win32.handle, TRUE); + + if (!_glfwCreateContext(window, ctxconfig, fbconfig)) return GL_FALSE; return GL_TRUE; @@ -892,27 +742,67 @@ static void destroyWindow(_GLFWwindow* window) } +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +// Registers the GLFW window class +// +GLboolean _glfwRegisterWindowClass(void) +{ + WNDCLASSW wc; + + wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; + wc.lpfnWndProc = (WNDPROC) windowProc; + wc.cbClsExtra = 0; // No extra class data + wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer + wc.hInstance = GetModuleHandleW(NULL); + wc.hCursor = LoadCursorW(NULL, IDC_ARROW); + wc.hbrBackground = NULL; // No background + wc.lpszMenuName = NULL; // No menu + wc.lpszClassName = _GLFW_WNDCLASSNAME; + + // Load user-provided icon if available + wc.hIcon = LoadIconW(GetModuleHandleW(NULL), L"GLFW_ICON"); + if (!wc.hIcon) + { + // No user-provided icon found, load default icon + wc.hIcon = LoadIconW(NULL, IDI_WINLOGO); + } + + if (!RegisterClassW(&wc)) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to register window class"); + return GL_FALSE; + } + + return GL_TRUE; +} + +// Unregisters the GLFW window class +// +void _glfwUnregisterWindowClass(void) +{ + UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL)); +} + + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { int status; - if (!_glfw.win32.classAtom) - { - _glfw.win32.classAtom = registerWindowClass(); - if (!_glfw.win32.classAtom) - return GL_FALSE; - } - - if (!createWindow(window, wndconfig, fbconfig)) + if (!createWindow(window, wndconfig, ctxconfig, fbconfig)) return GL_FALSE; - status = _glfwAnalyzeContext(window, wndconfig, fbconfig); + status = _glfwAnalyzeContext(window, ctxconfig, fbconfig); if (status == _GLFW_RECREATION_IMPOSSIBLE) return GL_FALSE; @@ -944,19 +834,15 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, destroyWindow(window); // ...and then create them again, this time with better APIs - if (!createWindow(window, wndconfig, fbconfig)) + if (!createWindow(window, wndconfig, ctxconfig, fbconfig)) return GL_FALSE; } if (window->monitor) { - if (!_glfwSetVideoMode(window->monitor, &window->videoMode)) - return GL_FALSE; - - // Place the window above all topmost windows _glfwPlatformShowWindow(window); - SetWindowPos(window->win32.handle, HWND_TOPMOST, 0,0,0,0, - SWP_NOMOVE | SWP_NOSIZE); + if (!enterFullscreenMode(window)) + return GL_FALSE; } return GL_TRUE; @@ -964,10 +850,10 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, void _glfwPlatformDestroyWindow(_GLFWwindow* window) { - destroyWindow(window); - if (window->monitor) - _glfwRestoreVideoMode(window->monitor); + leaveFullscreenMode(window); + + destroyWindow(window); } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) @@ -980,7 +866,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) return; } - SetWindowText(window->win32.handle, wideTitle); + SetWindowTextW(window->win32.handle, wideTitle); free(wideTitle); } @@ -1018,15 +904,7 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { if (window->monitor) - { - GLFWvidmode mode; - _glfwSetVideoMode(window->monitor, &window->videoMode); - _glfwPlatformGetVideoMode(window->monitor, &mode); - - SetWindowPos(window->win32.handle, HWND_TOP, - 0, 0, mode.width, mode.height, - SWP_NOMOVE); - } + enterFullscreenMode(window); else { int fullWidth, fullHeight; @@ -1043,6 +921,28 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* heigh _glfwPlatformGetWindowSize(window, width, height); } +void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + int* left, int* top, + int* right, int* bottom) +{ + RECT rect; + int width, height; + + _glfwPlatformGetWindowSize(window, &width, &height); + SetRect(&rect, 0, 0, width, height); + AdjustWindowRectEx(&rect, window->win32.dwStyle, + FALSE, window->win32.dwExStyle); + + if (left) + *left = -rect.left; + if (top) + *top = -rect.top; + if (right) + *right = rect.right - width; + if (bottom) + *bottom = rect.bottom - height; +} + void _glfwPlatformIconifyWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_MINIMIZE); @@ -1055,27 +955,49 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) void _glfwPlatformShowWindow(_GLFWwindow* window) { - ShowWindow(window->win32.handle, SW_SHOWNORMAL); + ShowWindow(window->win32.handle, SW_SHOW); BringWindowToTop(window->win32.handle); SetForegroundWindow(window->win32.handle); SetFocus(window->win32.handle); } +void _glfwPlatformUnhideWindow(_GLFWwindow* window) +{ + ShowWindow(window->win32.handle, SW_SHOW); +} + void _glfwPlatformHideWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_HIDE); } +int _glfwPlatformWindowFocused(_GLFWwindow* window) +{ + return window->win32.handle == GetActiveWindow(); +} + +int _glfwPlatformWindowIconified(_GLFWwindow* window) +{ + return IsIconic(window->win32.handle); +} + +int _glfwPlatformWindowVisible(_GLFWwindow* window) +{ + return IsWindowVisible(window->win32.handle); +} + void _glfwPlatformPollEvents(void) { MSG msg; _GLFWwindow* window; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { // Treat WM_QUIT as a close on all windows + // While GLFW does not itself post WM_QUIT, other processes may post + // it to this one, for example Task Manager window = _glfw.windowListHead; while (window) @@ -1087,7 +1009,7 @@ void _glfwPlatformPollEvents(void) else { TranslateMessage(&msg); - DispatchMessage(&msg); + DispatchMessageW(&msg); } } @@ -1106,21 +1028,19 @@ void _glfwPlatformPollEvents(void) // See if this differs from our belief of what has happened // (we only have to check for lost key up events) - if (!lshiftDown && window->key[GLFW_KEY_LEFT_SHIFT] == 1) + if (!lshiftDown && window->keys[GLFW_KEY_LEFT_SHIFT] == 1) _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, 0, GLFW_RELEASE, mods); - if (!rshiftDown && window->key[GLFW_KEY_RIGHT_SHIFT] == 1) + if (!rshiftDown && window->keys[GLFW_KEY_RIGHT_SHIFT] == 1) _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods); } - // Did the cursor move in an focused window that has captured the cursor - if (window->cursorMode == GLFW_CURSOR_DISABLED && - !window->win32.cursorCentered) + // Did the cursor move in an focused window that has disabled the cursor + if (window->cursorMode == GLFW_CURSOR_DISABLED) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); - _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0); - window->win32.cursorCentered = GL_TRUE; + _glfwPlatformSetCursorPos(window, width / 2, height / 2); } } } @@ -1132,32 +1052,252 @@ void _glfwPlatformWaitEvents(void) _glfwPlatformPollEvents(); } +void _glfwPlatformPostEmptyEvent(void) +{ + _GLFWwindow* window = _glfw.windowListHead; + PostMessage(window->win32.handle, WM_NULL, 0, 0); +} + +void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) +{ + POINT pos; + + if (GetCursorPos(&pos)) + { + ScreenToClient(window->win32.handle, &pos); + + if (xpos) + *xpos = pos.x; + if (ypos) + *ypos = pos.y; + } +} + void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos) { POINT pos = { (int) xpos, (int) ypos }; + + // Store the new position so it can be recognized later + window->win32.cursorPosX = pos.x; + window->win32.cursorPosY = pos.y; + ClientToScreen(window->win32.handle, &pos); SetCursorPos(pos.x, pos.y); - - window->win32.oldCursorX = (int) xpos; - window->win32.oldCursorY = (int) ypos; } -void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) +void _glfwPlatformApplyCursorMode(_GLFWwindow* window) { - switch (mode) + switch (window->cursorMode) { case GLFW_CURSOR_NORMAL: - showCursor(window); + restoreCursor(window); break; case GLFW_CURSOR_HIDDEN: hideCursor(window); break; case GLFW_CURSOR_DISABLED: - captureCursor(window); + disableCursor(window); break; } } +int _glfwPlatformCreateCursor(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) +{ + HDC dc; + HBITMAP bitmap, mask; + BITMAPV5HEADER bi; + ICONINFO ii; + DWORD* target = 0; + BYTE* source = (BYTE*) image->pixels; + int i; + + ZeroMemory(&bi, sizeof(bi)); + bi.bV5Size = sizeof(BITMAPV5HEADER); + bi.bV5Width = image->width; + bi.bV5Height = -image->height; + bi.bV5Planes = 1; + bi.bV5BitCount = 32; + bi.bV5Compression = BI_BITFIELDS; + bi.bV5RedMask = 0x00ff0000; + bi.bV5GreenMask = 0x0000ff00; + bi.bV5BlueMask = 0x000000ff; + bi.bV5AlphaMask = 0xff000000; + + dc = GetDC(NULL); + bitmap = CreateDIBSection(dc, (BITMAPINFO*) &bi, DIB_RGB_COLORS, + (void**) &target, NULL, (DWORD) 0); + ReleaseDC(NULL, dc); + + if (!bitmap) + return GL_FALSE; + + mask = CreateBitmap(image->width, image->height, 1, 1, NULL); + if (!mask) + { + DeleteObject(bitmap); + return GL_FALSE; + } + + for (i = 0; i < image->width * image->height; i++, target++, source += 4) + { + *target = (source[3] << 24) | + (source[0] << 16) | + (source[1] << 8) | + source[2]; + } + + ZeroMemory(&ii, sizeof(ii)); + ii.fIcon = FALSE; + ii.xHotspot = xhot; + ii.yHotspot = yhot; + ii.hbmMask = mask; + ii.hbmColor = bitmap; + + cursor->win32.handle = (HCURSOR) CreateIconIndirect(&ii); + + DeleteObject(bitmap); + DeleteObject(mask); + + if (!cursor->win32.handle) + return GL_FALSE; + + return GL_TRUE; +} + +int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) +{ + LPCWSTR native = translateCursorShape(shape); + if (!native) + { + _glfwInputError(GLFW_INVALID_ENUM, "Win32: Invalid standard cursor"); + return GL_FALSE; + } + + cursor->win32.handle = CopyCursor(LoadCursorW(NULL, native)); + if (!cursor->win32.handle) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to retrieve shared cursor"); + return GL_FALSE; + } + + return GL_TRUE; +} + +void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) +{ + if (cursor->win32.handle) + DestroyIcon((HICON) cursor->win32.handle); +} + +void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) +{ + // It should be guaranteed that the cursor is not being used by this window if + // the following condition is not met. That way it should be safe to destroy the + // cursor after calling glfwSetCursor(window, NULL) on all windows using the cursor. + + if (_glfw.focusedWindow == window && + window->cursorMode == GLFW_CURSOR_NORMAL && + window->win32.cursorInside) + { + if (cursor) + SetCursor(cursor->win32.handle); + else + SetCursor(LoadCursorW(NULL, IDC_ARROW)); + } +} + +void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) +{ + WCHAR* wideString; + HANDLE stringHandle; + size_t wideSize; + + wideString = _glfwCreateWideStringFromUTF8(string); + if (!wideString) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to convert clipboard string to " + "wide string"); + return; + } + + wideSize = (wcslen(wideString) + 1) * sizeof(WCHAR); + + stringHandle = GlobalAlloc(GMEM_MOVEABLE, wideSize); + if (!stringHandle) + { + free(wideString); + + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to allocate global handle for clipboard"); + return; + } + + memcpy(GlobalLock(stringHandle), wideString, wideSize); + GlobalUnlock(stringHandle); + + if (!OpenClipboard(window->win32.handle)) + { + GlobalFree(stringHandle); + free(wideString); + + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); + return; + } + + EmptyClipboard(); + SetClipboardData(CF_UNICODETEXT, stringHandle); + CloseClipboard(); + + free(wideString); +} + +const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) +{ + HANDLE stringHandle; + + if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) + { + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL); + return NULL; + } + + if (!OpenClipboard(window->win32.handle)) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard"); + return NULL; + } + + stringHandle = GetClipboardData(CF_UNICODETEXT); + if (!stringHandle) + { + CloseClipboard(); + + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to retrieve clipboard data"); + return NULL; + } + + free(_glfw.win32.clipboardString); + _glfw.win32.clipboardString = + _glfwCreateUTF8FromWideString(GlobalLock(stringHandle)); + + GlobalUnlock(stringHandle); + CloseClipboard(); + + if (!_glfw.win32.clipboardString) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Win32: Failed to convert wide string to UTF-8"); + return NULL; + } + + return _glfw.win32.clipboardString; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// diff --git a/extern/glfw/src/window.c b/extern/glfw/src/window.c index 4e2b277..4a46a6e 100644 --- a/extern/glfw/src/window.c +++ b/extern/glfw/src/window.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 - www.glfw.org +// GLFW 3.1 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -30,17 +30,6 @@ #include #include -#if defined(_MSC_VER) - #include -#endif - - -// Return the maxiumum of the specified values -// -static int Max(int a, int b) -{ - return (a > b) ? a : b; -} ////////////////////////////////////////////////////////////////////////// @@ -51,38 +40,32 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused) { if (focused) { - if (_glfw.focusedWindow != window) - { - _glfw.focusedWindow = window; + _glfw.focusedWindow = window; - if (window->callbacks.focus) - window->callbacks.focus((GLFWwindow*) window, focused); - } + if (window->callbacks.focus) + window->callbacks.focus((GLFWwindow*) window, focused); } else { - if (_glfw.focusedWindow == window) + int i; + + _glfw.focusedWindow = NULL; + + if (window->callbacks.focus) + window->callbacks.focus((GLFWwindow*) window, focused); + + // Release all pressed keyboard keys + for (i = 0; i <= GLFW_KEY_LAST; i++) { - int i; + if (window->keys[i] == GLFW_PRESS) + _glfwInputKey(window, i, 0, GLFW_RELEASE, 0); + } - _glfw.focusedWindow = NULL; - - if (window->callbacks.focus) - window->callbacks.focus((GLFWwindow*) window, focused); - - // Release all pressed keyboard keys - for (i = 0; i <= GLFW_KEY_LAST; i++) - { - if (window->key[i] == GLFW_PRESS) - _glfwInputKey(window, i, 0, GLFW_RELEASE, 0); - } - - // Release all pressed mouse buttons - for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) - { - if (window->mouseButton[i] == GLFW_PRESS) - _glfwInputMouseClick(window, i, GLFW_RELEASE, 0); - } + // Release all pressed mouse buttons + for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++) + { + if (window->mouseButtons[i] == GLFW_PRESS) + _glfwInputMouseClick(window, i, GLFW_RELEASE, 0); } } } @@ -101,11 +84,6 @@ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height) void _glfwInputWindowIconify(_GLFWwindow* window, int iconified) { - if (window->iconified == iconified) - return; - - window->iconified = iconified; - if (window->callbacks.iconify) window->callbacks.iconify((GLFWwindow*) window, iconified); } @@ -116,11 +94,6 @@ void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height) window->callbacks.fbsize((GLFWwindow*) window, width, height); } -void _glfwInputWindowVisibility(_GLFWwindow* window, int visible) -{ - window->visible = visible; -} - void _glfwInputWindowDamage(_GLFWwindow* window) { if (window->callbacks.refresh) @@ -146,6 +119,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, GLFWwindow* share) { _GLFWfbconfig fbconfig; + _GLFWctxconfig ctxconfig; _GLFWwndconfig wndconfig; _GLFWwindow* window; _GLFWwindow* previous; @@ -159,20 +133,21 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, } // Set up desired framebuffer config - fbconfig.redBits = Max(_glfw.hints.redBits, 0); - fbconfig.greenBits = Max(_glfw.hints.greenBits, 0); - fbconfig.blueBits = Max(_glfw.hints.blueBits, 0); - fbconfig.alphaBits = Max(_glfw.hints.alphaBits, 0); - fbconfig.depthBits = Max(_glfw.hints.depthBits, 0); - fbconfig.stencilBits = Max(_glfw.hints.stencilBits, 0); - fbconfig.accumRedBits = Max(_glfw.hints.accumRedBits, 0); - fbconfig.accumGreenBits = Max(_glfw.hints.accumGreenBits, 0); - fbconfig.accumBlueBits = Max(_glfw.hints.accumBlueBits, 0); - fbconfig.accumAlphaBits = Max(_glfw.hints.accumAlphaBits, 0); - fbconfig.auxBuffers = Max(_glfw.hints.auxBuffers, 0); + fbconfig.redBits = _glfw.hints.redBits; + fbconfig.greenBits = _glfw.hints.greenBits; + fbconfig.blueBits = _glfw.hints.blueBits; + fbconfig.alphaBits = _glfw.hints.alphaBits; + fbconfig.depthBits = _glfw.hints.depthBits; + fbconfig.stencilBits = _glfw.hints.stencilBits; + fbconfig.accumRedBits = _glfw.hints.accumRedBits; + fbconfig.accumGreenBits = _glfw.hints.accumGreenBits; + fbconfig.accumBlueBits = _glfw.hints.accumBlueBits; + fbconfig.accumAlphaBits = _glfw.hints.accumAlphaBits; + fbconfig.auxBuffers = _glfw.hints.auxBuffers; fbconfig.stereo = _glfw.hints.stereo ? GL_TRUE : GL_FALSE; - fbconfig.samples = Max(_glfw.hints.samples, 0); - fbconfig.sRGB = _glfw.hints.sRGB ? GL_TRUE : GL_FALSE; + fbconfig.samples = _glfw.hints.samples; + fbconfig.sRGB = _glfw.hints.sRGB; + fbconfig.doublebuffer = _glfw.hints.doublebuffer ? GL_TRUE : GL_FALSE; // Set up desired window config wndconfig.width = width; @@ -181,18 +156,24 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE; wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE; wndconfig.decorated = _glfw.hints.decorated ? GL_TRUE : GL_FALSE; - wndconfig.clientAPI = _glfw.hints.clientAPI; - wndconfig.glMajor = _glfw.hints.glMajor; - wndconfig.glMinor = _glfw.hints.glMinor; - wndconfig.glForward = _glfw.hints.glForward ? GL_TRUE : GL_FALSE; - wndconfig.glDebug = _glfw.hints.glDebug ? GL_TRUE : GL_FALSE; - wndconfig.glProfile = _glfw.hints.glProfile; - wndconfig.glRobustness = _glfw.hints.glRobustness; + wndconfig.focused = _glfw.hints.focused ? GL_TRUE : GL_FALSE; + wndconfig.autoIconify = _glfw.hints.autoIconify ? GL_TRUE : GL_FALSE; + wndconfig.floating = _glfw.hints.floating ? GL_TRUE : GL_FALSE; wndconfig.monitor = (_GLFWmonitor*) monitor; - wndconfig.share = (_GLFWwindow*) share; + + // Set up desired context config + ctxconfig.api = _glfw.hints.api; + ctxconfig.major = _glfw.hints.major; + ctxconfig.minor = _glfw.hints.minor; + ctxconfig.forward = _glfw.hints.forward ? GL_TRUE : GL_FALSE; + ctxconfig.debug = _glfw.hints.debug ? GL_TRUE : GL_FALSE; + ctxconfig.profile = _glfw.hints.profile; + ctxconfig.robustness = _glfw.hints.robustness; + ctxconfig.release = _glfw.hints.release; + ctxconfig.share = (_GLFWwindow*) share; // Check the OpenGL bits of the window config - if (!_glfwIsValidContextConfig(&wndconfig)) + if (!_glfwIsValidContextConfig(&ctxconfig)) return NULL; window = calloc(1, sizeof(_GLFWwindow)); @@ -203,47 +184,52 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, { wndconfig.resizable = GL_TRUE; wndconfig.visible = GL_TRUE; + wndconfig.focused = GL_TRUE; // Set up desired video mode window->videoMode.width = width; window->videoMode.height = height; - window->videoMode.redBits = Max(_glfw.hints.redBits, 0); - window->videoMode.greenBits = Max(_glfw.hints.greenBits, 0); - window->videoMode.blueBits = Max(_glfw.hints.blueBits, 0); - window->videoMode.refreshRate = Max(_glfw.hints.refreshRate, 0); + window->videoMode.redBits = _glfw.hints.redBits; + window->videoMode.greenBits = _glfw.hints.greenBits; + window->videoMode.blueBits = _glfw.hints.blueBits; + window->videoMode.refreshRate = _glfw.hints.refreshRate; } - window->monitor = wndconfig.monitor; - window->resizable = wndconfig.resizable; - window->decorated = wndconfig.decorated; - window->cursorMode = GLFW_CURSOR_NORMAL; + // Transfer window hints that are persistent settings and not + // just initial states + window->monitor = wndconfig.monitor; + window->resizable = wndconfig.resizable; + window->decorated = wndconfig.decorated; + window->autoIconify = wndconfig.autoIconify; + window->floating = wndconfig.floating; + window->cursorMode = GLFW_CURSOR_NORMAL; // Save the currently current context so it can be restored later - previous = (_GLFWwindow*) glfwGetCurrentContext(); + previous = _glfwPlatformGetCurrentContext(); // Open the actual window and create its context - if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig)) + if (!_glfwPlatformCreateWindow(window, &wndconfig, &ctxconfig, &fbconfig)) { glfwDestroyWindow((GLFWwindow*) window); - glfwMakeContextCurrent((GLFWwindow*) previous); + _glfwPlatformMakeContextCurrent(previous); return NULL; } - glfwMakeContextCurrent((GLFWwindow*) window); + _glfwPlatformMakeContextCurrent(window); // Retrieve the actual (as opposed to requested) context attributes - if (!_glfwRefreshContextAttribs()) + if (!_glfwRefreshContextAttribs(&ctxconfig)) { glfwDestroyWindow((GLFWwindow*) window); - glfwMakeContextCurrent((GLFWwindow*) previous); + _glfwPlatformMakeContextCurrent(previous); return NULL; } // Verify the context against the requested parameters - if (!_glfwIsValidContext(&wndconfig)) + if (!_glfwIsValidContext(&ctxconfig)) { glfwDestroyWindow((GLFWwindow*) window); - glfwMakeContextCurrent((GLFWwindow*) previous); + _glfwPlatformMakeContextCurrent(previous); return NULL; } @@ -253,10 +239,28 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, _glfwPlatformSwapBuffers(window); // Restore the previously current context (or NULL) - glfwMakeContextCurrent((GLFWwindow*) previous); + _glfwPlatformMakeContextCurrent(previous); - if (wndconfig.monitor == NULL && wndconfig.visible) - glfwShowWindow((GLFWwindow*) window); + if (wndconfig.monitor) + { + int width, height; + _glfwPlatformGetWindowSize(window, &width, &height); + + window->cursorPosX = width / 2; + window->cursorPosY = height / 2; + + _glfwPlatformSetCursorPos(window, window->cursorPosX, window->cursorPosY); + } + else + { + if (wndconfig.visible) + { + if (wndconfig.focused) + _glfwPlatformShowWindow(window); + else + _glfwPlatformUnhideWindow(window); + } + } return (GLFWwindow*) window; } @@ -268,22 +272,29 @@ void glfwDefaultWindowHints(void) memset(&_glfw.hints, 0, sizeof(_glfw.hints)); // The default is OpenGL with minimum version 1.0 - _glfw.hints.clientAPI = GLFW_OPENGL_API; - _glfw.hints.glMajor = 1; - _glfw.hints.glMinor = 0; + _glfw.hints.api = GLFW_OPENGL_API; + _glfw.hints.major = 1; + _glfw.hints.minor = 0; - // The default is a visible, resizable window with decorations - _glfw.hints.resizable = GL_TRUE; - _glfw.hints.visible = GL_TRUE; - _glfw.hints.decorated = GL_TRUE; + // The default is a focused, visible, resizable window with decorations + _glfw.hints.resizable = GL_TRUE; + _glfw.hints.visible = GL_TRUE; + _glfw.hints.decorated = GL_TRUE; + _glfw.hints.focused = GL_TRUE; + _glfw.hints.autoIconify = GL_TRUE; - // The default is 24 bits of color, 24 bits of depth and 8 bits of stencil - _glfw.hints.redBits = 8; - _glfw.hints.greenBits = 8; - _glfw.hints.blueBits = 8; - _glfw.hints.alphaBits = 8; - _glfw.hints.depthBits = 24; - _glfw.hints.stencilBits = 8; + // The default is to select the highest available refresh rate + _glfw.hints.refreshRate = GLFW_DONT_CARE; + + // The default is 24 bits of color, 24 bits of depth and 8 bits of stencil, + // double buffered + _glfw.hints.redBits = 8; + _glfw.hints.greenBits = 8; + _glfw.hints.blueBits = 8; + _glfw.hints.alphaBits = 8; + _glfw.hints.depthBits = 24; + _glfw.hints.stencilBits = 8; + _glfw.hints.doublebuffer = GL_TRUE; } GLFWAPI void glfwWindowHint(int target, int hint) @@ -331,12 +342,24 @@ GLFWAPI void glfwWindowHint(int target, int hint) case GLFW_REFRESH_RATE: _glfw.hints.refreshRate = hint; break; + case GLFW_DOUBLEBUFFER: + _glfw.hints.doublebuffer = hint; + break; case GLFW_RESIZABLE: _glfw.hints.resizable = hint; break; case GLFW_DECORATED: _glfw.hints.decorated = hint; break; + case GLFW_FOCUSED: + _glfw.hints.focused = hint; + break; + case GLFW_AUTO_ICONIFY: + _glfw.hints.autoIconify = hint; + break; + case GLFW_FLOATING: + _glfw.hints.floating = hint; + break; case GLFW_VISIBLE: _glfw.hints.visible = hint; break; @@ -347,25 +370,28 @@ GLFWAPI void glfwWindowHint(int target, int hint) _glfw.hints.sRGB = hint; break; case GLFW_CLIENT_API: - _glfw.hints.clientAPI = hint; + _glfw.hints.api = hint; break; case GLFW_CONTEXT_VERSION_MAJOR: - _glfw.hints.glMajor = hint; + _glfw.hints.major = hint; break; case GLFW_CONTEXT_VERSION_MINOR: - _glfw.hints.glMinor = hint; + _glfw.hints.minor = hint; break; case GLFW_CONTEXT_ROBUSTNESS: - _glfw.hints.glRobustness = hint; + _glfw.hints.robustness = hint; break; case GLFW_OPENGL_FORWARD_COMPAT: - _glfw.hints.glForward = hint; + _glfw.hints.forward = hint; break; case GLFW_OPENGL_DEBUG_CONTEXT: - _glfw.hints.glDebug = hint; + _glfw.hints.debug = hint; break; case GLFW_OPENGL_PROFILE: - _glfw.hints.glProfile = hint; + _glfw.hints.profile = hint; + break; + case GLFW_CONTEXT_RELEASE_BEHAVIOR: + _glfw.hints.release = hint; break; default: _glfwInputError(GLFW_INVALID_ENUM, NULL); @@ -392,7 +418,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* handle) _glfwPlatformMakeContextCurrent(NULL); // Clear the focused window pointer if this is the focused window - if (window == _glfw.focusedWindow) + if (_glfw.focusedWindow == window) _glfw.focusedWindow = NULL; _glfwPlatformDestroyWindow(window); @@ -434,6 +460,12 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title) GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos) { _GLFWwindow* window = (_GLFWwindow*) handle; + + if (xpos) + *xpos = 0; + if (ypos) + *ypos = 0; + _GLFW_REQUIRE_INIT(); _glfwPlatformGetWindowPos(window, xpos, ypos); } @@ -447,7 +479,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos) if (window->monitor) { _glfwInputError(GLFW_INVALID_VALUE, - "Fullscreen windows cannot be positioned"); + "Full screen windows cannot be positioned"); return; } @@ -457,6 +489,12 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos) GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height) { _GLFWwindow* window = (_GLFWwindow*) handle; + + if (width) + *width = 0; + if (height) + *height = 0; + _GLFW_REQUIRE_INIT(); _glfwPlatformGetWindowSize(window, width, height); } @@ -467,9 +505,6 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height) _GLFW_REQUIRE_INIT(); - if (window->iconified) - return; - if (window->monitor) { window->videoMode.width = width; @@ -483,32 +518,45 @@ GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT(); + if (width) + *width = 0; + if (height) + *height = 0; + _GLFW_REQUIRE_INIT(); _glfwPlatformGetFramebufferSize(window, width, height); } +GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle, + int* left, int* top, + int* right, int* bottom) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + + if (left) + *left = 0; + if (top) + *top = 0; + if (right) + *right = 0; + if (bottom) + *bottom = 0; + + _GLFW_REQUIRE_INIT(); + _glfwPlatformGetWindowFrameSize(window, left, top, right, bottom); +} + GLFWAPI void glfwIconifyWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT(); - - if (window->iconified) - return; - _glfwPlatformIconifyWindow(window); } GLFWAPI void glfwRestoreWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; - _GLFW_REQUIRE_INIT(); - - if (!window->iconified) - return; - _glfwPlatformRestoreWindow(window); } @@ -545,31 +593,35 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) switch (attrib) { case GLFW_FOCUSED: - return window == _glfw.focusedWindow; + return _glfwPlatformWindowFocused(window); case GLFW_ICONIFIED: - return window->iconified; + return _glfwPlatformWindowIconified(window); + case GLFW_VISIBLE: + return _glfwPlatformWindowVisible(window); case GLFW_RESIZABLE: return window->resizable; case GLFW_DECORATED: return window->decorated; - case GLFW_VISIBLE: - return window->visible; + case GLFW_FLOATING: + return window->floating; case GLFW_CLIENT_API: - return window->clientAPI; + return window->context.api; case GLFW_CONTEXT_VERSION_MAJOR: - return window->glMajor; + return window->context.major; case GLFW_CONTEXT_VERSION_MINOR: - return window->glMinor; + return window->context.minor; case GLFW_CONTEXT_REVISION: - return window->glRevision; + return window->context.revision; case GLFW_CONTEXT_ROBUSTNESS: - return window->glRobustness; + return window->context.robustness; case GLFW_OPENGL_FORWARD_COMPAT: - return window->glForward; + return window->context.forward; case GLFW_OPENGL_DEBUG_CONTEXT: - return window->glDebug; + return window->context.debug; case GLFW_OPENGL_PROFILE: - return window->glProfile; + return window->context.profile; + case GLFW_CONTEXT_RELEASE_BEHAVIOR: + return window->context.release; } _glfwInputError(GLFW_INVALID_ENUM, NULL); @@ -669,6 +721,20 @@ GLFWAPI void glfwPollEvents(void) GLFWAPI void glfwWaitEvents(void) { _GLFW_REQUIRE_INIT(); + + if (!_glfw.windowListHead) + return; + _glfwPlatformWaitEvents(); } +GLFWAPI void glfwPostEmptyEvent(void) +{ + _GLFW_REQUIRE_INIT(); + + if (!_glfw.windowListHead) + return; + + _glfwPlatformPostEmptyEvent(); +} + diff --git a/extern/glfw/src/win32_joystick.c b/extern/glfw/src/winmm_joystick.c similarity index 83% rename from extern/glfw/src/win32_joystick.c rename to extern/glfw/src/winmm_joystick.c index 1a17236..fcf6d94 100644 --- a/extern/glfw/src/win32_joystick.c +++ b/extern/glfw/src/winmm_joystick.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 Win32 - www.glfw.org +// GLFW 3.1 WinMM - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -34,9 +34,9 @@ ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -// Calculate normalized joystick position +// Convert axis value to the [-1,1] range // -static float calcJoystickPos(DWORD pos, DWORD min, DWORD max) +static float normalizeAxis(DWORD pos, DWORD min, DWORD max) { float fpos = (float) pos; float fmin = (float) min; @@ -63,7 +63,7 @@ void _glfwTerminateJoysticks(void) int i; for (i = 0; i < GLFW_JOYSTICK_LAST; i++) - free(_glfw.win32.joystick[i].name); + free(_glfw.winmm_js[i].name); } @@ -85,7 +85,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count) { JOYCAPS jc; JOYINFOEX ji; - float* axes = _glfw.win32.joystick[joy].axes; + float* axes = _glfw.winmm_js[joy].axes; if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR) return NULL; @@ -96,20 +96,20 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count) if (_glfw_joyGetPosEx(joy, &ji) != JOYERR_NOERROR) return NULL; - axes[(*count)++] = calcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax); - axes[(*count)++] = calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax); + axes[(*count)++] = normalizeAxis(ji.dwXpos, jc.wXmin, jc.wXmax); + axes[(*count)++] = normalizeAxis(ji.dwYpos, jc.wYmin, jc.wYmax); if (jc.wCaps & JOYCAPS_HASZ) - axes[(*count)++] = calcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax); + axes[(*count)++] = normalizeAxis(ji.dwZpos, jc.wZmin, jc.wZmax); if (jc.wCaps & JOYCAPS_HASR) - axes[(*count)++] = calcJoystickPos(ji.dwRpos, jc.wRmin, jc.wRmax); + axes[(*count)++] = normalizeAxis(ji.dwRpos, jc.wRmin, jc.wRmax); if (jc.wCaps & JOYCAPS_HASU) - axes[(*count)++] = calcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax); + axes[(*count)++] = normalizeAxis(ji.dwUpos, jc.wUmin, jc.wUmax); if (jc.wCaps & JOYCAPS_HASV) - axes[(*count)++] = calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax); + axes[(*count)++] = normalizeAxis(ji.dwVpos, jc.wVmin, jc.wVmax); return axes; } @@ -118,7 +118,7 @@ const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) { JOYCAPS jc; JOYINFOEX ji; - unsigned char* buttons = _glfw.win32.joystick[joy].buttons; + unsigned char* buttons = _glfw.winmm_js[joy].buttons; if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR) return NULL; @@ -169,9 +169,9 @@ const char* _glfwPlatformGetJoystickName(int joy) if (_glfw_joyGetDevCaps(joy, &jc, sizeof(JOYCAPS)) != JOYERR_NOERROR) return NULL; - free(_glfw.win32.joystick[joy].name); - _glfw.win32.joystick[joy].name = _glfwCreateUTF8FromWideString(jc.szPname); + free(_glfw.winmm_js[joy].name); + _glfw.winmm_js[joy].name = _glfwCreateUTF8FromWideString(jc.szPname); - return _glfw.win32.joystick[joy].name; + return _glfw.winmm_js[joy].name; } diff --git a/extern/glfw/src/winmm_joystick.h b/extern/glfw/src/winmm_joystick.h new file mode 100644 index 0000000..608f1dc --- /dev/null +++ b/extern/glfw/src/winmm_joystick.h @@ -0,0 +1,47 @@ +//======================================================================== +// GLFW 3.1 WinMM - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2006-2014 Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _winmm_joystick_h_ +#define _winmm_joystick_h_ + +#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ + _GLFWjoystickWinMM winmm_js[GLFW_JOYSTICK_LAST + 1] + + +// WinMM-specific per-joystick data +// +typedef struct _GLFWjoystickWinMM +{ + float axes[6]; + unsigned char buttons[36]; // 32 buttons plus one hat + char* name; +} _GLFWjoystickWinMM; + + +void _glfwInitJoysticks(void); +void _glfwTerminateJoysticks(void); + +#endif // _winmm_joystick_h_ diff --git a/extern/glfw/src/wl_init.c b/extern/glfw/src/wl_init.c new file mode 100644 index 0000000..0269ee3 --- /dev/null +++ b/extern/glfw/src/wl_init.c @@ -0,0 +1,630 @@ +//======================================================================== +// GLFW 3.1 Wayland - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Jonas Ådahl +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xkb_unicode.h" + +static void pointerHandleEnter(void* data, + struct wl_pointer* pointer, + uint32_t serial, + struct wl_surface* surface, + wl_fixed_t sx, + wl_fixed_t sy) +{ + _GLFWwindow* window = wl_surface_get_user_data(surface); + + _glfw.wl.pointerSerial = serial; + _glfw.wl.pointerFocus = window; + + _glfwPlatformSetCursor(window, window->wl.currentCursor); + _glfwInputCursorEnter(window, GL_TRUE); +} + +static void pointerHandleLeave(void* data, + struct wl_pointer* pointer, + uint32_t serial, + struct wl_surface* surface) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + + if (!window) + return; + + _glfw.wl.pointerSerial = serial; + _glfw.wl.pointerFocus = NULL; + _glfwInputCursorEnter(window, GL_FALSE); +} + +static void pointerHandleMotion(void* data, + struct wl_pointer* pointer, + uint32_t time, + wl_fixed_t sx, + wl_fixed_t sy) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + + if (!window) + return; + + if (window->cursorMode == GLFW_CURSOR_DISABLED) + { + /* TODO */ + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: GLFW_CURSOR_DISABLED not supported"); + return; + } + + _glfwInputCursorMotion(window, + wl_fixed_to_double(sx), + wl_fixed_to_double(sy)); +} + +static void pointerHandleButton(void* data, + struct wl_pointer* wl_pointer, + uint32_t serial, + uint32_t time, + uint32_t button, + uint32_t state) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + int glfwButton; + + if (!window) + return; + + /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev + * codes. */ + glfwButton = button - BTN_LEFT; + + _glfwInputMouseClick(window, + glfwButton, + state == WL_POINTER_BUTTON_STATE_PRESSED + ? GLFW_PRESS + : GLFW_RELEASE, + _glfw.wl.xkb.modifiers); +} + +static void pointerHandleAxis(void* data, + struct wl_pointer* wl_pointer, + uint32_t time, + uint32_t axis, + wl_fixed_t value) +{ + _GLFWwindow* window = _glfw.wl.pointerFocus; + double scroll_factor; + double x, y; + + if (!window) + return; + + /* Wayland scroll events are in pointer motion coordinate space (think + * two finger scroll). The factor 10 is commonly used to convert to + * "scroll step means 1.0. */ + scroll_factor = 1.0/10.0; + + switch (axis) + { + case WL_POINTER_AXIS_HORIZONTAL_SCROLL: + x = wl_fixed_to_double(value) * scroll_factor; + y = 0.0; + break; + case WL_POINTER_AXIS_VERTICAL_SCROLL: + x = 0.0; + y = wl_fixed_to_double(value) * scroll_factor; + break; + default: + break; + } + + _glfwInputScroll(window, x, y); +} + +static const struct wl_pointer_listener pointerListener = { + pointerHandleEnter, + pointerHandleLeave, + pointerHandleMotion, + pointerHandleButton, + pointerHandleAxis, +}; + +static void keyboardHandleKeymap(void* data, + struct wl_keyboard* keyboard, + uint32_t format, + int fd, + uint32_t size) +{ + struct xkb_keymap* keymap; + struct xkb_state* state; + char* mapStr; + + if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) + { + close(fd); + return; + } + + mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (mapStr == MAP_FAILED) { + close(fd); + return; + } + + keymap = xkb_map_new_from_string(_glfw.wl.xkb.context, + mapStr, + XKB_KEYMAP_FORMAT_TEXT_V1, + 0); + munmap(mapStr, size); + close(fd); + + if (!keymap) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to compile keymap"); + return; + } + + state = xkb_state_new(keymap); + if (!state) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create XKB state"); + xkb_map_unref(keymap); + return; + } + + xkb_keymap_unref(_glfw.wl.xkb.keymap); + xkb_state_unref(_glfw.wl.xkb.state); + _glfw.wl.xkb.keymap = keymap; + _glfw.wl.xkb.state = state; + + _glfw.wl.xkb.control_mask = + 1 << xkb_map_mod_get_index(_glfw.wl.xkb.keymap, "Control"); + _glfw.wl.xkb.alt_mask = + 1 << xkb_map_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); + _glfw.wl.xkb.shift_mask = + 1 << xkb_map_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); + _glfw.wl.xkb.super_mask = + 1 << xkb_map_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); +} + +static void keyboardHandleEnter(void* data, + struct wl_keyboard* keyboard, + uint32_t serial, + struct wl_surface* surface, + struct wl_array* keys) +{ + _GLFWwindow* window = wl_surface_get_user_data(surface); + + _glfw.wl.keyboardFocus = window; + _glfwInputWindowFocus(window, GL_TRUE); +} + +static void keyboardHandleLeave(void* data, + struct wl_keyboard* keyboard, + uint32_t serial, + struct wl_surface* surface) +{ + _GLFWwindow* window = _glfw.wl.keyboardFocus; + + if (!window) + return; + + _glfw.wl.keyboardFocus = NULL; + _glfwInputWindowFocus(window, GL_FALSE); +} + +static int toGLFWKeyCode(uint32_t key) +{ + switch (key) + { + case KEY_GRAVE: return GLFW_KEY_GRAVE_ACCENT; + case KEY_1: return GLFW_KEY_1; + case KEY_2: return GLFW_KEY_2; + case KEY_3: return GLFW_KEY_3; + case KEY_4: return GLFW_KEY_4; + case KEY_5: return GLFW_KEY_5; + case KEY_6: return GLFW_KEY_6; + case KEY_7: return GLFW_KEY_7; + case KEY_8: return GLFW_KEY_8; + case KEY_9: return GLFW_KEY_9; + case KEY_0: return GLFW_KEY_0; + case KEY_MINUS: return GLFW_KEY_MINUS; + case KEY_EQUAL: return GLFW_KEY_EQUAL; + case KEY_Q: return GLFW_KEY_Q; + case KEY_W: return GLFW_KEY_W; + case KEY_E: return GLFW_KEY_E; + case KEY_R: return GLFW_KEY_R; + case KEY_T: return GLFW_KEY_T; + case KEY_Y: return GLFW_KEY_Y; + case KEY_U: return GLFW_KEY_U; + case KEY_I: return GLFW_KEY_I; + case KEY_O: return GLFW_KEY_O; + case KEY_P: return GLFW_KEY_P; + case KEY_LEFTBRACE: return GLFW_KEY_LEFT_BRACKET; + case KEY_RIGHTBRACE: return GLFW_KEY_RIGHT_BRACKET; + case KEY_A: return GLFW_KEY_A; + case KEY_S: return GLFW_KEY_S; + case KEY_D: return GLFW_KEY_D; + case KEY_F: return GLFW_KEY_F; + case KEY_G: return GLFW_KEY_G; + case KEY_H: return GLFW_KEY_H; + case KEY_J: return GLFW_KEY_J; + case KEY_K: return GLFW_KEY_K; + case KEY_L: return GLFW_KEY_L; + case KEY_SEMICOLON: return GLFW_KEY_SEMICOLON; + case KEY_APOSTROPHE: return GLFW_KEY_APOSTROPHE; + case KEY_Z: return GLFW_KEY_Z; + case KEY_X: return GLFW_KEY_X; + case KEY_C: return GLFW_KEY_C; + case KEY_V: return GLFW_KEY_V; + case KEY_B: return GLFW_KEY_B; + case KEY_N: return GLFW_KEY_N; + case KEY_M: return GLFW_KEY_M; + case KEY_COMMA: return GLFW_KEY_COMMA; + case KEY_DOT: return GLFW_KEY_PERIOD; + case KEY_SLASH: return GLFW_KEY_SLASH; + case KEY_BACKSLASH: return GLFW_KEY_BACKSLASH; + case KEY_ESC: return GLFW_KEY_ESCAPE; + case KEY_TAB: return GLFW_KEY_TAB; + case KEY_LEFTSHIFT: return GLFW_KEY_LEFT_SHIFT; + case KEY_RIGHTSHIFT: return GLFW_KEY_RIGHT_SHIFT; + case KEY_LEFTCTRL: return GLFW_KEY_LEFT_CONTROL; + case KEY_RIGHTCTRL: return GLFW_KEY_RIGHT_CONTROL; + case KEY_LEFTALT: return GLFW_KEY_LEFT_ALT; + case KEY_RIGHTALT: return GLFW_KEY_RIGHT_ALT; + case KEY_LEFTMETA: return GLFW_KEY_LEFT_SUPER; + case KEY_RIGHTMETA: return GLFW_KEY_RIGHT_SUPER; + case KEY_MENU: return GLFW_KEY_MENU; + case KEY_NUMLOCK: return GLFW_KEY_NUM_LOCK; + case KEY_CAPSLOCK: return GLFW_KEY_CAPS_LOCK; + case KEY_PRINT: return GLFW_KEY_PRINT_SCREEN; + case KEY_SCROLLLOCK: return GLFW_KEY_SCROLL_LOCK; + case KEY_PAUSE: return GLFW_KEY_PAUSE; + case KEY_DELETE: return GLFW_KEY_DELETE; + case KEY_BACKSPACE: return GLFW_KEY_BACKSPACE; + case KEY_ENTER: return GLFW_KEY_ENTER; + case KEY_HOME: return GLFW_KEY_HOME; + case KEY_END: return GLFW_KEY_END; + case KEY_PAGEUP: return GLFW_KEY_PAGE_UP; + case KEY_PAGEDOWN: return GLFW_KEY_PAGE_DOWN; + case KEY_INSERT: return GLFW_KEY_INSERT; + case KEY_LEFT: return GLFW_KEY_LEFT; + case KEY_RIGHT: return GLFW_KEY_RIGHT; + case KEY_DOWN: return GLFW_KEY_DOWN; + case KEY_UP: return GLFW_KEY_UP; + case KEY_F1: return GLFW_KEY_F1; + case KEY_F2: return GLFW_KEY_F2; + case KEY_F3: return GLFW_KEY_F3; + case KEY_F4: return GLFW_KEY_F4; + case KEY_F5: return GLFW_KEY_F5; + case KEY_F6: return GLFW_KEY_F6; + case KEY_F7: return GLFW_KEY_F7; + case KEY_F8: return GLFW_KEY_F8; + case KEY_F9: return GLFW_KEY_F9; + case KEY_F10: return GLFW_KEY_F10; + case KEY_F11: return GLFW_KEY_F11; + case KEY_F12: return GLFW_KEY_F12; + case KEY_F13: return GLFW_KEY_F13; + case KEY_F14: return GLFW_KEY_F14; + case KEY_F15: return GLFW_KEY_F15; + case KEY_F16: return GLFW_KEY_F16; + case KEY_F17: return GLFW_KEY_F17; + case KEY_F18: return GLFW_KEY_F18; + case KEY_F19: return GLFW_KEY_F19; + case KEY_F20: return GLFW_KEY_F20; + case KEY_F21: return GLFW_KEY_F21; + case KEY_F22: return GLFW_KEY_F22; + case KEY_F23: return GLFW_KEY_F23; + case KEY_F24: return GLFW_KEY_F24; + case KEY_KPSLASH: return GLFW_KEY_KP_DIVIDE; + case KEY_KPDOT: return GLFW_KEY_KP_MULTIPLY; + case KEY_KPMINUS: return GLFW_KEY_KP_SUBTRACT; + case KEY_KPPLUS: return GLFW_KEY_KP_ADD; + case KEY_KP0: return GLFW_KEY_KP_0; + case KEY_KP1: return GLFW_KEY_KP_1; + case KEY_KP2: return GLFW_KEY_KP_2; + case KEY_KP3: return GLFW_KEY_KP_3; + case KEY_KP4: return GLFW_KEY_KP_4; + case KEY_KP5: return GLFW_KEY_KP_5; + case KEY_KP6: return GLFW_KEY_KP_6; + case KEY_KP7: return GLFW_KEY_KP_7; + case KEY_KP8: return GLFW_KEY_KP_8; + case KEY_KP9: return GLFW_KEY_KP_9; + case KEY_KPCOMMA: return GLFW_KEY_KP_DECIMAL; + case KEY_KPEQUAL: return GLFW_KEY_KP_EQUAL; + case KEY_KPENTER: return GLFW_KEY_KP_ENTER; + default: return GLFW_KEY_UNKNOWN; + } +} + +static void keyboardHandleKey(void* data, + struct wl_keyboard* keyboard, + uint32_t serial, + uint32_t time, + uint32_t key, + uint32_t state) +{ + uint32_t code, num_syms; + long cp; + int keyCode; + int action; + const xkb_keysym_t *syms; + _GLFWwindow* window = _glfw.wl.keyboardFocus; + + if (!window) + return; + + keyCode = toGLFWKeyCode(key); + action = state == WL_KEYBOARD_KEY_STATE_PRESSED + ? GLFW_PRESS : GLFW_RELEASE; + + _glfwInputKey(window, keyCode, key, action, + _glfw.wl.xkb.modifiers); + + code = key + 8; + num_syms = xkb_key_get_syms(_glfw.wl.xkb.state, code, &syms); + + if (num_syms == 1) + { + cp = _glfwKeySym2Unicode(syms[0]); + if (cp != -1) + { + const int mods = _glfw.wl.xkb.modifiers; + const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); + _glfwInputChar(window, cp, mods, plain); + } + } +} + +static void keyboardHandleModifiers(void* data, + struct wl_keyboard* keyboard, + uint32_t serial, + uint32_t modsDepressed, + uint32_t modsLatched, + uint32_t modsLocked, + uint32_t group) +{ + xkb_mod_mask_t mask; + unsigned int modifiers = 0; + + if (!_glfw.wl.xkb.keymap) + return; + + xkb_state_update_mask(_glfw.wl.xkb.state, + modsDepressed, + modsLatched, + modsLocked, + 0, + 0, + group); + + mask = xkb_state_serialize_mods(_glfw.wl.xkb.state, + XKB_STATE_DEPRESSED | + XKB_STATE_LATCHED); + if (mask & _glfw.wl.xkb.control_mask) + modifiers |= GLFW_MOD_CONTROL; + if (mask & _glfw.wl.xkb.alt_mask) + modifiers |= GLFW_MOD_ALT; + if (mask & _glfw.wl.xkb.shift_mask) + modifiers |= GLFW_MOD_SHIFT; + if (mask & _glfw.wl.xkb.super_mask) + modifiers |= GLFW_MOD_SUPER; + _glfw.wl.xkb.modifiers = modifiers; +} + +static const struct wl_keyboard_listener keyboardListener = { + keyboardHandleKeymap, + keyboardHandleEnter, + keyboardHandleLeave, + keyboardHandleKey, + keyboardHandleModifiers, +}; + +static void seatHandleCapabilities(void* data, + struct wl_seat* seat, + enum wl_seat_capability caps) +{ + if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer) + { + _glfw.wl.pointer = wl_seat_get_pointer(seat); + wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL); + } + else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer) + { + wl_pointer_destroy(_glfw.wl.pointer); + _glfw.wl.pointer = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard) + { + _glfw.wl.keyboard = wl_seat_get_keyboard(seat); + wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, NULL); + } + else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard) + { + wl_keyboard_destroy(_glfw.wl.keyboard); + _glfw.wl.keyboard = NULL; + } +} + +static const struct wl_seat_listener seatListener = { + seatHandleCapabilities +}; + +static void registryHandleGlobal(void* data, + struct wl_registry* registry, + uint32_t name, + const char* interface, + uint32_t version) +{ + if (strcmp(interface, "wl_compositor") == 0) + { + _glfw.wl.compositor = + wl_registry_bind(registry, name, &wl_compositor_interface, 1); + } + else if (strcmp(interface, "wl_shm") == 0) + { + _glfw.wl.shm = + wl_registry_bind(registry, name, &wl_shm_interface, 1); + } + else if (strcmp(interface, "wl_shell") == 0) + { + _glfw.wl.shell = + wl_registry_bind(registry, name, &wl_shell_interface, 1); + } + else if (strcmp(interface, "wl_output") == 0) + { + _glfwAddOutput(name, version); + } + else if (strcmp(interface, "wl_seat") == 0) + { + if (!_glfw.wl.seat) + { + _glfw.wl.seat = + wl_registry_bind(registry, name, &wl_seat_interface, 1); + wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL); + } + } +} + +static void registryHandleGlobalRemove(void *data, + struct wl_registry *registry, + uint32_t name) +{ +} + + +static const struct wl_registry_listener registryListener = { + registryHandleGlobal, + registryHandleGlobalRemove +}; + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwPlatformInit(void) +{ + _glfw.wl.display = wl_display_connect(NULL); + if (!_glfw.wl.display) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to connect to display"); + return GL_FALSE; + } + + _glfw.wl.registry = wl_display_get_registry(_glfw.wl.display); + wl_registry_add_listener(_glfw.wl.registry, ®istryListener, NULL); + + _glfw.wl.monitors = calloc(4, sizeof(_GLFWmonitor*)); + _glfw.wl.monitorsSize = 4; + + _glfw.wl.xkb.context = xkb_context_new(0); + if (!_glfw.wl.xkb.context) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to initialize xkb context"); + return GL_FALSE; + } + + // Sync so we got all registry objects + wl_display_roundtrip(_glfw.wl.display); + + // Sync so we got all initial output events + wl_display_roundtrip(_glfw.wl.display); + + if (!_glfwInitContextAPI()) + return GL_FALSE; + + _glfwInitTimer(); + _glfwInitJoysticks(); + + if (_glfw.wl.pointer && _glfw.wl.shm) + { + _glfw.wl.cursorTheme = wl_cursor_theme_load(NULL, 32, _glfw.wl.shm); + if (!_glfw.wl.cursorTheme) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Unable to load default cursor theme\n"); + 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 GL_TRUE; +} + +void _glfwPlatformTerminate(void) +{ + _glfwTerminateContextAPI(); + _glfwTerminateJoysticks(); + + if (_glfw.wl.cursorTheme) + wl_cursor_theme_destroy(_glfw.wl.cursorTheme); + if (_glfw.wl.cursorSurface) + wl_surface_destroy(_glfw.wl.cursorSurface); + if (_glfw.wl.registry) + wl_registry_destroy(_glfw.wl.registry); + if (_glfw.wl.display) + wl_display_flush(_glfw.wl.display); + if (_glfw.wl.display) + wl_display_disconnect(_glfw.wl.display); +} + +const char* _glfwPlatformGetVersionString(void) +{ + const char* version = _GLFW_VERSION_NUMBER " Wayland EGL " +#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) + " clock_gettime" +#endif +#if defined(_GLFW_BUILD_DLL) + " shared" +#endif + ; + + return version; +} + diff --git a/extern/glfw/src/wl_monitor.c b/extern/glfw/src/wl_monitor.c new file mode 100644 index 0000000..fbcefd3 --- /dev/null +++ b/extern/glfw/src/wl_monitor.c @@ -0,0 +1,250 @@ +//======================================================================== +// GLFW 3.1 Wayland - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Jonas Ådahl +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#include "internal.h" + +#include +#include +#include +#include + + +struct _GLFWvidmodeWayland +{ + GLFWvidmode base; + uint32_t flags; +}; + +static void geometry(void* data, + struct wl_output* output, + int32_t x, + int32_t y, + int32_t physicalWidth, + int32_t physicalHeight, + int32_t subpixel, + const char* make, + const char* model, + int32_t transform) +{ + struct _GLFWmonitor *monitor = data; + + monitor->wl.x = x; + monitor->wl.y = y; + monitor->widthMM = physicalWidth; + monitor->heightMM = physicalHeight; +} + +static void mode(void* data, + struct wl_output* output, + uint32_t flags, + int32_t width, + int32_t height, + int32_t refresh) +{ + struct _GLFWmonitor *monitor = data; + _GLFWvidmodeWayland mode = { { 0 }, }; + + mode.base.width = width; + mode.base.height = height; + mode.base.refreshRate = refresh; + mode.flags = flags; + + if (monitor->wl.modesCount + 1 >= monitor->wl.modesSize) + { + int size = monitor->wl.modesSize * 2; + _GLFWvidmodeWayland* modes = + realloc(monitor->wl.modes, + size * sizeof(_GLFWvidmodeWayland)); + monitor->wl.modes = modes; + monitor->wl.modesSize = size; + } + + monitor->wl.modes[monitor->wl.modesCount++] = mode; +} + +static void done(void* data, + struct wl_output* output) +{ + struct _GLFWmonitor *monitor = data; + + monitor->wl.done = GL_TRUE; +} + +static void scale(void* data, + struct wl_output* output, + int32_t factor) +{ +} + +static const struct wl_output_listener output_listener = { + geometry, + mode, + done, + scale, +}; + + +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +void _glfwAddOutput(uint32_t name, uint32_t version) +{ + _GLFWmonitor *monitor; + struct wl_output *output; + char name_str[80]; + + memset(name_str, 0, 80 * sizeof(char)); + snprintf(name_str, 79, "wl_output@%u", name); + + if (version < 2) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Unsupported output interface version"); + return; + } + + monitor = _glfwAllocMonitor(name_str, 0, 0); + + output = wl_registry_bind(_glfw.wl.registry, + name, + &wl_output_interface, + 2); + if (!output) + { + _glfwFreeMonitor(monitor); + return; + } + + monitor->wl.modes = calloc(4, sizeof(_GLFWvidmodeWayland)); + monitor->wl.modesSize = 4; + + monitor->wl.output = output; + wl_output_add_listener(output, &output_listener, monitor); + + if (_glfw.wl.monitorsCount + 1 >= _glfw.wl.monitorsSize) + { + _GLFWmonitor** monitors = _glfw.wl.monitors; + int size = _glfw.wl.monitorsSize * 2; + + monitors = realloc(monitors, size * sizeof(_GLFWmonitor*)); + + _glfw.wl.monitors = monitors; + _glfw.wl.monitorsSize = size; + } + + _glfw.wl.monitors[_glfw.wl.monitorsCount++] = monitor; +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +_GLFWmonitor** _glfwPlatformGetMonitors(int* count) +{ + _GLFWmonitor** monitors; + _GLFWmonitor* monitor; + int i, monitorsCount = _glfw.wl.monitorsCount; + + if (_glfw.wl.monitorsCount == 0) + goto err; + + monitors = calloc(monitorsCount, sizeof(_GLFWmonitor*)); + + for (i = 0; i < monitorsCount; i++) + { + _GLFWmonitor* origMonitor = _glfw.wl.monitors[i]; + monitor = calloc(1, sizeof(_GLFWmonitor)); + + monitor->modes = + _glfwPlatformGetVideoModes(origMonitor, + &origMonitor->wl.modesCount); + *monitor = *_glfw.wl.monitors[i]; + monitors[i] = monitor; + } + + *count = monitorsCount; + return monitors; + +err: + *count = 0; + return NULL; +} + +GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second) +{ + return first->wl.output == second->wl.output; +} + +void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) +{ + if (xpos) + *xpos = monitor->wl.x; + if (ypos) + *ypos = monitor->wl.y; +} + +GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) +{ + GLFWvidmode *modes; + int i, modesCount = monitor->wl.modesCount; + + modes = calloc(modesCount, sizeof(GLFWvidmode)); + + for (i = 0; i < modesCount; i++) + modes[i] = monitor->wl.modes[i].base; + + *found = modesCount; + return modes; +} + +void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) +{ + int i; + + for (i = 0; i < monitor->wl.modesCount; i++) + { + if (monitor->wl.modes[i].flags & WL_OUTPUT_MODE_CURRENT) + { + *mode = monitor->wl.modes[i].base; + return; + } + } +} + +void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +{ + // TODO + fprintf(stderr, "_glfwPlatformGetGammaRamp not implemented yet\n"); +} + +void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) +{ + // TODO + fprintf(stderr, "_glfwPlatformSetGammaRamp not implemented yet\n"); +} + diff --git a/extern/glfw/src/wl_platform.h b/extern/glfw/src/wl_platform.h new file mode 100644 index 0000000..66736b5 --- /dev/null +++ b/extern/glfw/src/wl_platform.h @@ -0,0 +1,140 @@ +//======================================================================== +// GLFW 3.1 Wayland - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Jonas Ådahl +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _wayland_platform_h_ +#define _wayland_platform_h_ + + +#include +#include + +#if defined(_GLFW_EGL) + #include "egl_context.h" +#else + #error "The Wayland backend depends on EGL platform support" +#endif + +#include "posix_tls.h" +#include "posix_time.h" +#include "linux_joystick.h" + +#define _GLFW_EGL_NATIVE_WINDOW window->wl.native +#define _GLFW_EGL_NATIVE_DISPLAY _glfw.wl.display + +#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl +#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl +#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl +#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl + + +// Wayland-specific video mode data +// +typedef struct _GLFWvidmodeWayland _GLFWvidmodeWayland; + + +// Wayland-specific per-window data +// +typedef struct _GLFWwindowWayland +{ + int width, height; + GLboolean visible; + struct wl_surface* surface; + struct wl_egl_window* native; + struct wl_shell_surface* shell_surface; + struct wl_callback* callback; + _GLFWcursor* currentCursor; +} _GLFWwindowWayland; + + +// Wayland-specific global data +// +typedef struct _GLFWlibraryWayland +{ + struct wl_display* display; + struct wl_registry* registry; + struct wl_compositor* compositor; + struct wl_shell* shell; + struct wl_shm* shm; + struct wl_seat* seat; + struct wl_pointer* pointer; + struct wl_keyboard* keyboard; + + struct wl_cursor_theme* cursorTheme; + struct wl_cursor* defaultCursor; + struct wl_surface* cursorSurface; + uint32_t pointerSerial; + + _GLFWmonitor** monitors; + int monitorsCount; + int monitorsSize; + + struct { + struct xkb_context* context; + struct xkb_keymap* keymap; + struct xkb_state* state; + xkb_mod_mask_t control_mask; + xkb_mod_mask_t alt_mask; + xkb_mod_mask_t shift_mask; + xkb_mod_mask_t super_mask; + unsigned int modifiers; + } xkb; + + _GLFWwindow* pointerFocus; + _GLFWwindow* keyboardFocus; + +} _GLFWlibraryWayland; + + +// Wayland-specific per-monitor data +// +typedef struct _GLFWmonitorWayland +{ + struct wl_output* output; + + _GLFWvidmodeWayland* modes; + int modesCount; + int modesSize; + GLboolean done; + + int x; + int y; + +} _GLFWmonitorWayland; + + +// Wayland-specific per-cursor data +// +typedef struct _GLFWcursorWayland +{ + struct wl_buffer* buffer; + int width, height; + int xhot, yhot; +} _GLFWcursorWayland; + + +void _glfwAddOutput(uint32_t name, uint32_t version); + +#endif // _wayland_platform_h_ diff --git a/extern/glfw/src/wl_window.c b/extern/glfw/src/wl_window.c new file mode 100644 index 0000000..bb2da47 --- /dev/null +++ b/extern/glfw/src/wl_window.c @@ -0,0 +1,524 @@ +//======================================================================== +// GLFW 3.1 Wayland - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Jonas Ådahl +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#define _GNU_SOURCE + +#include "internal.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +static void handlePing(void* data, + struct wl_shell_surface* shellSurface, + uint32_t serial) +{ + wl_shell_surface_pong(shellSurface, serial); +} + +static void handleConfigure(void* data, + struct wl_shell_surface* shellSurface, + uint32_t edges, + int32_t width, + int32_t height) +{ + _GLFWwindow* window = data; + _glfwInputFramebufferSize(window, width, height); + _glfwInputWindowSize(window, width, height); + _glfwPlatformSetWindowSize(window, width, height); + _glfwInputWindowDamage(window); +} + +static void handlePopupDone(void* data, + struct wl_shell_surface* shellSurface) +{ +} + +static const struct wl_shell_surface_listener shellSurfaceListener = { + handlePing, + handleConfigure, + handlePopupDone +}; + +static GLboolean createSurface(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig) +{ + window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); + if (!window->wl.surface) + return GL_FALSE; + + wl_surface_set_user_data(window->wl.surface, window); + + window->wl.native = wl_egl_window_create(window->wl.surface, + wndconfig->width, + wndconfig->height); + if (!window->wl.native) + return GL_FALSE; + + window->wl.shell_surface = wl_shell_get_shell_surface(_glfw.wl.shell, + window->wl.surface); + if (!window->wl.shell_surface) + return GL_FALSE; + + wl_shell_surface_add_listener(window->wl.shell_surface, + &shellSurfaceListener, + window); + + window->wl.width = wndconfig->width; + window->wl.height = wndconfig->height; + + return GL_TRUE; +} + +static int +createTmpfileCloexec(char* tmpname) +{ + int fd; + + fd = mkostemp(tmpname, O_CLOEXEC); + if (fd >= 0) + unlink(tmpname); + + return fd; +} + +/* + * Create a new, unique, anonymous file of the given size, and + * return the file descriptor for it. The file descriptor is set + * CLOEXEC. The file is immediately suitable for mmap()'ing + * the given size at offset zero. + * + * The file should not have a permanent backing store like a disk, + * but may have if XDG_RUNTIME_DIR is not properly implemented in OS. + * + * The file name is deleted from the file system. + * + * The file is suitable for buffer sharing between processes by + * transmitting the file descriptor over Unix sockets using the + * SCM_RIGHTS methods. + * + * posix_fallocate() is used to guarantee that disk space is available + * for the file at the given size. If disk space is insufficent, errno + * is set to ENOSPC. If posix_fallocate() is not supported, program may + * receive SIGBUS on accessing mmap()'ed file contents instead. + */ +int +createAnonymousFile(off_t size) +{ + static const char template[] = "/glfw-shared-XXXXXX"; + const char* path; + char* name; + int fd; + int ret; + + path = getenv("XDG_RUNTIME_DIR"); + if (!path) + { + errno = ENOENT; + return -1; + } + + name = malloc(strlen(path) + sizeof(template)); + strcpy(name, path); + strcat(name, template); + + fd = createTmpfileCloexec(name); + + free(name); + + if (fd < 0) + return -1; + ret = posix_fallocate(fd, 0, size); + if (ret != 0) + { + close(fd); + errno = ret; + return -1; + } + return fd; +} + +////////////////////////////////////////////////////////////////////////// +////// GLFW platform API ////// +////////////////////////////////////////////////////////////////////////// + +int _glfwPlatformCreateWindow(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) +{ + if (!_glfwCreateContext(window, ctxconfig, fbconfig)) + return GL_FALSE; + + if (!createSurface(window, wndconfig)) + return GL_FALSE; + + if (wndconfig->monitor) + { + wl_shell_surface_set_fullscreen( + window->wl.shell_surface, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, + wndconfig->monitor->wl.output); + } + else + { + wl_shell_surface_set_toplevel(window->wl.shell_surface); + } + + window->wl.currentCursor = NULL; + + return GL_TRUE; +} + +void _glfwPlatformDestroyWindow(_GLFWwindow* window) +{ + if (window == _glfw.wl.pointerFocus) + { + _glfw.wl.pointerFocus = NULL; + _glfwInputCursorEnter(window, GL_FALSE); + } + if (window == _glfw.wl.keyboardFocus) + { + _glfw.wl.keyboardFocus = NULL; + _glfwInputWindowFocus(window, GL_FALSE); + } + + _glfwDestroyContext(window); + + if (window->wl.native) + wl_egl_window_destroy(window->wl.native); + + if (window->wl.shell_surface) + wl_shell_surface_destroy(window->wl.shell_surface); + + if (window->wl.surface) + wl_surface_destroy(window->wl.surface); +} + +void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) +{ + wl_shell_surface_set_title(window->wl.shell_surface, title); +} + +void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) +{ + // A Wayland client is not aware of its position, so just warn and leave it + // as (0, 0) + + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Window position retrieval not supported"); +} + +void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) +{ + // A Wayland client can not set its position, so just warn + + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Window position setting not supported"); +} + +void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) +{ + if (width) + *width = window->wl.width; + if (height) + *height = window->wl.height; +} + +void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) +{ + wl_egl_window_resize(window->wl.native, width, height, 0, 0); + window->wl.width = width; + window->wl.height = height; +} + +void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) +{ + _glfwPlatformGetWindowSize(window, width, height); +} + +void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + int* left, int* top, + int* right, int* bottom) +{ + // TODO + fprintf(stderr, "_glfwPlatformGetWindowFrameSize not implemented yet\n"); +} + +void _glfwPlatformIconifyWindow(_GLFWwindow* window) +{ + // TODO + fprintf(stderr, "_glfwPlatformIconifyWindow not implemented yet\n"); +} + +void _glfwPlatformRestoreWindow(_GLFWwindow* window) +{ + // TODO + fprintf(stderr, "_glfwPlatformRestoreWindow not implemented yet\n"); +} + +void _glfwPlatformShowWindow(_GLFWwindow* window) +{ + wl_shell_surface_set_toplevel(window->wl.shell_surface); +} + +void _glfwPlatformUnhideWindow(_GLFWwindow* window) +{ + // TODO + fprintf(stderr, "_glfwPlatformUnhideWindow not implemented yet\n"); +} + +void _glfwPlatformHideWindow(_GLFWwindow* window) +{ + wl_surface_attach(window->wl.surface, NULL, 0, 0); + wl_surface_commit(window->wl.surface); +} + +int _glfwPlatformWindowFocused(_GLFWwindow* window) +{ + // TODO + return GL_FALSE; +} + +int _glfwPlatformWindowIconified(_GLFWwindow* window) +{ + // TODO + return GL_FALSE; +} + +int _glfwPlatformWindowVisible(_GLFWwindow* window) +{ + // TODO + return GL_FALSE; +} + +void _glfwPlatformPollEvents(void) +{ + struct wl_display* display = _glfw.wl.display; + struct pollfd fds[] = { + { wl_display_get_fd(display), POLLIN }, + }; + + while (wl_display_prepare_read(display) != 0) + wl_display_dispatch_pending(display); + wl_display_flush(display); + if (poll(fds, 1, 0) > 0) + { + wl_display_read_events(display); + wl_display_dispatch_pending(display); + } + else + { + wl_display_cancel_read(display); + } +} + +void _glfwPlatformWaitEvents(void) +{ + struct wl_display* display = _glfw.wl.display; + struct pollfd fds[] = { + { wl_display_get_fd(display), POLLIN }, + }; + + while (wl_display_prepare_read(display) != 0) + wl_display_dispatch_pending(display); + wl_display_flush(display); + if (poll(fds, 1, -1) > 0) + { + wl_display_read_events(display); + wl_display_dispatch_pending(display); + } + else + { + wl_display_cancel_read(display); + } +} + +void _glfwPlatformPostEmptyEvent(void) +{ + wl_display_sync(_glfw.wl.display); +} + +void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) +{ + // TODO + fprintf(stderr, "_glfwPlatformGetCursorPos not implemented yet\n"); +} + +void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) +{ + // A Wayland client can not set the cursor position + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Cursor position setting not supported"); +} + +void _glfwPlatformApplyCursorMode(_GLFWwindow* window) +{ + _glfwPlatformSetCursor(window, window->wl.currentCursor); +} + +int _glfwPlatformCreateCursor(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) +{ + struct wl_shm_pool* pool; + int stride = image->width * 4; + int length = image->width * image->height * 4; + void* data; + int fd, i; + + fd = createAnonymousFile(length); + if (fd < 0) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Creating a buffer file for %d B failed: %m\n", + length); + return GL_FALSE; + } + + data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (data == MAP_FAILED) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Cursor mmap failed: %m\n"); + close(fd); + return GL_FALSE; + } + + pool = wl_shm_create_pool(_glfw.wl.shm, fd, length); + + close(fd); + unsigned char* source = (unsigned char*) image->pixels; + unsigned char* target = data; + for (i = 0; i < image->width * image->height; i++, source += 4) + { + *target++ = source[2]; + *target++ = source[1]; + *target++ = source[0]; + *target++ = source[3]; + } + + cursor->wl.buffer = + wl_shm_pool_create_buffer(pool, 0, + image->width, + image->height, + stride, WL_SHM_FORMAT_ARGB8888); + munmap(data, length); + wl_shm_pool_destroy(pool); + + cursor->wl.width = image->width; + cursor->wl.height = image->height; + cursor->wl.xhot = xhot; + cursor->wl.yhot = yhot; + return GL_TRUE; +} + +int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) +{ + // TODO + fprintf(stderr, "_glfwPlatformCreateStandardCursor not implemented yet\n"); + return GL_FALSE; +} + +void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) +{ + wl_buffer_destroy(cursor->wl.buffer); +} + +void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) +{ + struct wl_buffer* buffer; + struct wl_cursor_image* image; + struct wl_surface* surface = _glfw.wl.cursorSurface; + + if (!_glfw.wl.pointer) + return; + + window->wl.currentCursor = cursor; + + // If we're not in the correct window just save the cursor + // the next time the pointer enters the window the cursor will change + if (window != _glfw.wl.pointerFocus) + return; + + if (window->cursorMode == GLFW_CURSOR_NORMAL) + { + if (cursor == NULL) + { + image = _glfw.wl.defaultCursor->images[0]; + buffer = wl_cursor_image_get_buffer(image); + if (!buffer) + return; + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + surface, + image->hotspot_x, + image->hotspot_y); + wl_surface_attach(surface, buffer, 0, 0); + wl_surface_damage(surface, 0, 0, + image->width, image->height); + wl_surface_commit(surface); + } + else + { + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + surface, + cursor->wl.xhot, + cursor->wl.yhot); + wl_surface_attach(surface, cursor->wl.buffer, 0, 0); + wl_surface_damage(surface, 0, 0, + cursor->wl.width, cursor->wl.height); + wl_surface_commit(surface); + } + } + else /* Cursor is hidden set cursor surface to NULL */ + { + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, NULL, 0, 0); + } +} + +void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) +{ + // TODO + fprintf(stderr, "_glfwPlatformSetClipboardString not implemented yet\n"); +} + +const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) +{ + // TODO + fprintf(stderr, "_glfwPlatformGetClipboardString not implemented yet\n"); + return NULL; +} + diff --git a/extern/glfw/src/x11_clipboard.c b/extern/glfw/src/x11_clipboard.c deleted file mode 100644 index 614ba36..0000000 --- a/extern/glfw/src/x11_clipboard.c +++ /dev/null @@ -1,335 +0,0 @@ -//======================================================================== -// GLFW 3.0 X11 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#include -#include -#include -#include - - -// Returns whether the event is a selection event -// -static Bool isSelectionMessage(Display* display, XEvent* event, XPointer pointer) -{ - return event->type == SelectionRequest || - event->type == SelectionNotify || - event->type == SelectionClear; -} - -// Set the specified property to the selection converted to the requested target -// -static Atom writeTargetToProperty(const XSelectionRequestEvent* request) -{ - int i; - const Atom formats[] = { _glfw.x11.UTF8_STRING, - _glfw.x11.COMPOUND_STRING, - XA_STRING }; - const int formatCount = sizeof(formats) / sizeof(formats[0]); - - if (request->property == None) - { - // The requestor is a legacy client (ICCCM section 2.2) - // We don't support legacy clients, so fail here - return None; - } - - if (request->target == _glfw.x11.TARGETS) - { - // The list of supported targets was requested - - const Atom targets[] = { _glfw.x11.TARGETS, - _glfw.x11.MULTIPLE, - _glfw.x11.UTF8_STRING, - _glfw.x11.COMPOUND_STRING, - XA_STRING }; - - XChangeProperty(_glfw.x11.display, - request->requestor, - request->property, - XA_ATOM, - 32, - PropModeReplace, - (unsigned char*) targets, - sizeof(targets) / sizeof(targets[0])); - - return request->property; - } - - if (request->target == _glfw.x11.MULTIPLE) - { - // Multiple conversions were requested - - Atom* targets; - unsigned long i, count; - - count = _glfwGetWindowProperty(request->requestor, - request->property, - _glfw.x11.ATOM_PAIR, - (unsigned char**) &targets); - - for (i = 0; i < count; i += 2) - { - int j; - - for (j = 0; j < formatCount; j++) - { - if (targets[i] == formats[j]) - break; - } - - if (j < formatCount) - { - XChangeProperty(_glfw.x11.display, - request->requestor, - targets[i + 1], - targets[i], - 8, - PropModeReplace, - (unsigned char*) _glfw.x11.selection.string, - strlen(_glfw.x11.selection.string)); - } - else - targets[i + 1] = None; - } - - XChangeProperty(_glfw.x11.display, - request->requestor, - request->property, - _glfw.x11.ATOM_PAIR, - 32, - PropModeReplace, - (unsigned char*) targets, - count); - - XFree(targets); - - return request->property; - } - - if (request->target == _glfw.x11.SAVE_TARGETS) - { - // The request is a check whether we support SAVE_TARGETS - // It should be handled as a no-op side effect target - - XChangeProperty(_glfw.x11.display, - request->requestor, - request->property, - XInternAtom(_glfw.x11.display, "NULL", False), - 32, - PropModeReplace, - NULL, - 0); - - return request->property; - } - - // Conversion to a data target was requested - - for (i = 0; i < formatCount; i++) - { - if (request->target == formats[i]) - { - // The requested target is one we support - - XChangeProperty(_glfw.x11.display, - request->requestor, - request->property, - request->target, - 8, - PropModeReplace, - (unsigned char*) _glfw.x11.selection.string, - strlen(_glfw.x11.selection.string)); - - return request->property; - } - } - - // The requested target is not supported - - return None; -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwHandleSelectionClear(XEvent* event) -{ - free(_glfw.x11.selection.string); - _glfw.x11.selection.string = NULL; -} - -void _glfwHandleSelectionRequest(XEvent* event) -{ - const XSelectionRequestEvent* request = &event->xselectionrequest; - - XEvent response; - memset(&response, 0, sizeof(response)); - - response.xselection.property = writeTargetToProperty(request); - response.xselection.type = SelectionNotify; - response.xselection.display = request->display; - response.xselection.requestor = request->requestor; - response.xselection.selection = request->selection; - response.xselection.target = request->target; - response.xselection.time = request->time; - - XSendEvent(_glfw.x11.display, request->requestor, False, 0, &response); -} - -void _glfwPushSelectionToManager(_GLFWwindow* window) -{ - XConvertSelection(_glfw.x11.display, - _glfw.x11.CLIPBOARD_MANAGER, - _glfw.x11.SAVE_TARGETS, - None, - window->x11.handle, - CurrentTime); - - for (;;) - { - XEvent event; - - if (!XCheckIfEvent(_glfw.x11.display, &event, isSelectionMessage, NULL)) - continue; - - switch (event.type) - { - case SelectionRequest: - _glfwHandleSelectionRequest(&event); - break; - - case SelectionClear: - _glfwHandleSelectionClear(&event); - break; - - case SelectionNotify: - { - if (event.xselection.target == _glfw.x11.SAVE_TARGETS) - { - // This means one of two things; either the selection was - // not owned, which means there is no clipboard manager, or - // the transfer to the clipboard manager has completed - // In either case, it means we are done here - return; - } - - break; - } - } - } -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) -{ - free(_glfw.x11.selection.string); - _glfw.x11.selection.string = strdup(string); - - XSetSelectionOwner(_glfw.x11.display, - _glfw.x11.CLIPBOARD, - window->x11.handle, CurrentTime); - - if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) != - window->x11.handle) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "X11: Failed to become owner of the clipboard selection"); - } -} - -const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) -{ - size_t i; - const Atom formats[] = { _glfw.x11.UTF8_STRING, - _glfw.x11.COMPOUND_STRING, - XA_STRING }; - const size_t formatCount = sizeof(formats) / sizeof(formats[0]); - - if (_glfwFindWindowByHandle(XGetSelectionOwner(_glfw.x11.display, - _glfw.x11.CLIPBOARD))) - { - // Instead of doing a large number of X round-trips just to put this - // string into a window property and then read it back, just return it - return _glfw.x11.selection.string; - } - - free(_glfw.x11.selection.string); - _glfw.x11.selection.string = NULL; - - for (i = 0; i < formatCount; i++) - { - char* data; - XEvent event; - - XConvertSelection(_glfw.x11.display, - _glfw.x11.CLIPBOARD, - formats[i], - _glfw.x11.GLFW_SELECTION, - window->x11.handle, CurrentTime); - - // XCheckTypedEvent is used instead of XIfEvent in order not to lock - // other threads out from the display during the entire wait period - while (!XCheckTypedEvent(_glfw.x11.display, SelectionNotify, &event)) - ; - - if (event.xselection.property == None) - continue; - - if (_glfwGetWindowProperty(event.xselection.requestor, - event.xselection.property, - event.xselection.target, - (unsigned char**) &data)) - { - _glfw.x11.selection.string = strdup(data); - } - - XFree(data); - - XDeleteProperty(_glfw.x11.display, - event.xselection.requestor, - event.xselection.property); - - if (_glfw.x11.selection.string) - break; - } - - if (_glfw.x11.selection.string == NULL) - { - _glfwInputError(GLFW_FORMAT_UNAVAILABLE, - "X11: Failed to convert selection to string"); - } - - return _glfw.x11.selection.string; -} - diff --git a/extern/glfw/src/x11_gamma.c b/extern/glfw/src/x11_gamma.c deleted file mode 100644 index 1831263..0000000 --- a/extern/glfw/src/x11_gamma.c +++ /dev/null @@ -1,123 +0,0 @@ -//======================================================================== -// GLFW 3.0 X11 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#include -#include - - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -// Detect gamma ramp support -// -void _glfwInitGammaRamp(void) -{ - // RandR gamma support is only available with version 1.2 and above - if (_glfw.x11.randr.available && - (_glfw.x11.randr.versionMajor > 1 || - (_glfw.x11.randr.versionMajor == 1 && - _glfw.x11.randr.versionMinor >= 2))) - { - // FIXME: Assumes that all monitors have the same size gamma tables - // This is reasonable as I suspect the that if they did differ, it - // would imply that setting the gamma size to an arbitary size is - // possible as well. - XRRScreenResources* rr = XRRGetScreenResources(_glfw.x11.display, - _glfw.x11.root); - - if (XRRGetCrtcGammaSize(_glfw.x11.display, rr->crtcs[0]) == 0) - { - // This is probably older Nvidia RandR with broken gamma support - // Flag it as useless and try Xf86VidMode below, if available - _glfw.x11.randr.gammaBroken = GL_TRUE; - } - - XRRFreeScreenResources(rr); - } -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) -{ - if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) - { - const size_t size = XRRGetCrtcGammaSize(_glfw.x11.display, - monitor->x11.crtc); - XRRCrtcGamma* gamma = XRRGetCrtcGamma(_glfw.x11.display, - monitor->x11.crtc); - - _glfwAllocGammaArrays(ramp, size); - - memcpy(ramp->red, gamma->red, size * sizeof(unsigned short)); - memcpy(ramp->green, gamma->green, size * sizeof(unsigned short)); - memcpy(ramp->blue, gamma->blue, size * sizeof(unsigned short)); - - XRRFreeGamma(gamma); - } - else if (_glfw.x11.vidmode.available) - { - int size; - XF86VidModeGetGammaRampSize(_glfw.x11.display, _glfw.x11.screen, &size); - - _glfwAllocGammaArrays(ramp, size); - - XF86VidModeGetGammaRamp(_glfw.x11.display, - _glfw.x11.screen, - ramp->size, ramp->red, ramp->green, ramp->blue); - } -} - -void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) -{ - if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) - { - XRRCrtcGamma* gamma = XRRAllocGamma(ramp->size); - - memcpy(gamma->red, ramp->red, ramp->size * sizeof(unsigned short)); - memcpy(gamma->green, ramp->green, ramp->size * sizeof(unsigned short)); - memcpy(gamma->blue, ramp->blue, ramp->size * sizeof(unsigned short)); - - XRRSetCrtcGamma(_glfw.x11.display, monitor->x11.crtc, gamma); - XRRFreeGamma(gamma); - } - else if (_glfw.x11.vidmode.available) - { - XF86VidModeSetGammaRamp(_glfw.x11.display, - _glfw.x11.screen, - ramp->size, - (unsigned short*) ramp->red, - (unsigned short*) ramp->green, - (unsigned short*) ramp->blue); - } -} - diff --git a/extern/glfw/src/x11_init.c b/extern/glfw/src/x11_init.c index 5b477f0..388105e 100644 --- a/extern/glfw/src/x11_init.c +++ b/extern/glfw/src/x11_init.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 X11 - www.glfw.org +// GLFW 3.1 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -32,46 +32,61 @@ #include #include #include +#include +#include // Translate an X11 key code to a GLFW key code. // -static int translateKey(int keyCode) +static int translateKey(int scancode) { int keySym; - // Valid key code range is [8,255], according to the XLib manual - if (keyCode < 8 || keyCode > 255) + // Valid key code range is [8,255], according to the Xlib manual + if (scancode < 8 || scancode > 255) return GLFW_KEY_UNKNOWN; - // Try secondary keysym, for numeric keypad keys - // Note: This way we always force "NumLock = ON", which is intentional - // since the returned key code should correspond to a physical - // location. - keySym = XkbKeycodeToKeysym(_glfw.x11.display, keyCode, 0, 1); - switch (keySym) + if (_glfw.x11.xkb.available) { - case XK_KP_0: return GLFW_KEY_KP_0; - case XK_KP_1: return GLFW_KEY_KP_1; - case XK_KP_2: return GLFW_KEY_KP_2; - case XK_KP_3: return GLFW_KEY_KP_3; - case XK_KP_4: return GLFW_KEY_KP_4; - case XK_KP_5: return GLFW_KEY_KP_5; - case XK_KP_6: return GLFW_KEY_KP_6; - case XK_KP_7: return GLFW_KEY_KP_7; - case XK_KP_8: return GLFW_KEY_KP_8; - case XK_KP_9: return GLFW_KEY_KP_9; - case XK_KP_Separator: - case XK_KP_Decimal: return GLFW_KEY_KP_DECIMAL; - case XK_KP_Equal: return GLFW_KEY_KP_EQUAL; - case XK_KP_Enter: return GLFW_KEY_KP_ENTER; - default: break; + // Try secondary keysym, for numeric keypad keys + // Note: This way we always force "NumLock = ON", which is intentional + // since the returned key code should correspond to a physical + // location. + keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 1); + switch (keySym) + { + case XK_KP_0: return GLFW_KEY_KP_0; + case XK_KP_1: return GLFW_KEY_KP_1; + case XK_KP_2: return GLFW_KEY_KP_2; + case XK_KP_3: return GLFW_KEY_KP_3; + case XK_KP_4: return GLFW_KEY_KP_4; + case XK_KP_5: return GLFW_KEY_KP_5; + case XK_KP_6: return GLFW_KEY_KP_6; + case XK_KP_7: return GLFW_KEY_KP_7; + case XK_KP_8: return GLFW_KEY_KP_8; + case XK_KP_9: return GLFW_KEY_KP_9; + case XK_KP_Separator: + case XK_KP_Decimal: return GLFW_KEY_KP_DECIMAL; + case XK_KP_Equal: return GLFW_KEY_KP_EQUAL; + case XK_KP_Enter: return GLFW_KEY_KP_ENTER; + default: break; + } + + // Now try primary keysym for function keys (non-printable keys). These + // should not be layout dependent (i.e. US layout and international + // layouts should give the same result). + keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0); + } + else + { + int dummy; + KeySym* keySyms; + + keySyms = XGetKeyboardMapping(_glfw.x11.display, scancode, 1, &dummy); + keySym = keySyms[0]; + XFree(keySyms); } - // Now try pimary keysym for function keys (non-printable keys). These - // should not be layout dependent (i.e. US layout and international - // layouts should give the same result). - keySym = XkbKeycodeToKeysym(_glfw.x11.display, keyCode, 0, 0); switch (keySym) { case XK_Escape: return GLFW_KEY_ESCAPE; @@ -212,106 +227,124 @@ static int translateKey(int keyCode) return GLFW_KEY_UNKNOWN; } -// Update the key code LUT +// Create key code translation tables // -static void updateKeyCodeLUT(void) +static void createKeyTables(void) { - int i, keyCode, keyCodeGLFW; - char name[XkbKeyNameLength + 1]; - XkbDescPtr descr; + int scancode, key; - // Clear the LUT - for (keyCode = 0; keyCode < 256; keyCode++) - _glfw.x11.keyCodeLUT[keyCode] = GLFW_KEY_UNKNOWN; + memset(_glfw.x11.publicKeys, -1, sizeof(_glfw.x11.publicKeys)); - // Use XKB to determine physical key locations independently of the current - // keyboard layout - - // Get keyboard description - descr = XkbGetKeyboard(_glfw.x11.display, - XkbAllComponentsMask, - XkbUseCoreKbd); - - // Find the X11 key code -> GLFW key code mapping - for (keyCode = descr->min_key_code; keyCode <= descr->max_key_code; ++keyCode) + if (_glfw.x11.xkb.available) { - // Get the key name - for (i = 0; i < XkbKeyNameLength; i++) - name[i] = descr->names->keys[keyCode].name[i]; + // Use XKB to determine physical key locations independently of the current + // keyboard layout - name[XkbKeyNameLength] = 0; + char name[XkbKeyNameLength + 1]; + XkbDescPtr descr = XkbGetKeyboard(_glfw.x11.display, + XkbAllComponentsMask, + XkbUseCoreKbd); - // Map the key name to a GLFW key code. Note: We only map printable - // keys here, and we use the US keyboard layout. The rest of the - // keys (function keys) are mapped using traditional KeySym - // translations. - if (strcmp(name, "TLDE") == 0) keyCodeGLFW = GLFW_KEY_GRAVE_ACCENT; - else if (strcmp(name, "AE01") == 0) keyCodeGLFW = GLFW_KEY_1; - else if (strcmp(name, "AE02") == 0) keyCodeGLFW = GLFW_KEY_2; - else if (strcmp(name, "AE03") == 0) keyCodeGLFW = GLFW_KEY_3; - else if (strcmp(name, "AE04") == 0) keyCodeGLFW = GLFW_KEY_4; - else if (strcmp(name, "AE05") == 0) keyCodeGLFW = GLFW_KEY_5; - else if (strcmp(name, "AE06") == 0) keyCodeGLFW = GLFW_KEY_6; - else if (strcmp(name, "AE07") == 0) keyCodeGLFW = GLFW_KEY_7; - else if (strcmp(name, "AE08") == 0) keyCodeGLFW = GLFW_KEY_8; - else if (strcmp(name, "AE09") == 0) keyCodeGLFW = GLFW_KEY_9; - else if (strcmp(name, "AE10") == 0) keyCodeGLFW = GLFW_KEY_0; - else if (strcmp(name, "AE11") == 0) keyCodeGLFW = GLFW_KEY_MINUS; - else if (strcmp(name, "AE12") == 0) keyCodeGLFW = GLFW_KEY_EQUAL; - else if (strcmp(name, "AD01") == 0) keyCodeGLFW = GLFW_KEY_Q; - else if (strcmp(name, "AD02") == 0) keyCodeGLFW = GLFW_KEY_W; - else if (strcmp(name, "AD03") == 0) keyCodeGLFW = GLFW_KEY_E; - else if (strcmp(name, "AD04") == 0) keyCodeGLFW = GLFW_KEY_R; - else if (strcmp(name, "AD05") == 0) keyCodeGLFW = GLFW_KEY_T; - else if (strcmp(name, "AD06") == 0) keyCodeGLFW = GLFW_KEY_Y; - else if (strcmp(name, "AD07") == 0) keyCodeGLFW = GLFW_KEY_U; - else if (strcmp(name, "AD08") == 0) keyCodeGLFW = GLFW_KEY_I; - else if (strcmp(name, "AD09") == 0) keyCodeGLFW = GLFW_KEY_O; - else if (strcmp(name, "AD10") == 0) keyCodeGLFW = GLFW_KEY_P; - else if (strcmp(name, "AD11") == 0) keyCodeGLFW = GLFW_KEY_LEFT_BRACKET; - else if (strcmp(name, "AD12") == 0) keyCodeGLFW = GLFW_KEY_RIGHT_BRACKET; - else if (strcmp(name, "AC01") == 0) keyCodeGLFW = GLFW_KEY_A; - else if (strcmp(name, "AC02") == 0) keyCodeGLFW = GLFW_KEY_S; - else if (strcmp(name, "AC03") == 0) keyCodeGLFW = GLFW_KEY_D; - else if (strcmp(name, "AC04") == 0) keyCodeGLFW = GLFW_KEY_F; - else if (strcmp(name, "AC05") == 0) keyCodeGLFW = GLFW_KEY_G; - else if (strcmp(name, "AC06") == 0) keyCodeGLFW = GLFW_KEY_H; - else if (strcmp(name, "AC07") == 0) keyCodeGLFW = GLFW_KEY_J; - else if (strcmp(name, "AC08") == 0) keyCodeGLFW = GLFW_KEY_K; - else if (strcmp(name, "AC09") == 0) keyCodeGLFW = GLFW_KEY_L; - else if (strcmp(name, "AC10") == 0) keyCodeGLFW = GLFW_KEY_SEMICOLON; - else if (strcmp(name, "AC11") == 0) keyCodeGLFW = GLFW_KEY_APOSTROPHE; - else if (strcmp(name, "AB01") == 0) keyCodeGLFW = GLFW_KEY_Z; - else if (strcmp(name, "AB02") == 0) keyCodeGLFW = GLFW_KEY_X; - else if (strcmp(name, "AB03") == 0) keyCodeGLFW = GLFW_KEY_C; - else if (strcmp(name, "AB04") == 0) keyCodeGLFW = GLFW_KEY_V; - else if (strcmp(name, "AB05") == 0) keyCodeGLFW = GLFW_KEY_B; - else if (strcmp(name, "AB06") == 0) keyCodeGLFW = GLFW_KEY_N; - else if (strcmp(name, "AB07") == 0) keyCodeGLFW = GLFW_KEY_M; - else if (strcmp(name, "AB08") == 0) keyCodeGLFW = GLFW_KEY_COMMA; - else if (strcmp(name, "AB09") == 0) keyCodeGLFW = GLFW_KEY_PERIOD; - else if (strcmp(name, "AB10") == 0) keyCodeGLFW = GLFW_KEY_SLASH; - else if (strcmp(name, "BKSL") == 0) keyCodeGLFW = GLFW_KEY_BACKSLASH; - else if (strcmp(name, "LSGT") == 0) keyCodeGLFW = GLFW_KEY_WORLD_1; - else keyCodeGLFW = GLFW_KEY_UNKNOWN; + // Find the X11 key code -> GLFW key code mapping + for (scancode = descr->min_key_code; scancode <= descr->max_key_code; scancode++) + { + memcpy(name, descr->names->keys[scancode].name, XkbKeyNameLength); + name[XkbKeyNameLength] = 0; - // Update the key code LUT - if ((keyCode >= 0) && (keyCode < 256)) - _glfw.x11.keyCodeLUT[keyCode] = keyCodeGLFW; + // Map the key name to a GLFW key code. Note: We only map printable + // keys here, and we use the US keyboard layout. The rest of the + // keys (function keys) are mapped using traditional KeySym + // translations. + if (strcmp(name, "TLDE") == 0) key = GLFW_KEY_GRAVE_ACCENT; + else if (strcmp(name, "AE01") == 0) key = GLFW_KEY_1; + else if (strcmp(name, "AE02") == 0) key = GLFW_KEY_2; + else if (strcmp(name, "AE03") == 0) key = GLFW_KEY_3; + else if (strcmp(name, "AE04") == 0) key = GLFW_KEY_4; + else if (strcmp(name, "AE05") == 0) key = GLFW_KEY_5; + else if (strcmp(name, "AE06") == 0) key = GLFW_KEY_6; + else if (strcmp(name, "AE07") == 0) key = GLFW_KEY_7; + else if (strcmp(name, "AE08") == 0) key = GLFW_KEY_8; + else if (strcmp(name, "AE09") == 0) key = GLFW_KEY_9; + else if (strcmp(name, "AE10") == 0) key = GLFW_KEY_0; + else if (strcmp(name, "AE11") == 0) key = GLFW_KEY_MINUS; + else if (strcmp(name, "AE12") == 0) key = GLFW_KEY_EQUAL; + else if (strcmp(name, "AD01") == 0) key = GLFW_KEY_Q; + else if (strcmp(name, "AD02") == 0) key = GLFW_KEY_W; + else if (strcmp(name, "AD03") == 0) key = GLFW_KEY_E; + else if (strcmp(name, "AD04") == 0) key = GLFW_KEY_R; + else if (strcmp(name, "AD05") == 0) key = GLFW_KEY_T; + else if (strcmp(name, "AD06") == 0) key = GLFW_KEY_Y; + else if (strcmp(name, "AD07") == 0) key = GLFW_KEY_U; + else if (strcmp(name, "AD08") == 0) key = GLFW_KEY_I; + else if (strcmp(name, "AD09") == 0) key = GLFW_KEY_O; + else if (strcmp(name, "AD10") == 0) key = GLFW_KEY_P; + else if (strcmp(name, "AD11") == 0) key = GLFW_KEY_LEFT_BRACKET; + else if (strcmp(name, "AD12") == 0) key = GLFW_KEY_RIGHT_BRACKET; + else if (strcmp(name, "AC01") == 0) key = GLFW_KEY_A; + else if (strcmp(name, "AC02") == 0) key = GLFW_KEY_S; + else if (strcmp(name, "AC03") == 0) key = GLFW_KEY_D; + else if (strcmp(name, "AC04") == 0) key = GLFW_KEY_F; + else if (strcmp(name, "AC05") == 0) key = GLFW_KEY_G; + else if (strcmp(name, "AC06") == 0) key = GLFW_KEY_H; + else if (strcmp(name, "AC07") == 0) key = GLFW_KEY_J; + else if (strcmp(name, "AC08") == 0) key = GLFW_KEY_K; + else if (strcmp(name, "AC09") == 0) key = GLFW_KEY_L; + else if (strcmp(name, "AC10") == 0) key = GLFW_KEY_SEMICOLON; + else if (strcmp(name, "AC11") == 0) key = GLFW_KEY_APOSTROPHE; + else if (strcmp(name, "AB01") == 0) key = GLFW_KEY_Z; + else if (strcmp(name, "AB02") == 0) key = GLFW_KEY_X; + else if (strcmp(name, "AB03") == 0) key = GLFW_KEY_C; + else if (strcmp(name, "AB04") == 0) key = GLFW_KEY_V; + else if (strcmp(name, "AB05") == 0) key = GLFW_KEY_B; + else if (strcmp(name, "AB06") == 0) key = GLFW_KEY_N; + else if (strcmp(name, "AB07") == 0) key = GLFW_KEY_M; + else if (strcmp(name, "AB08") == 0) key = GLFW_KEY_COMMA; + else if (strcmp(name, "AB09") == 0) key = GLFW_KEY_PERIOD; + else if (strcmp(name, "AB10") == 0) key = GLFW_KEY_SLASH; + else if (strcmp(name, "BKSL") == 0) key = GLFW_KEY_BACKSLASH; + else if (strcmp(name, "LSGT") == 0) key = GLFW_KEY_WORLD_1; + else key = GLFW_KEY_UNKNOWN; + + if ((scancode >= 0) && (scancode < 256)) + _glfw.x11.publicKeys[scancode] = key; + } + + XkbFreeKeyboard(descr, 0, True); } - // Free the keyboard description - XkbFreeKeyboard(descr, 0, True); - // Translate the un-translated key codes using traditional X11 KeySym // lookups - for (keyCode = 0; keyCode < 256; keyCode++) + for (scancode = 0; scancode < 256; scancode++) { - if (_glfw.x11.keyCodeLUT[keyCode] < 0) - _glfw.x11.keyCodeLUT[keyCode] = translateKey(keyCode); + if (_glfw.x11.publicKeys[scancode] < 0) + _glfw.x11.publicKeys[scancode] = translateKey(scancode); } } +// Check whether the IM has a usable style +// +static GLboolean hasUsableInputMethodStyle(void) +{ + unsigned int i; + GLboolean found = GL_FALSE; + XIMStyles* styles = NULL; + + if (XGetIMValues(_glfw.x11.im, XNQueryInputStyle, &styles, NULL) != NULL) + return GL_FALSE; + + for (i = 0; i < styles->count_styles; i++) + { + if (styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing)) + { + found = GL_TRUE; + break; + } + } + + XFree(styles); + return found; +} + // Check whether the specified atom is supported // static Atom getSupportedAtom(Atom* supportedAtoms, @@ -354,10 +387,13 @@ static void detectEWMH(void) XA_WINDOW, (unsigned char**) &windowFromRoot) != 1) { - XFree(windowFromRoot); + if (windowFromRoot) + XFree(windowFromRoot); return; } + _glfwGrabXErrorHandler(); + // It should be the ID of a child window (of the root) // Then we look for the same property on the child window if (_glfwGetWindowProperty(*windowFromRoot, @@ -366,10 +402,13 @@ static void detectEWMH(void) (unsigned char**) &windowFromChild) != 1) { XFree(windowFromRoot); - XFree(windowFromChild); + if (windowFromChild) + XFree(windowFromChild); return; } + _glfwReleaseXErrorHandler(); + // It should be the ID of that same child window if (*windowFromRoot != *windowFromChild) { @@ -394,11 +433,14 @@ static void detectEWMH(void) (unsigned char**) &supportedAtoms); // See which of the atoms we support that are supported by the WM - _glfw.x11.NET_WM_STATE = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE"); + _glfw.x11.NET_WM_STATE_ABOVE = + getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE"); _glfw.x11.NET_WM_STATE_FULLSCREEN = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE_FULLSCREEN"); + _glfw.x11.NET_WM_FULLSCREEN_MONITORS = + getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_FULLSCREEN_MONITORS"); _glfw.x11.NET_WM_NAME = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_NAME"); _glfw.x11.NET_WM_ICON_NAME = @@ -409,6 +451,10 @@ static void detectEWMH(void) getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING"); _glfw.x11.NET_ACTIVE_WINDOW = getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW"); + _glfw.x11.NET_FRAME_EXTENTS = + getSupportedAtom(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS"); + _glfw.x11.NET_REQUEST_FRAME_EXTENTS = + getSupportedAtom(supportedAtoms, atomCount, "_NET_REQUEST_FRAME_EXTENTS"); _glfw.x11.NET_WM_BYPASS_COMPOSITOR = getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_BYPASS_COMPOSITOR"); @@ -421,9 +467,10 @@ static void detectEWMH(void) // static GLboolean initExtensions(void) { - Bool supported; - // Find or create window manager atoms + _glfw.x11.WM_PROTOCOLS = XInternAtom(_glfw.x11.display, + "WM_PROTOCOLS", + False); _glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False); _glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display, "WM_DELETE_WINDOW", @@ -446,6 +493,8 @@ static GLboolean initExtensions(void) if (_glfw.x11.randr.available) { + XRRScreenResources* sr; + if (!XRRQueryVersion(_glfw.x11.display, &_glfw.x11.randr.versionMajor, &_glfw.x11.randr.versionMinor)) @@ -461,6 +510,29 @@ static GLboolean initExtensions(void) { _glfw.x11.randr.available = GL_FALSE; } + + sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); + + if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0])) + { + // This is either a headless system or an older Nvidia binary driver + // with broken gamma support + // Flag it as useless and fall back to Xf86VidMode gamma, if + // available + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: RandR gamma ramp support seems broken"); + _glfw.x11.randr.gammaBroken = GL_TRUE; + } + + XRRFreeScreenResources(sr); + } + + if (XineramaQueryExtension(_glfw.x11.display, + &_glfw.x11.xinerama.versionMajor, + &_glfw.x11.xinerama.versionMinor)) + { + if (XineramaIsActive(_glfw.x11.display)) + _glfw.x11.xinerama.available = GL_TRUE; } if (XQueryExtension(_glfw.x11.display, @@ -483,41 +555,35 @@ static GLboolean initExtensions(void) // Check if Xkb is supported on this display _glfw.x11.xkb.versionMajor = 1; _glfw.x11.xkb.versionMinor = 0; - if (!XkbQueryExtension(_glfw.x11.display, - &_glfw.x11.xkb.majorOpcode, - &_glfw.x11.xkb.eventBase, - &_glfw.x11.xkb.errorBase, - &_glfw.x11.xkb.versionMajor, - &_glfw.x11.xkb.versionMinor)) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "X11: The keyboard extension is not available"); - return GL_FALSE; - } + _glfw.x11.xkb.available = + XkbQueryExtension(_glfw.x11.display, + &_glfw.x11.xkb.majorOpcode, + &_glfw.x11.xkb.eventBase, + &_glfw.x11.xkb.errorBase, + &_glfw.x11.xkb.versionMajor, + &_glfw.x11.xkb.versionMinor); - if (!XkbSetDetectableAutoRepeat(_glfw.x11.display, True, &supported)) + if (_glfw.x11.xkb.available) { - _glfwInputError(GLFW_PLATFORM_ERROR, - "X11: Failed to set detectable key repeat"); - return GL_FALSE; - } + Bool supported; - if (!supported) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "X11: Detectable key repeat is not supported"); - return GL_FALSE; + if (XkbSetDetectableAutoRepeat(_glfw.x11.display, True, &supported)) + { + if (supported) + _glfw.x11.xkb.detectable = GL_TRUE; + } } // Update the key code LUT // FIXME: We should listen to XkbMapNotify events to track changes to // the keyboard mapping. - updateKeyCodeLUT(); + createKeyTables(); // Detect whether an EWMH-conformant window manager is running detectEWMH(); // Find or create string format atoms + _glfw.x11._NULL = XInternAtom(_glfw.x11.display, "NULL", False); _glfw.x11.UTF8_STRING = XInternAtom(_glfw.x11.display, "UTF8_STRING", False); _glfw.x11.COMPOUND_STRING = @@ -539,54 +605,30 @@ static GLboolean initExtensions(void) _glfw.x11.SAVE_TARGETS = XInternAtom(_glfw.x11.display, "SAVE_TARGETS", False); + // Find Xdnd (drag and drop) atoms, if available + _glfw.x11.XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", True); + _glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", True); + _glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", True); + _glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", True); + _glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", True); + _glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", True); + _glfw.x11.XdndLeave = XInternAtom(_glfw.x11.display, "XdndLeave", True); + _glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", True); + _glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", True); + return GL_TRUE; } -// Create a blank cursor (for locked mouse mode) +// Create a blank cursor for hidden and disabled cursor modes // static Cursor createNULLCursor(void) { - Pixmap cursormask; - XGCValues xgc; - GC gc; - XColor col; - Cursor cursor; + unsigned char pixels[16 * 16 * 4]; + GLFWimage image = { 16, 16, pixels }; - _glfwGrabXErrorHandler(); + memset(pixels, 0, sizeof(pixels)); - cursormask = XCreatePixmap(_glfw.x11.display, _glfw.x11.root, 1, 1, 1); - xgc.function = GXclear; - gc = XCreateGC(_glfw.x11.display, cursormask, GCFunction, &xgc); - XFillRectangle(_glfw.x11.display, cursormask, gc, 0, 0, 1, 1); - col.pixel = 0; - col.red = 0; - col.flags = 4; - cursor = XCreatePixmapCursor(_glfw.x11.display, - cursormask, cursormask, - &col, &col, 0, 0); - XFreePixmap(_glfw.x11.display, cursormask); - XFreeGC(_glfw.x11.display, gc); - - _glfwReleaseXErrorHandler(); - - if (cursor == None) - { - _glfwInputXError(GLFW_PLATFORM_ERROR, - "X11: Failed to create null cursor"); - } - - return cursor; -} - -// Terminate X11 display -// -static void terminateDisplay(void) -{ - if (_glfw.x11.display) - { - XCloseDisplay(_glfw.x11.display); - _glfw.x11.display = NULL; - } + return _glfwCreateCursor(&image, 0, 0); } // X error handler @@ -602,7 +644,7 @@ static int errorHandler(Display *display, XErrorEvent* event) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -// Install the X error handler +// Sets the X error handler callback // void _glfwGrabXErrorHandler(void) { @@ -610,7 +652,7 @@ void _glfwGrabXErrorHandler(void) XSetErrorHandler(errorHandler); } -// Remove the X error handler +// Clears the X error handler callback // void _glfwReleaseXErrorHandler(void) { @@ -619,7 +661,7 @@ void _glfwReleaseXErrorHandler(void) XSetErrorHandler(NULL); } -// Report X error +// Reports the specified error, appending information about the last X error // void _glfwInputXError(int error, const char* message) { @@ -630,6 +672,37 @@ void _glfwInputXError(int error, const char* message) _glfwInputError(error, "%s: %s", message, buffer); } +// Creates a native cursor object from the specified image and hotspot +// +Cursor _glfwCreateCursor(const GLFWimage* image, int xhot, int yhot) +{ + int i; + Cursor cursor; + + XcursorImage* native = XcursorImageCreate(image->width, image->height); + if (native == NULL) + return None; + + native->xhot = xhot; + native->yhot = yhot; + + unsigned char* source = (unsigned char*) image->pixels; + XcursorPixel* target = native->pixels; + + for (i = 0; i < image->width * image->height; i++, target++, source += 4) + { + *target = (source[3] << 24) | + (source[0] << 16) | + (source[1] << 8) | + source[2]; + } + + cursor = XcursorImageLoadCursor(_glfw.x11.display, native); + XcursorImageDestroy(native); + + return cursor; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// @@ -637,6 +710,9 @@ void _glfwInputXError(int error, const char* message) int _glfwPlatformInit(void) { + if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0) + setlocale(LC_CTYPE, ""); + XInitThreads(); _glfw.x11.display = XOpenDisplay(NULL); @@ -655,12 +731,28 @@ int _glfwPlatformInit(void) _glfw.x11.cursor = createNULLCursor(); + if (XSupportsLocale()) + { + XSetLocaleModifiers(""); + + _glfw.x11.im = XOpenIM(_glfw.x11.display, 0, 0, 0); + if (_glfw.x11.im) + { + if (!hasUsableInputMethodStyle()) + { + XCloseIM(_glfw.x11.im); + _glfw.x11.im = NULL; + } + } + } + if (!_glfwInitContextAPI()) return GL_FALSE; + if (!_glfwInitJoysticks()) + return GL_FALSE; + _glfwInitTimer(); - _glfwInitJoysticks(); - _glfwInitGammaRamp(); return GL_TRUE; } @@ -673,11 +765,22 @@ void _glfwPlatformTerminate(void) _glfw.x11.cursor = (Cursor) 0; } - free(_glfw.x11.selection.string); + free(_glfw.x11.clipboardString); + + if (_glfw.x11.im) + { + XCloseIM(_glfw.x11.im); + _glfw.x11.im = NULL; + } _glfwTerminateJoysticks(); _glfwTerminateContextAPI(); - terminateDisplay(); + + if (_glfw.x11.display) + { + XCloseDisplay(_glfw.x11.display); + _glfw.x11.display = NULL; + } } const char* _glfwPlatformGetVersionString(void) diff --git a/extern/glfw/src/x11_joystick.c b/extern/glfw/src/x11_joystick.c deleted file mode 100644 index 248ab12..0000000 --- a/extern/glfw/src/x11_joystick.c +++ /dev/null @@ -1,259 +0,0 @@ -//======================================================================== -// GLFW 3.0 X11 - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2002-2006 Marcus Geelnard -// Copyright (c) 2006-2010 Camilla Berglund -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#include "internal.h" - -#ifdef __linux__ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif // __linux__ - - -// Attempt to open the specified joystick device -// -static int openJoystickDevice(int joy, const char* path) -{ -#ifdef __linux__ - char axisCount, buttonCount; - char name[256]; - int fd, version; - - fd = open(path, O_RDONLY | O_NONBLOCK); - if (fd == -1) - return GL_FALSE; - - _glfw.x11.joystick[joy].fd = fd; - - // Verify that the joystick driver version is at least 1.0 - ioctl(fd, JSIOCGVERSION, &version); - if (version < 0x010000) - { - // It's an old 0.x interface (we don't support it) - close(fd); - return GL_FALSE; - } - - if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) - strncpy(name, "Unknown", sizeof(name)); - - _glfw.x11.joystick[joy].name = strdup(name); - - ioctl(fd, JSIOCGAXES, &axisCount); - _glfw.x11.joystick[joy].axisCount = (int) axisCount; - - ioctl(fd, JSIOCGBUTTONS, &buttonCount); - _glfw.x11.joystick[joy].buttonCount = (int) buttonCount; - - _glfw.x11.joystick[joy].axes = calloc(axisCount, sizeof(float)); - _glfw.x11.joystick[joy].buttons = calloc(buttonCount, 1); - - _glfw.x11.joystick[joy].present = GL_TRUE; -#endif // __linux__ - - return GL_TRUE; -} - -// Polls for and processes events for all present joysticks -// -static void pollJoystickEvents(void) -{ -#ifdef __linux__ - int i; - ssize_t result; - struct js_event e; - - for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) - { - if (!_glfw.x11.joystick[i].present) - continue; - - // Read all queued events (non-blocking) - for (;;) - { - errno = 0; - result = read(_glfw.x11.joystick[i].fd, &e, sizeof(e)); - - if (errno == ENODEV) - { - free(_glfw.x11.joystick[i].axes); - free(_glfw.x11.joystick[i].buttons); - free(_glfw.x11.joystick[i].name); - _glfw.x11.joystick[i].present = GL_FALSE; - } - - if (result == -1) - break; - - // We don't care if it's an init event or not - e.type &= ~JS_EVENT_INIT; - - switch (e.type) - { - case JS_EVENT_AXIS: - _glfw.x11.joystick[i].axes[e.number] = - (float) e.value / 32767.0f; - break; - - case JS_EVENT_BUTTON: - _glfw.x11.joystick[i].buttons[e.number] = - e.value ? GLFW_PRESS : GLFW_RELEASE; - break; - - default: - break; - } - } - } -#endif // __linux__ -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -// Initialize joystick interface -// -void _glfwInitJoysticks(void) -{ -#ifdef __linux__ - int joy = 0; - size_t i; - regex_t regex; - DIR* dir; - const char* dirs[] = - { - "/dev/input", - "/dev" - }; - - if (regcomp(®ex, "^js[0-9]\\+$", 0) != 0) - { - _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to compile regex"); - return; - } - - for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++) - { - struct dirent* entry; - - dir = opendir(dirs[i]); - if (!dir) - continue; - - while ((entry = readdir(dir))) - { - char path[20]; - regmatch_t match; - - if (regexec(®ex, entry->d_name, 1, &match, 0) != 0) - continue; - - snprintf(path, sizeof(path), "%s/%s", dirs[i], entry->d_name); - if (openJoystickDevice(joy, path)) - joy++; - } - - closedir(dir); - } - - regfree(®ex); -#endif // __linux__ -} - -// Close all opened joystick handles -// -void _glfwTerminateJoysticks(void) -{ -#ifdef __linux__ - int i; - - for (i = 0; i <= GLFW_JOYSTICK_LAST; i++) - { - if (_glfw.x11.joystick[i].present) - { - close(_glfw.x11.joystick[i].fd); - free(_glfw.x11.joystick[i].axes); - free(_glfw.x11.joystick[i].buttons); - free(_glfw.x11.joystick[i].name); - - _glfw.x11.joystick[i].present = GL_FALSE; - } - } -#endif // __linux__ -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -int _glfwPlatformJoystickPresent(int joy) -{ - pollJoystickEvents(); - - return _glfw.x11.joystick[joy].present; -} - -const float* _glfwPlatformGetJoystickAxes(int joy, int* count) -{ - pollJoystickEvents(); - - if (!_glfw.x11.joystick[joy].present) - return NULL; - - *count = _glfw.x11.joystick[joy].axisCount; - return _glfw.x11.joystick[joy].axes; -} - -const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count) -{ - pollJoystickEvents(); - - if (!_glfw.x11.joystick[joy].present) - return NULL; - - *count = _glfw.x11.joystick[joy].buttonCount; - return _glfw.x11.joystick[joy].buttons; -} - -const char* _glfwPlatformGetJoystickName(int joy) -{ - pollJoystickEvents(); - - return _glfw.x11.joystick[joy].name; -} - diff --git a/extern/glfw/src/x11_monitor.c b/extern/glfw/src/x11_monitor.c index 48d47b4..6265070 100644 --- a/extern/glfw/src/x11_monitor.c +++ b/extern/glfw/src/x11_monitor.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 X11 - www.glfw.org +// GLFW 3.1 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -32,14 +32,25 @@ #include -static int calculateRefreshRate(const XRRModeInfo* mi) +// Check whether the display mode should be included in enumeration +// +static GLboolean modeIsGood(const XRRModeInfo* mi) { - if (!mi->hTotal || !mi->vTotal) - return 0; - - return (int) ((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal)); + return (mi->modeFlags & RR_Interlace) == 0; } +// Calculates the refresh rate, in Hz, from the specified RandR mode info +// +static int calculateRefreshRate(const XRRModeInfo* mi) +{ + if (mi->hTotal && mi->vTotal) + return (int) ((double) mi->dotClock / ((double) mi->hTotal * (double) mi->vTotal)); + else + return 0; +} + +// Returns the mode info for a RandR mode XID +// static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id) { int i; @@ -53,6 +64,32 @@ static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id) return NULL; } +// Convert RandR mode info to GLFW video mode +// +static GLFWvidmode vidmodeFromModeInfo(const XRRModeInfo* mi, + const XRRCrtcInfo* ci) +{ + GLFWvidmode mode; + + if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270) + { + mode.width = mi->height; + mode.height = mi->width; + } + else + { + mode.width = mi->width; + mode.height = mi->height; + } + + mode.refreshRate = calculateRefreshRate(mi); + + _glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen), + &mode.redBits, &mode.greenBits, &mode.blueBits); + + return mode; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// @@ -60,83 +97,76 @@ static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id) // Set the current video mode for the specified monitor // -void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) +GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired) { - if (_glfw.x11.randr.available) + if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { - int i, j; XRRScreenResources* sr; XRRCrtcInfo* ci; XRROutputInfo* oi; - RRMode bestMode = 0; - unsigned int sizeDiff, leastSizeDiff = UINT_MAX; - unsigned int rateDiff, leastRateDiff = UINT_MAX; + GLFWvidmode current; + const GLFWvidmode* best; + RRMode native = None; + int i; + + best = _glfwChooseVideoMode(monitor, desired); + _glfwPlatformGetVideoMode(monitor, ¤t); + if (_glfwCompareVideoModes(¤t, best) == 0) + return GL_TRUE; sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output); - for (i = 0; i < sr->nmode; i++) + for (i = 0; i < oi->nmode; i++) { - const XRRModeInfo* mi = sr->modes + i; - - if (mi->modeFlags & RR_Interlace) + const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]); + if (!modeIsGood(mi)) continue; - for (j = 0; j < oi->nmode; j++) + const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci); + if (_glfwCompareVideoModes(best, &mode) == 0) { - if (oi->modes[j] == mi->id) - break; - } - - if (j == oi->nmode) - continue; - - sizeDiff = (mi->width - desired->width) * - (mi->width - desired->width) + - (mi->height - desired->height) * - (mi->height - desired->height); - - if (desired->refreshRate) - rateDiff = abs(calculateRefreshRate(mi) - desired->refreshRate); - else - rateDiff = UINT_MAX - calculateRefreshRate(mi); - - if ((sizeDiff < leastSizeDiff) || - (sizeDiff == leastSizeDiff && rateDiff < leastRateDiff)) - { - bestMode = mi->id; - leastSizeDiff = sizeDiff; - leastRateDiff = rateDiff; + native = mi->id; + break; } } - if (bestMode == ci->mode) - return; + if (native) + { + if (monitor->x11.oldMode == None) + monitor->x11.oldMode = ci->mode; - if (monitor->x11.oldMode == None) - monitor->x11.oldMode = ci->mode; - - XRRSetCrtcConfig(_glfw.x11.display, - sr, monitor->x11.crtc, - CurrentTime, - ci->x, ci->y, - bestMode, - ci->rotation, - ci->outputs, - ci->noutput); + XRRSetCrtcConfig(_glfw.x11.display, + sr, monitor->x11.crtc, + CurrentTime, + ci->x, ci->y, + native, + ci->rotation, + ci->outputs, + ci->noutput); + } XRRFreeOutputInfo(oi); XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); + + if (!native) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Monitor mode list changed"); + return GL_FALSE; + } } + + return GL_TRUE; } // Restore the saved (original) video mode for the specified monitor // void _glfwRestoreVideoMode(_GLFWmonitor* monitor) { - if (_glfw.x11.randr.available) + if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr; XRRCrtcInfo* ci; @@ -170,98 +200,108 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor) _GLFWmonitor** _glfwPlatformGetMonitors(int* count) { + int i, j, k, size = 0, found = 0; _GLFWmonitor** monitors = NULL; *count = 0; if (_glfw.x11.randr.available) { - int i, found = 0; - RROutput primary; - XRRScreenResources* sr; + int screenCount = 0; + XineramaScreenInfo* screens = NULL; + XRRScreenResources* sr = XRRGetScreenResources(_glfw.x11.display, + _glfw.x11.root); + RROutput primary = XRRGetOutputPrimary(_glfw.x11.display, + _glfw.x11.root); - sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); - primary = XRRGetOutputPrimary(_glfw.x11.display, _glfw.x11.root); - - monitors = calloc(sr->ncrtc, sizeof(_GLFWmonitor*)); + if (_glfw.x11.xinerama.available) + screens = XineramaQueryScreens(_glfw.x11.display, &screenCount); for (i = 0; i < sr->ncrtc; i++) { - int j; - XRROutputInfo* oi; - XRRCrtcInfo* ci; - RROutput output; - - ci = XRRGetCrtcInfo(_glfw.x11.display, sr, sr->crtcs[i]); - if (ci->noutput == 0) - { - XRRFreeCrtcInfo(ci); - continue; - } - - output = ci->outputs[0]; + XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, + sr, sr->crtcs[i]); for (j = 0; j < ci->noutput; j++) { - if (ci->outputs[j] == primary) + int widthMM, heightMM; + XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, + sr, ci->outputs[j]); + if (oi->connection != RR_Connected) { - output = primary; - break; + XRRFreeOutputInfo(oi); + continue; + } + + if (found == size) + { + size += 4; + monitors = realloc(monitors, sizeof(_GLFWmonitor*) * size); + } + + if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270) + { + widthMM = oi->mm_height; + heightMM = oi->mm_width; + } + else + { + widthMM = oi->mm_width; + heightMM = oi->mm_height; + } + + monitors[found] = _glfwAllocMonitor(oi->name, widthMM, heightMM); + monitors[found]->x11.output = ci->outputs[j]; + monitors[found]->x11.crtc = oi->crtc; + + for (k = 0; k < screenCount; k++) + { + if (screens[k].x_org == ci->x && + screens[k].y_org == ci->y && + screens[k].width == ci->width && + screens[k].height == ci->height) + { + monitors[found]->x11.index = k; + break; + } } - } - oi = XRRGetOutputInfo(_glfw.x11.display, sr, output); - if (oi->connection != RR_Connected) - { XRRFreeOutputInfo(oi); - XRRFreeCrtcInfo(ci); - continue; + + if (ci->outputs[j] == primary) + _GLFW_SWAP_POINTERS(monitors[0], monitors[found]); + + found++; } - monitors[found] = _glfwCreateMonitor(oi->name, - oi->mm_width, oi->mm_height); - - monitors[found]->x11.output = output; - monitors[found]->x11.crtc = oi->crtc; - - XRRFreeOutputInfo(oi); XRRFreeCrtcInfo(ci); - - found++; } XRRFreeScreenResources(sr); - for (i = 0; i < found; i++) - { - if (monitors[i]->x11.output == primary) - { - _GLFWmonitor* temp = monitors[0]; - monitors[0] = monitors[i]; - monitors[i] = temp; - break; - } - } + if (screens) + XFree(screens); if (found == 0) { - free(monitors); - monitors = NULL; + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: RandR monitor support seems broken"); + _glfw.x11.randr.monitorBroken = GL_TRUE; } - - *count = found; } - else + + if (!monitors) { monitors = calloc(1, sizeof(_GLFWmonitor*)); - monitors[0] = _glfwCreateMonitor("Display", - DisplayWidthMM(_glfw.x11.display, - _glfw.x11.screen), - DisplayHeightMM(_glfw.x11.display, - _glfw.x11.screen)); - *count = 1; + monitors[0] = _glfwAllocMonitor("Display", + DisplayWidthMM(_glfw.x11.display, + _glfw.x11.screen), + DisplayHeightMM(_glfw.x11.display, + _glfw.x11.screen)); + found = 1; } + *count = found; return monitors; } @@ -272,12 +312,12 @@ GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second) void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) { - if (_glfw.x11.randr.available) + if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr; XRRCrtcInfo* ci; - sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); + sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); if (xpos) @@ -288,55 +328,41 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); } - else - { - if (xpos) - *xpos = 0; - if (ypos) - *ypos = 0; - } } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) { GLFWvidmode* result; - int depth, r, g, b; - - depth = DefaultDepth(_glfw.x11.display, _glfw.x11.screen); - _glfwSplitBPP(depth, &r, &g, &b); *found = 0; // Build array of available resolutions - if (_glfw.x11.randr.available) + if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { int i, j; XRRScreenResources* sr; + XRRCrtcInfo* ci; XRROutputInfo* oi; - sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); + sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); + ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output); result = calloc(oi->nmode, sizeof(GLFWvidmode)); for (i = 0; i < oi->nmode; i++) { - GLFWvidmode mode; const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]); + if (!modeIsGood(mi)) + continue; - mode.width = mi->width; - mode.height = mi->height; - mode.refreshRate = calculateRefreshRate(mi); + const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci); for (j = 0; j < *found; j++) { - if (result[j].width == mode.width && - result[j].height == mode.height && - result[j].refreshRate == mode.refreshRate) - { + if (_glfwCompareVideoModes(result + j, &mode) == 0) break; - } } if (j < *found) @@ -345,29 +371,19 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) continue; } - mode.redBits = r; - mode.greenBits = g; - mode.blueBits = b; - result[*found] = mode; (*found)++; } XRRFreeOutputInfo(oi); + XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); } else { *found = 1; - result = calloc(1, sizeof(GLFWvidmode)); - - result[0].width = DisplayWidth(_glfw.x11.display, _glfw.x11.screen); - result[0].height = DisplayHeight(_glfw.x11.display, _glfw.x11.screen); - result[0].redBits = r; - result[0].greenBits = g; - result[0].blueBits = b; - result[0].refreshRate = 0; + _glfwPlatformGetVideoMode(monitor, result); } return result; @@ -375,18 +391,15 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { - if (_glfw.x11.randr.available) + if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRScreenResources* sr; XRRCrtcInfo* ci; - sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root); + sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root); ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc); - mode->width = ci->width; - mode->height = ci->height; - - mode->refreshRate = calculateRefreshRate(getModeInfo(sr, ci->mode)); + *mode = vidmodeFromModeInfo(getModeInfo(sr, ci->mode), ci); XRRFreeCrtcInfo(ci); XRRFreeScreenResources(sr); @@ -396,9 +409,82 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) mode->width = DisplayWidth(_glfw.x11.display, _glfw.x11.screen); mode->height = DisplayHeight(_glfw.x11.display, _glfw.x11.screen); mode->refreshRate = 0; - } - _glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen), - &mode->redBits, &mode->greenBits, &mode->blueBits); + _glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen), + &mode->redBits, &mode->greenBits, &mode->blueBits); + } +} + +void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +{ + if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) + { + const size_t size = XRRGetCrtcGammaSize(_glfw.x11.display, + monitor->x11.crtc); + XRRCrtcGamma* gamma = XRRGetCrtcGamma(_glfw.x11.display, + monitor->x11.crtc); + + _glfwAllocGammaArrays(ramp, size); + + memcpy(ramp->red, gamma->red, size * sizeof(unsigned short)); + memcpy(ramp->green, gamma->green, size * sizeof(unsigned short)); + memcpy(ramp->blue, gamma->blue, size * sizeof(unsigned short)); + + XRRFreeGamma(gamma); + } + else if (_glfw.x11.vidmode.available) + { + int size; + XF86VidModeGetGammaRampSize(_glfw.x11.display, _glfw.x11.screen, &size); + + _glfwAllocGammaArrays(ramp, size); + + XF86VidModeGetGammaRamp(_glfw.x11.display, + _glfw.x11.screen, + ramp->size, ramp->red, ramp->green, ramp->blue); + } +} + +void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) +{ + if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) + { + XRRCrtcGamma* gamma = XRRAllocGamma(ramp->size); + + memcpy(gamma->red, ramp->red, ramp->size * sizeof(unsigned short)); + memcpy(gamma->green, ramp->green, ramp->size * sizeof(unsigned short)); + memcpy(gamma->blue, ramp->blue, ramp->size * sizeof(unsigned short)); + + XRRSetCrtcGamma(_glfw.x11.display, monitor->x11.crtc, gamma); + XRRFreeGamma(gamma); + } + else if (_glfw.x11.vidmode.available) + { + XF86VidModeSetGammaRamp(_glfw.x11.display, + _glfw.x11.screen, + ramp->size, + (unsigned short*) ramp->red, + (unsigned short*) ramp->green, + (unsigned short*) ramp->blue); + } +} + + +////////////////////////////////////////////////////////////////////////// +////// GLFW native API ////// +////////////////////////////////////////////////////////////////////////// + +GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* handle) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(None); + return monitor->x11.crtc; +} + +GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle) +{ + _GLFWmonitor* monitor = (_GLFWmonitor*) handle; + _GLFW_REQUIRE_INIT_OR_RETURN(None); + return monitor->x11.output; } diff --git a/extern/glfw/src/x11_platform.h b/extern/glfw/src/x11_platform.h index f812938..81d1bef 100644 --- a/extern/glfw/src/x11_platform.h +++ b/extern/glfw/src/x11_platform.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 X11 - www.glfw.org +// GLFW 3.1 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -31,9 +31,11 @@ #include #include #include + #include #include #include +#include // The Xf86VidMode extension provides fallback gamma control #include @@ -47,41 +49,42 @@ // The Xkb extension provides improved keyboard support #include +// The Xinerama extension provides legacy monitor indices +#include + +#include "posix_tls.h" + #if defined(_GLFW_GLX) #define _GLFW_X11_CONTEXT_VISUAL window->glx.visual - #include "glx_platform.h" + #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_platform.h" + #include "egl_context.h" #else #error "No supported context creation API selected" #endif +#include "posix_time.h" +#include "linux_joystick.h" +#include "xkb_unicode.h" + #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 x11 #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11 #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorX11 x11 +#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorX11 x11 -//======================================================================== -// GLFW platform specific types -//======================================================================== - - -//------------------------------------------------------------------------ -// Platform-specific window structure -//------------------------------------------------------------------------ +// X11-specific per-window data +// typedef struct _GLFWwindowX11 { - // Platform specific window resources - Colormap colormap; // Window colormap - Window handle; // Window handle + Colormap colormap; + Window handle; + XIC ic; - // Various platform specific internal variables - GLboolean overrideRedirect; // True if window is OverrideRedirect - GLboolean cursorGrabbed; // True if cursor is currently grabbed - GLboolean cursorHidden; // True if cursor is currently hidden + GLboolean overrideRedirect; // Cached position and size used to filter out duplicate events int width, height; @@ -95,9 +98,8 @@ typedef struct _GLFWwindowX11 } _GLFWwindowX11; -//------------------------------------------------------------------------ -// Platform-specific library global data for X11 -//------------------------------------------------------------------------ +// X11-specific global data +// typedef struct _GLFWlibraryX11 { Display* display; @@ -106,9 +108,21 @@ typedef struct _GLFWlibraryX11 // Invisible cursor for hidden cursor mode Cursor cursor; + // Context for mapping window XIDs to _GLFWwindow pointers XContext context; + // XIM input method + XIM im; + // True if window manager supports EWMH + GLboolean hasEWMH; + // Most recent error code received by X error handler + int errorCode; + // Clipboard string (while the selection is owned) + char* clipboardString; + // X11 keycode to GLFW key LUT + short int publicKeys[256]; // Window manager atoms + Atom WM_PROTOCOLS; Atom WM_STATE; Atom WM_DELETE_WINDOW; Atom NET_WM_NAME; @@ -116,28 +130,38 @@ typedef struct _GLFWlibraryX11 Atom NET_WM_PID; Atom NET_WM_PING; Atom NET_WM_STATE; + Atom NET_WM_STATE_ABOVE; Atom NET_WM_STATE_FULLSCREEN; Atom NET_WM_BYPASS_COMPOSITOR; + Atom NET_WM_FULLSCREEN_MONITORS; Atom NET_ACTIVE_WINDOW; + Atom NET_FRAME_EXTENTS; + Atom NET_REQUEST_FRAME_EXTENTS; Atom MOTIF_WM_HINTS; - // Selection atoms + // Xdnd (drag and drop) atoms + Atom XdndAware; + Atom XdndEnter; + Atom XdndPosition; + Atom XdndStatus; + Atom XdndActionCopy; + Atom XdndDrop; + Atom XdndLeave; + Atom XdndFinished; + Atom XdndSelection; + + // Selection (clipboard) atoms Atom TARGETS; Atom MULTIPLE; Atom CLIPBOARD; Atom CLIPBOARD_MANAGER; Atom SAVE_TARGETS; + Atom _NULL; Atom UTF8_STRING; Atom COMPOUND_STRING; Atom ATOM_PAIR; Atom GLFW_SELECTION; - // True if window manager supports EWMH - GLboolean hasEWMH; - - // Error code received by the X error handler - int errorCode; - struct { GLboolean available; int eventBase; @@ -151,9 +175,12 @@ typedef struct _GLFWlibraryX11 int versionMajor; int versionMinor; GLboolean gammaBroken; + GLboolean monitorBroken; } randr; struct { + GLboolean available; + GLboolean detectable; int majorOpcode; int eventBase; int errorBase; @@ -170,9 +197,6 @@ typedef struct _GLFWlibraryX11 int versionMinor; } xi; - // LUT for mapping X11 key codes to GLFW key codes - int keyCodeLUT[256]; - struct { int count; int timeout; @@ -182,82 +206,52 @@ typedef struct _GLFWlibraryX11 } saver; struct { - GLboolean monotonic; - double resolution; - uint64_t base; - } timer; + Window source; + } xdnd; struct { - char* string; - } selection; - - struct { - int present; - int fd; - float* axes; - int axisCount; - unsigned char* buttons; - int buttonCount; - char* name; - } joystick[GLFW_JOYSTICK_LAST + 1]; + GLboolean available; + int versionMajor; + int versionMinor; + } xinerama; } _GLFWlibraryX11; -//------------------------------------------------------------------------ -// Platform-specific monitor structure -//------------------------------------------------------------------------ +// X11-specific per-monitor data +// typedef struct _GLFWmonitorX11 { RROutput output; RRCrtc crtc; RRMode oldMode; + // Index of corresponding Xinerama screen, + // for EWMH full screen window placement + int index; + } _GLFWmonitorX11; -//======================================================================== -// Prototypes for platform specific internal functions -//======================================================================== +// X11-specific per-cursor data +// +typedef struct _GLFWcursorX11 +{ + Cursor handle; -// Time -void _glfwInitTimer(void); +} _GLFWcursorX11; -// Gamma -void _glfwInitGammaRamp(void); -// OpenGL support -int _glfwInitContextAPI(void); -void _glfwTerminateContextAPI(void); -int _glfwCreateContext(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig); -void _glfwDestroyContext(_GLFWwindow* window); - -// Fullscreen support -void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired); +GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoMode(_GLFWmonitor* monitor); -// Joystick input -void _glfwInitJoysticks(void); -void _glfwTerminateJoysticks(void); +Cursor _glfwCreateCursor(const GLFWimage* image, int xhot, int yhot); -// Unicode support -long _glfwKeySym2Unicode(KeySym keysym); - -// Clipboard handling -void _glfwHandleSelectionClear(XEvent* event); -void _glfwHandleSelectionRequest(XEvent* event); -void _glfwPushSelectionToManager(_GLFWwindow* window); - -// Window support -_GLFWwindow* _glfwFindWindowByHandle(Window handle); unsigned long _glfwGetWindowProperty(Window window, Atom property, Atom type, unsigned char** value); -// X11 error handler void _glfwGrabXErrorHandler(void); void _glfwReleaseXErrorHandler(void); void _glfwInputXError(int error, const char* message); diff --git a/extern/glfw/src/x11_window.c b/extern/glfw/src/x11_window.c index 7f75695..0380b58 100644 --- a/extern/glfw/src/x11_window.c +++ b/extern/glfw/src/x11_window.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 X11 - www.glfw.org +// GLFW 3.1 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -27,6 +27,8 @@ #include "internal.h" +#include + #include #include @@ -45,16 +47,72 @@ typedef struct { - unsigned long flags; - unsigned long functions; - unsigned long decorations; - long input_mode; - unsigned long status; + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; } MotifWmHints; #define MWM_HINTS_DECORATIONS (1L << 1) +// Returns whether the window is iconified +// +static int getWindowState(_GLFWwindow* window) +{ + int result = WithdrawnState; + struct { + CARD32 state; + Window icon; + } *state = NULL; + + if (_glfwGetWindowProperty(window->x11.handle, + _glfw.x11.WM_STATE, + _glfw.x11.WM_STATE, + (unsigned char**) &state) >= 2) + { + result = state->state; + } + + XFree(state); + return result; +} + +// Returns whether the event is a selection event +// +static Bool isFrameExtentsEvent(Display* display, XEvent* event, XPointer pointer) +{ + _GLFWwindow* window = (_GLFWwindow*) pointer; + return event->type == PropertyNotify && + event->xproperty.state == PropertyNewValue && + event->xproperty.window == window->x11.handle && + event->xproperty.atom == _glfw.x11.NET_FRAME_EXTENTS; +} + +// Translates a GLFW standard cursor to a font cursor shape +// +static int translateCursorShape(int shape) +{ + switch (shape) + { + case GLFW_ARROW_CURSOR: + return XC_arrow; + case GLFW_IBEAM_CURSOR: + return XC_xterm; + case GLFW_CROSSHAIR_CURSOR: + return XC_crosshair; + case GLFW_HAND_CURSOR: + return XC_hand1; + case GLFW_HRESIZE_CURSOR: + return XC_sb_h_double_arrow; + case GLFW_VRESIZE_CURSOR: + return XC_sb_v_double_arrow; + } + + return 0; +} + // Translates an X event modifier state mask // static int translateState(int state) @@ -75,26 +133,98 @@ static int translateState(int state) // Translates an X Window key to internal coding // -static int translateKey(int keycode) +static int translateKey(int scancode) { - // Use the pre-filled LUT (see updateKeyCodeLUT() in x11_init.c) - if ((keycode >= 0) && (keycode < 256)) - return _glfw.x11.keyCodeLUT[keycode]; + // Use the pre-filled LUT (see createKeyTables() in x11_init.c) + if (scancode < 0 || scancode > 255) + return GLFW_KEY_UNKNOWN; - return GLFW_KEY_UNKNOWN; + return _glfw.x11.publicKeys[scancode]; } -// Translates an X Window event to Unicode +// Return the GLFW window corresponding to the specified X11 window // -static int translateChar(XKeyEvent* event) +static _GLFWwindow* findWindowByHandle(Window handle) { - KeySym keysym; + _GLFWwindow* window; - // Get X11 keysym - XLookupString(event, NULL, 0, &keysym, NULL); + if (XFindContext(_glfw.x11.display, + handle, + _glfw.x11.context, + (XPointer*) &window) != 0) + { + return NULL; + } - // Convert to Unicode (see x11_unicode.c) - return (int) _glfwKeySym2Unicode(keysym); + return window; +} + +// Adds or removes an EWMH state to a window +// +static void changeWindowState(_GLFWwindow* window, Atom state, int action) +{ + XEvent event; + memset(&event, 0, sizeof(event)); + + event.type = ClientMessage; + event.xclient.window = window->x11.handle; + event.xclient.format = 32; // Data is 32-bit longs + event.xclient.message_type = _glfw.x11.NET_WM_STATE; + event.xclient.data.l[0] = action; + event.xclient.data.l[1] = state; + event.xclient.data.l[2] = 0; // No secondary property + event.xclient.data.l[3] = 1; // Sender is a normal application + + XSendEvent(_glfw.x11.display, + _glfw.x11.root, + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &event); +} + +// Splits and translates a text/uri-list into separate file paths +// +static char** parseUriList(char* text, int* count) +{ + const char* prefix = "file://"; + char** names = NULL; + char* line; + + *count = 0; + + while ((line = strtok(text, "\r\n"))) + { + text = NULL; + + if (*line == '#') + continue; + + if (strncmp(line, prefix, strlen(prefix)) == 0) + line += strlen(prefix); + + (*count)++; + + char* name = calloc(strlen(line) + 1, 1); + names = realloc(names, *count * sizeof(char*)); + names[*count - 1] = name; + + while (*line) + { + if (line[0] == '%' && line[1] && line[2]) + { + const char digits[3] = { line[1], line[2], '\0' }; + *name = strtol(digits, NULL, 16); + line += 2; + } + else + *name = *line; + + name++; + line++; + } + } + + return names; } // Create the X11 window (and its colormap) @@ -126,16 +256,6 @@ static GLboolean createWindow(_GLFWwindow* window, ExposureMask | FocusChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; - if (wndconfig->monitor == NULL) - { - // HACK: This is a workaround for windows without a background pixel - // not getting any decorations on certain older versions of - // Compiz running on Intel hardware - wa.background_pixel = BlackPixel(_glfw.x11.display, - _glfw.x11.screen); - wamask |= CWBackPixel; - } - _glfwGrabXErrorHandler(); window->x11.handle = XCreateWindow(_glfw.x11.display, @@ -183,7 +303,7 @@ static GLboolean createWindow(_GLFWwindow* window, // This is the butcher's way of removing window decorations // Setting the override-redirect attribute on a window makes the window // manager ignore the window completely (ICCCM, section 4) - // The good thing is that this makes undecorated fullscreen windows + // The good thing is that this makes undecorated full screen windows // easy to do; the bad thing is that we have to do everything manually // and some things (like iconify/restore) won't work at all, as those // are tasks usually performed by the window manager @@ -306,78 +426,312 @@ static GLboolean createWindow(_GLFWwindow* window, XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1); } + if (_glfw.x11.XdndAware) + { + // Announce support for Xdnd (drag and drop) + const Atom version = 5; + XChangeProperty(_glfw.x11.display, window->x11.handle, + _glfw.x11.XdndAware, XA_ATOM, 32, + PropModeReplace, (unsigned char*) &version, 1); + } + + if (_glfw.x11.NET_REQUEST_FRAME_EXTENTS) + { + // Ensure _NET_FRAME_EXTENTS is set, allowing glfwGetWindowFrameSize to + // function before the window is mapped + + XEvent event; + memset(&event, 0, sizeof(event)); + + event.type = ClientMessage; + event.xclient.window = window->x11.handle; + event.xclient.format = 32; // Data is 32-bit longs + event.xclient.message_type = _glfw.x11.NET_REQUEST_FRAME_EXTENTS; + + XSendEvent(_glfw.x11.display, + _glfw.x11.root, + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &event); + XIfEvent(_glfw.x11.display, &event, isFrameExtentsEvent, (XPointer) window); + } + + if (wndconfig->floating && !wndconfig->monitor) + { + if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE) + { + changeWindowState(window, + _glfw.x11.NET_WM_STATE_ABOVE, + _NET_WM_STATE_ADD); + } + } + _glfwPlatformSetWindowTitle(window, wndconfig->title); XRRSelectInput(_glfw.x11.display, window->x11.handle, RRScreenChangeNotifyMask); + if (_glfw.x11.im) + { + window->x11.ic = XCreateIC(_glfw.x11.im, + XNInputStyle, + XIMPreeditNothing | XIMStatusNothing, + XNClientWindow, + window->x11.handle, + XNFocusWindow, + window->x11.handle, + NULL); + } + _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); return GL_TRUE; } -// Hide cursor +// Hide the mouse cursor // static void hideCursor(_GLFWwindow* window) { - // Un-grab cursor (in windowed mode only; in fullscreen mode we still - // want the cursor grabbed in order to confine the cursor to the window - // area) - if (window->x11.cursorGrabbed && window->monitor == NULL) - { - XUngrabPointer(_glfw.x11.display, CurrentTime); - window->x11.cursorGrabbed = GL_FALSE; - } - - if (!window->x11.cursorHidden) - { - XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.cursor); - window->x11.cursorHidden = GL_TRUE; - } + XUngrabPointer(_glfw.x11.display, CurrentTime); + XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.cursor); } -// Capture cursor +// Disable the mouse cursor // -static void captureCursor(_GLFWwindow* window) +static void disableCursor(_GLFWwindow* window) { - hideCursor(window); + XGrabPointer(_glfw.x11.display, window->x11.handle, True, + ButtonPressMask | ButtonReleaseMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + window->x11.handle, _glfw.x11.cursor, CurrentTime); +} - if (!window->x11.cursorGrabbed) +// Restores the mouse cursor +// +static void restoreCursor(_GLFWwindow* window) +{ + XUngrabPointer(_glfw.x11.display, CurrentTime); + + if (window->cursor) { - if (XGrabPointer(_glfw.x11.display, window->x11.handle, True, - ButtonPressMask | ButtonReleaseMask | - PointerMotionMask, GrabModeAsync, GrabModeAsync, - window->x11.handle, None, CurrentTime) == - GrabSuccess) + 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 +// +static Bool isSelectionEvent(Display* display, XEvent* event, XPointer pointer) +{ + return event->type == SelectionRequest || + event->type == SelectionNotify || + event->type == SelectionClear; +} + +// Set the specified property to the selection converted to the requested target +// +static Atom writeTargetToProperty(const XSelectionRequestEvent* request) +{ + int i; + const Atom formats[] = { _glfw.x11.UTF8_STRING, + _glfw.x11.COMPOUND_STRING, + XA_STRING }; + const int formatCount = sizeof(formats) / sizeof(formats[0]); + + if (request->property == None) + { + // The requester is a legacy client (ICCCM section 2.2) + // We don't support legacy clients, so fail here + return None; + } + + if (request->target == _glfw.x11.TARGETS) + { + // The list of supported targets was requested + + const Atom targets[] = { _glfw.x11.TARGETS, + _glfw.x11.MULTIPLE, + _glfw.x11.UTF8_STRING, + _glfw.x11.COMPOUND_STRING, + XA_STRING }; + + XChangeProperty(_glfw.x11.display, + request->requestor, + request->property, + XA_ATOM, + 32, + PropModeReplace, + (unsigned char*) targets, + sizeof(targets) / sizeof(targets[0])); + + return request->property; + } + + if (request->target == _glfw.x11.MULTIPLE) + { + // Multiple conversions were requested + + Atom* targets; + unsigned long i, count; + + count = _glfwGetWindowProperty(request->requestor, + request->property, + _glfw.x11.ATOM_PAIR, + (unsigned char**) &targets); + + for (i = 0; i < count; i += 2) { - window->x11.cursorGrabbed = GL_TRUE; + int j; + + for (j = 0; j < formatCount; j++) + { + if (targets[i] == formats[j]) + break; + } + + if (j < formatCount) + { + XChangeProperty(_glfw.x11.display, + request->requestor, + targets[i + 1], + targets[i], + 8, + PropModeReplace, + (unsigned char*) _glfw.x11.clipboardString, + strlen(_glfw.x11.clipboardString)); + } + else + targets[i + 1] = None; + } + + XChangeProperty(_glfw.x11.display, + request->requestor, + request->property, + _glfw.x11.ATOM_PAIR, + 32, + PropModeReplace, + (unsigned char*) targets, + count); + + XFree(targets); + + return request->property; + } + + if (request->target == _glfw.x11.SAVE_TARGETS) + { + // The request is a check whether we support SAVE_TARGETS + // It should be handled as a no-op side effect target + + XChangeProperty(_glfw.x11.display, + request->requestor, + request->property, + _glfw.x11._NULL, + 32, + PropModeReplace, + NULL, + 0); + + return request->property; + } + + // Conversion to a data target was requested + + for (i = 0; i < formatCount; i++) + { + if (request->target == formats[i]) + { + // The requested target is one we support + + XChangeProperty(_glfw.x11.display, + request->requestor, + request->property, + request->target, + 8, + PropModeReplace, + (unsigned char*) _glfw.x11.clipboardString, + strlen(_glfw.x11.clipboardString)); + + return request->property; + } + } + + // The requested target is not supported + + return None; +} + +static void handleSelectionClear(XEvent* event) +{ + free(_glfw.x11.clipboardString); + _glfw.x11.clipboardString = NULL; +} + +static void handleSelectionRequest(XEvent* event) +{ + const XSelectionRequestEvent* request = &event->xselectionrequest; + + XEvent response; + memset(&response, 0, sizeof(response)); + + response.xselection.property = writeTargetToProperty(request); + response.xselection.type = SelectionNotify; + response.xselection.display = request->display; + response.xselection.requestor = request->requestor; + response.xselection.selection = request->selection; + response.xselection.target = request->target; + response.xselection.time = request->time; + + XSendEvent(_glfw.x11.display, request->requestor, False, 0, &response); +} + +static void pushSelectionToManager(_GLFWwindow* window) +{ + XConvertSelection(_glfw.x11.display, + _glfw.x11.CLIPBOARD_MANAGER, + _glfw.x11.SAVE_TARGETS, + None, + window->x11.handle, + CurrentTime); + + for (;;) + { + XEvent event; + + if (!XCheckIfEvent(_glfw.x11.display, &event, isSelectionEvent, NULL)) + continue; + + switch (event.type) + { + case SelectionRequest: + handleSelectionRequest(&event); + break; + + case SelectionClear: + handleSelectionClear(&event); + break; + + case SelectionNotify: + { + if (event.xselection.target == _glfw.x11.SAVE_TARGETS) + { + // This means one of two things; either the selection was + // not owned, which means there is no clipboard manager, or + // the transfer to the clipboard manager has completed + // In either case, it means we are done here + return; + } + + break; + } } } } -// Show cursor -// -static void showCursor(_GLFWwindow* window) -{ - // Un-grab cursor (in windowed mode only; in fullscreen mode we still - // want the cursor grabbed in order to confine the cursor to the window - // area) - if (window->x11.cursorGrabbed && window->monitor == NULL) - { - XUngrabPointer(_glfw.x11.display, CurrentTime); - window->x11.cursorGrabbed = GL_FALSE; - } - - // Show cursor - if (window->x11.cursorHidden) - { - XUndefineCursor(_glfw.x11.display, window->x11.handle); - window->x11.cursorHidden = GL_FALSE; - } -} - -// Enter fullscreen mode +// Enter full screen mode // static void enterFullscreenMode(_GLFWwindow* window) { @@ -408,6 +762,27 @@ static void enterFullscreenMode(_GLFWwindow* window) PropModeReplace, (unsigned char*) &value, 1); } + if (_glfw.x11.xinerama.available && _glfw.x11.NET_WM_FULLSCREEN_MONITORS) + { + XEvent event; + memset(&event, 0, sizeof(event)); + + event.type = ClientMessage; + event.xclient.window = window->x11.handle; + event.xclient.format = 32; // Data is 32-bit longs + event.xclient.message_type = _glfw.x11.NET_WM_FULLSCREEN_MONITORS; + event.xclient.data.l[0] = window->monitor->x11.index; + event.xclient.data.l[1] = window->monitor->x11.index; + event.xclient.data.l[2] = window->monitor->x11.index; + event.xclient.data.l[3] = window->monitor->x11.index; + + XSendEvent(_glfw.x11.display, + _glfw.x11.root, + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &event); + } + if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) { int x, y; @@ -437,46 +812,34 @@ static void enterFullscreenMode(_GLFWwindow* window) &event); } - // Ask the window manager to make the GLFW window a fullscreen window - // Fullscreen windows are undecorated and, when focused, are kept + // Ask the window manager to make the GLFW window a full screen window + // Full screen windows are undecorated and, when focused, are kept // on top of all other windows - XEvent event; - memset(&event, 0, sizeof(event)); - - event.type = ClientMessage; - event.xclient.window = window->x11.handle; - event.xclient.format = 32; // Data is 32-bit longs - event.xclient.message_type = _glfw.x11.NET_WM_STATE; - event.xclient.data.l[0] = _NET_WM_STATE_ADD; - event.xclient.data.l[1] = _glfw.x11.NET_WM_STATE_FULLSCREEN; - event.xclient.data.l[2] = 0; // No secondary property - event.xclient.data.l[3] = 1; // Sender is a normal application - - XSendEvent(_glfw.x11.display, - _glfw.x11.root, - False, - SubstructureNotifyMask | SubstructureRedirectMask, - &event); + changeWindowState(window, + _glfw.x11.NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_ADD); } else if (window->x11.overrideRedirect) { // In override-redirect mode we have divorced ourselves from the // window manager, so we need to do everything manually - + int xpos, ypos; GLFWvidmode mode; + + _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); _glfwPlatformGetVideoMode(window->monitor, &mode); XRaiseWindow(_glfw.x11.display, window->x11.handle); XSetInputFocus(_glfw.x11.display, window->x11.handle, RevertToParent, CurrentTime); - XMoveWindow(_glfw.x11.display, window->x11.handle, 0, 0); + XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos); XResizeWindow(_glfw.x11.display, window->x11.handle, mode.width, mode.height); } } -// Leave fullscreen mode +// Leave full screen mode // static void leaveFullscreenMode(_GLFWwindow* window) { @@ -508,23 +871,9 @@ static void leaveFullscreenMode(_GLFWwindow* window) // Ask the window manager to make the GLFW window a normal window // Normal windows usually have frames and other decorations - XEvent event; - memset(&event, 0, sizeof(event)); - - event.type = ClientMessage; - event.xclient.window = window->x11.handle; - event.xclient.format = 32; // Data is 32-bit longs - event.xclient.message_type = _glfw.x11.NET_WM_STATE; - event.xclient.data.l[0] = _NET_WM_STATE_REMOVE; - event.xclient.data.l[1] = _glfw.x11.NET_WM_STATE_FULLSCREEN; - event.xclient.data.l[2] = 0; // No secondary property - event.xclient.data.l[3] = 1; // Sender is a normal application - - XSendEvent(_glfw.x11.display, - _glfw.x11.root, - False, - SubstructureNotifyMask | SubstructureRedirectMask, - &event); + changeWindowState(window, + _glfw.x11.NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_REMOVE); } } @@ -536,7 +885,7 @@ static void processEvent(XEvent *event) if (event->type != GenericEvent) { - window = _glfwFindWindowByHandle(event->xany.window); + window = findWindowByHandle(event->xany.window); if (window == NULL) { // This is an event for a window that has already been destroyed @@ -550,12 +899,44 @@ static void processEvent(XEvent *event) { const int key = translateKey(event->xkey.keycode); const int mods = translateState(event->xkey.state); - const int character = translateChar(&event->xkey); + const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); - _glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods); + if (event->xkey.keycode) + _glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods); - if (character != -1) - _glfwInputChar(window, character); + if (window->x11.ic) + { + // Translate keys to characters with XIM input context + + int i; + Status status; + wchar_t buffer[16]; + + if (XFilterEvent(event, None)) + { + // Discard intermediary (dead key) events for character input + break; + } + + const int count = XwcLookupString(window->x11.ic, + &event->xkey, + buffer, sizeof(buffer), + NULL, &status); + + for (i = 0; i < count; i++) + _glfwInputChar(window, buffer[i], mods, plain); + } + else + { + // Translate keys to characters with fallback lookup table + + KeySym keysym; + XLookupString(&event->xkey, NULL, 0, &keysym, NULL); + + const long character = _glfwKeySym2Unicode(keysym); + if (character != -1) + _glfwInputChar(window, character, mods, plain); + } break; } @@ -565,6 +946,37 @@ static void processEvent(XEvent *event) const int key = translateKey(event->xkey.keycode); const int mods = translateState(event->xkey.state); + if (!_glfw.x11.xkb.detectable) + { + // HACK: Key repeat events will arrive as KeyRelease/KeyPress + // pairs with similar or identical time stamps + // The key repeat logic in _glfwInputKey expects only key + // presses to repeat, so detect and discard release events + if (XEventsQueued(_glfw.x11.display, QueuedAfterReading)) + { + XEvent nextEvent; + XPeekEvent(_glfw.x11.display, &nextEvent); + + if (nextEvent.type == KeyPress && + nextEvent.xkey.window == event->xkey.window && + nextEvent.xkey.keycode == event->xkey.keycode) + { + // HACK: Repeat events sometimes leak through due to + // some sort of time drift, so add an epsilon + // Toshiyuki Takahashi can press a button 16 times + // per second so it's fairly safe to assume that + // no human is pressing the key 50 times per + // second (value is ms) + if ((nextEvent.xkey.time - event->xkey.time) < 20) + { + // This is very likely a server-generated key repeat + // event, so ignore it + break; + } + } + } + } + _glfwInputKey(window, key, event->xkey.keycode, GLFW_RELEASE, mods); break; } @@ -586,9 +998,9 @@ static void processEvent(XEvent *event) else if (event->xbutton.button == Button5) _glfwInputScroll(window, 0.0, -1.0); else if (event->xbutton.button == Button6) - _glfwInputScroll(window, -1.0, 0.0); - else if (event->xbutton.button == Button7) _glfwInputScroll(window, 1.0, 0.0); + else if (event->xbutton.button == Button7) + _glfwInputScroll(window, -1.0, 0.0); else { @@ -642,50 +1054,40 @@ static void processEvent(XEvent *event) case EnterNotify: { - if (window->cursorMode == GLFW_CURSOR_HIDDEN) - hideCursor(window); - _glfwInputCursorEnter(window, GL_TRUE); break; } case LeaveNotify: { - if (window->cursorMode == GLFW_CURSOR_HIDDEN) - showCursor(window); - _glfwInputCursorEnter(window, GL_FALSE); break; } case MotionNotify: { - if (event->xmotion.x != window->x11.warpPosX || - event->xmotion.y != window->x11.warpPosY) + const int x = event->xmotion.x; + const int y = event->xmotion.y; + + if (x != window->x11.warpPosX || y != window->x11.warpPosY) { // The cursor was moved by something other than GLFW - int x, y; - if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (_glfw.focusedWindow != window) break; - x = event->xmotion.x - window->x11.cursorPosX; - y = event->xmotion.y - window->x11.cursorPosY; + _glfwInputCursorMotion(window, + x - window->x11.cursorPosX, + y - window->x11.cursorPosY); } else - { - x = event->xmotion.x; - y = event->xmotion.y; - } - - _glfwInputCursorMotion(window, x, y); + _glfwInputCursorMotion(window, x, y); } - window->x11.cursorPosX = event->xmotion.x; - window->x11.cursorPosY = event->xmotion.y; + window->x11.cursorPosX = x; + window->x11.cursorPosY = y; break; } @@ -724,58 +1126,149 @@ static void processEvent(XEvent *event) { // Custom client message, probably from the window manager - if ((Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW) - { - // The window manager was asked to close the window, for example by - // the user pressing a 'close' window decoration button + if (event->xclient.message_type == None) + break; - _glfwInputWindowCloseRequest(window); + if (event->xclient.message_type == _glfw.x11.WM_PROTOCOLS) + { + if (_glfw.x11.WM_DELETE_WINDOW && + (Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW) + { + // The window manager was asked to close the window, for example by + // the user pressing a 'close' window decoration button + + _glfwInputWindowCloseRequest(window); + } + else if (_glfw.x11.NET_WM_PING && + (Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING) + { + // The window manager is pinging the application to ensure it's + // still responding to events + + event->xclient.window = _glfw.x11.root; + XSendEvent(_glfw.x11.display, + event->xclient.window, + False, + SubstructureNotifyMask | SubstructureRedirectMask, + event); + } } - else if (_glfw.x11.NET_WM_PING && - (Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING) + else if (event->xclient.message_type == _glfw.x11.XdndEnter) { - // The window manager is pinging the application to ensure it's - // still responding to events + // A drag operation has entered the window + // TODO: Check if UTF-8 string is supported by the source + } + else if (event->xclient.message_type == _glfw.x11.XdndDrop) + { + // The drag operation has finished dropping on + // the window, ask to convert it to a UTF-8 string + _glfw.x11.xdnd.source = event->xclient.data.l[0]; + XConvertSelection(_glfw.x11.display, + _glfw.x11.XdndSelection, + _glfw.x11.UTF8_STRING, + _glfw.x11.XdndSelection, + window->x11.handle, CurrentTime); + } + else if (event->xclient.message_type == _glfw.x11.XdndPosition) + { + // The drag operation has moved over the window + const int absX = (event->xclient.data.l[2] >> 16) & 0xFFFF; + const int absY = (event->xclient.data.l[2]) & 0xFFFF; + int x, y; - event->xclient.window = _glfw.x11.root; - XSendEvent(_glfw.x11.display, - event->xclient.window, - False, - SubstructureNotifyMask | SubstructureRedirectMask, - event); + _glfwPlatformGetWindowPos(window, &x, &y); + _glfwInputCursorMotion(window, absX - x, absY - y); + + // Reply that we are ready to copy the dragged data + XEvent reply; + memset(&reply, 0, sizeof(reply)); + + reply.type = ClientMessage; + reply.xclient.window = event->xclient.data.l[0]; + reply.xclient.message_type = _glfw.x11.XdndStatus; + reply.xclient.format = 32; + reply.xclient.data.l[0] = window->x11.handle; + reply.xclient.data.l[1] = 1; // Always accept the dnd with no rectangle + reply.xclient.data.l[2] = 0; // Specify an empty rectangle + reply.xclient.data.l[3] = 0; + reply.xclient.data.l[4] = _glfw.x11.XdndActionCopy; + + XSendEvent(_glfw.x11.display, event->xclient.data.l[0], + False, NoEventMask, &reply); + XFlush(_glfw.x11.display); } break; } - case MapNotify: + case SelectionNotify: { - _glfwInputWindowVisibility(window, GL_TRUE); - break; - } + if (event->xselection.property) + { + // The converted data from the drag operation has arrived + char* data; + const int result = + _glfwGetWindowProperty(event->xselection.requestor, + event->xselection.property, + event->xselection.target, + (unsigned char**) &data); + + if (result) + { + int i, count; + char** names = parseUriList(data, &count); + + _glfwInputDrop(window, count, (const char**) names); + + for (i = 0; i < count; i++) + free(names[i]); + free(names); + } + + XFree(data); + + XEvent reply; + memset(&reply, 0, sizeof(reply)); + + reply.type = ClientMessage; + reply.xclient.window = _glfw.x11.xdnd.source; + reply.xclient.message_type = _glfw.x11.XdndFinished; + reply.xclient.format = 32; + reply.xclient.data.l[0] = window->x11.handle; + reply.xclient.data.l[1] = result; + reply.xclient.data.l[2] = _glfw.x11.XdndActionCopy; + + // Reply that all is well + XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source, + False, NoEventMask, &reply); + XFlush(_glfw.x11.display); + } - case UnmapNotify: - { - _glfwInputWindowVisibility(window, GL_FALSE); break; } case FocusIn: { - _glfwInputWindowFocus(window, GL_TRUE); + if (event->xfocus.mode == NotifyNormal) + { + _glfwInputWindowFocus(window, GL_TRUE); - if (window->cursorMode == GLFW_CURSOR_DISABLED) - captureCursor(window); + if (window->cursorMode == GLFW_CURSOR_DISABLED) + disableCursor(window); + } break; } case FocusOut: { - _glfwInputWindowFocus(window, GL_FALSE); + if (event->xfocus.mode == NotifyNormal) + { + _glfwInputWindowFocus(window, GL_FALSE); - if (window->cursorMode == GLFW_CURSOR_DISABLED) - showCursor(window); + if (window->cursorMode == GLFW_CURSOR_DISABLED) + restoreCursor(window); + } break; } @@ -791,23 +1284,11 @@ static void processEvent(XEvent *event) if (event->xproperty.atom == _glfw.x11.WM_STATE && event->xproperty.state == PropertyNewValue) { - struct { - CARD32 state; - Window icon; - } *state = NULL; - - if (_glfwGetWindowProperty(window->x11.handle, - _glfw.x11.WM_STATE, - _glfw.x11.WM_STATE, - (unsigned char**) &state) >= 2) - { - if (state->state == IconicState) - _glfwInputWindowIconify(window, GL_TRUE); - else if (state->state == NormalState) - _glfwInputWindowIconify(window, GL_FALSE); - } - - XFree(state); + const int state = getWindowState(window); + if (state == IconicState) + _glfwInputWindowIconify(window, GL_TRUE); + else if (state == NormalState) + _glfwInputWindowIconify(window, GL_FALSE); } break; @@ -815,13 +1296,13 @@ static void processEvent(XEvent *event) case SelectionClear: { - _glfwHandleSelectionClear(event); + handleSelectionClear(event); break; } case SelectionRequest: { - _glfwHandleSelectionRequest(event); + handleSelectionRequest(event); break; } @@ -837,7 +1318,7 @@ static void processEvent(XEvent *event) { XIDeviceEvent* data = (XIDeviceEvent*) event->xcookie.data; - window = _glfwFindWindowByHandle(data->event); + window = findWindowByHandle(data->event); if (window) { if (data->event_x != window->x11.warpPosX || @@ -895,23 +1376,6 @@ static void processEvent(XEvent *event) ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -// Return the GLFW window corresponding to the specified X11 window -// -_GLFWwindow* _glfwFindWindowByHandle(Window handle) -{ - _GLFWwindow* window; - - if (XFindContext(_glfw.x11.display, - handle, - _glfw.x11.context, - (XPointer*) &window) != 0) - { - return NULL; - } - - return window; -} - // Retrieve a single window property of the specified type // Inspired by fghGetWindowProperty from freeglut // @@ -937,7 +1401,7 @@ unsigned long _glfwGetWindowProperty(Window window, &bytesAfter, value); - if (actualType != type) + if (type != AnyPropertyType && actualType != type) return 0; return itemCount; @@ -950,9 +1414,10 @@ unsigned long _glfwGetWindowProperty(Window window, int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - if (!_glfwCreateContext(window, wndconfig, fbconfig)) + if (!_glfwCreateContext(window, ctxconfig, fbconfig)) return GL_FALSE; if (!createWindow(window, wndconfig)) @@ -972,6 +1437,12 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) if (window->monitor) leaveFullscreenMode(window); + if (window->x11.ic) + { + XDestroyIC(window->x11.ic); + window->x11.ic = NULL; + } + _glfwDestroyContext(window); if (window->x11.handle) @@ -979,7 +1450,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) if (window->x11.handle == XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD)) { - _glfwPushSelectionToManager(window); + pushSelectionToManager(window); } XDeleteContext(_glfw.x11.display, window->x11.handle, _glfw.x11.context); @@ -993,6 +1464,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) XFreeColormap(_glfw.x11.display, window->x11.colormap); window->x11.colormap = (Colormap) 0; } + + XFlush(_glfw.x11.display); } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) @@ -1028,6 +1501,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) PropModeReplace, (unsigned char*) title, strlen(title)); } + + XFlush(_glfw.x11.display); } void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) @@ -1041,7 +1516,6 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) if (child) { int left, top; - XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child, 0, 0, &left, &top, &child); @@ -1113,6 +1587,34 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* heigh _glfwPlatformGetWindowSize(window, width, height); } +void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, + int* left, int* top, + int* right, int* bottom) +{ + long* extents = NULL; + + if (_glfw.x11.NET_FRAME_EXTENTS == None) + return; + + if (_glfwGetWindowProperty(window->x11.handle, + _glfw.x11.NET_FRAME_EXTENTS, + XA_CARDINAL, + (unsigned char**) &extents) == 4) + { + if (left) + *left = extents[0]; + if (top) + *top = extents[2]; + if (right) + *right = extents[1]; + if (bottom) + *bottom = extents[3]; + } + + if (extents) + XFree(extents); +} + void _glfwPlatformIconifyWindow(_GLFWwindow* window) { if (window->x11.overrideRedirect) @@ -1126,6 +1628,7 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window) } XIconifyWindow(_glfw.x11.display, window->x11.handle, _glfw.x11.screen); + XFlush(_glfw.x11.display); } void _glfwPlatformRestoreWindow(_GLFWwindow* window) @@ -1141,6 +1644,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) } XMapWindow(_glfw.x11.display, window->x11.handle); + XFlush(_glfw.x11.display); } void _glfwPlatformShowWindow(_GLFWwindow* window) @@ -1149,12 +1653,39 @@ void _glfwPlatformShowWindow(_GLFWwindow* window) XFlush(_glfw.x11.display); } +void _glfwPlatformUnhideWindow(_GLFWwindow* window) +{ + XMapWindow(_glfw.x11.display, window->x11.handle); + XFlush(_glfw.x11.display); +} + void _glfwPlatformHideWindow(_GLFWwindow* window) { XUnmapWindow(_glfw.x11.display, window->x11.handle); XFlush(_glfw.x11.display); } +int _glfwPlatformWindowFocused(_GLFWwindow* window) +{ + Window focused; + int state; + + XGetInputFocus(_glfw.x11.display, &focused, &state); + return window->x11.handle == focused; +} + +int _glfwPlatformWindowIconified(_GLFWwindow* window) +{ + return getWindowState(window) == IconicState; +} + +int _glfwPlatformWindowVisible(_GLFWwindow* window) +{ + XWindowAttributes wa; + XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &wa); + return wa.map_state == IsViewable; +} + void _glfwPlatformPollEvents(void) { int count = XPending(_glfw.x11.display); @@ -1194,6 +1725,38 @@ void _glfwPlatformWaitEvents(void) _glfwPlatformPollEvents(); } +void _glfwPlatformPostEmptyEvent(void) +{ + XEvent event; + _GLFWwindow* window = _glfw.windowListHead; + + memset(&event, 0, sizeof(event)); + event.type = ClientMessage; + event.xclient.window = window->x11.handle; + event.xclient.format = 32; // Data is 32-bit longs + event.xclient.message_type = _glfw.x11._NULL; + + XSendEvent(_glfw.x11.display, window->x11.handle, False, 0, &event); + XFlush(_glfw.x11.display); +} + +void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) +{ + Window root, child; + int rootX, rootY, childX, childY; + unsigned int mask; + + XQueryPointer(_glfw.x11.display, window->x11.handle, + &root, &child, + &rootX, &rootY, &childX, &childY, + &mask); + + if (xpos) + *xpos = childX; + if (ypos) + *ypos = childY; +} + void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { // Store the new position so it can be recognized later @@ -1204,22 +1767,154 @@ 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) { - switch (mode) + switch (window->cursorMode) { case GLFW_CURSOR_NORMAL: - showCursor(window); + restoreCursor(window); break; case GLFW_CURSOR_HIDDEN: hideCursor(window); break; case GLFW_CURSOR_DISABLED: - captureCursor(window); + disableCursor(window); break; } } +int _glfwPlatformCreateCursor(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) +{ + cursor->x11.handle = _glfwCreateCursor(image, xhot, yhot); + if (!cursor->x11.handle) + return GL_FALSE; + + return GL_TRUE; +} + +int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) +{ + const unsigned int native = translateCursorShape(shape); + if (!native) + { + _glfwInputError(GLFW_INVALID_ENUM, "X11: Invalid standard cursor"); + return GL_FALSE; + } + + cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native); + if (!cursor->x11.handle) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to create standard cursor"); + return GL_FALSE; + } + + return GL_TRUE; +} + +void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) +{ + if (cursor->x11.handle) + XFreeCursor(_glfw.x11.display, cursor->x11.handle); +} + +void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) +{ + if (window->cursorMode == GLFW_CURSOR_NORMAL) + { + if (cursor) + XDefineCursor(_glfw.x11.display, window->x11.handle, cursor->x11.handle); + else + XUndefineCursor(_glfw.x11.display, window->x11.handle); + + XFlush(_glfw.x11.display); + } +} + +void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string) +{ + free(_glfw.x11.clipboardString); + _glfw.x11.clipboardString = strdup(string); + + XSetSelectionOwner(_glfw.x11.display, + _glfw.x11.CLIPBOARD, + window->x11.handle, CurrentTime); + + if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) != + window->x11.handle) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Failed to become owner of the clipboard selection"); + } +} + +const char* _glfwPlatformGetClipboardString(_GLFWwindow* window) +{ + size_t i; + const Atom formats[] = { _glfw.x11.UTF8_STRING, + _glfw.x11.COMPOUND_STRING, + XA_STRING }; + const size_t formatCount = sizeof(formats) / sizeof(formats[0]); + + if (findWindowByHandle(XGetSelectionOwner(_glfw.x11.display, + _glfw.x11.CLIPBOARD))) + { + // Instead of doing a large number of X round-trips just to put this + // string into a window property and then read it back, just return it + return _glfw.x11.clipboardString; + } + + free(_glfw.x11.clipboardString); + _glfw.x11.clipboardString = NULL; + + for (i = 0; i < formatCount; i++) + { + char* data; + XEvent event; + + XConvertSelection(_glfw.x11.display, + _glfw.x11.CLIPBOARD, + formats[i], + _glfw.x11.GLFW_SELECTION, + window->x11.handle, CurrentTime); + + // XCheckTypedEvent is used instead of XIfEvent in order not to lock + // other threads out from the display during the entire wait period + while (!XCheckTypedEvent(_glfw.x11.display, SelectionNotify, &event)) + ; + + if (event.xselection.property == None) + continue; + + if (_glfwGetWindowProperty(event.xselection.requestor, + event.xselection.property, + event.xselection.target, + (unsigned char**) &data)) + { + _glfw.x11.clipboardString = strdup(data); + } + + XFree(data); + + XDeleteProperty(_glfw.x11.display, + event.xselection.requestor, + event.xselection.property); + + if (_glfw.x11.clipboardString) + break; + } + + if (_glfw.x11.clipboardString == NULL) + { + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, + "X11: Failed to convert selection to string"); + } + + return _glfw.x11.clipboardString; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW native API ////// diff --git a/extern/glfw/src/x11_unicode.c b/extern/glfw/src/xkb_unicode.c similarity index 96% rename from extern/glfw/src/x11_unicode.c rename to extern/glfw/src/xkb_unicode.c index b847e0f..fbc25a2 100644 --- a/extern/glfw/src/x11_unicode.c +++ b/extern/glfw/src/xkb_unicode.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.0 X11 - www.glfw.org +// GLFW 3.1 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -64,7 +64,7 @@ //**** KeySym to Unicode mapping table **** //************************************************************************ -static struct codepair { +static const struct codepair { unsigned short keysym; unsigned short ucs; } keysymtab[] = { @@ -852,40 +852,38 @@ static struct codepair { ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -// Convert X11 KeySym to Unicode +// Convert XKB KeySym to Unicode // -long _glfwKeySym2Unicode( KeySym keysym ) +long _glfwKeySym2Unicode(unsigned int keysym) { int min = 0; int max = sizeof(keysymtab) / sizeof(struct codepair) - 1; int mid; - /* First check for Latin-1 characters (1:1 mapping) */ - if( (keysym >= 0x0020 && keysym <= 0x007e) || - (keysym >= 0x00a0 && keysym <= 0x00ff) ) - { return keysym; + // First check for Latin-1 characters (1:1 mapping) + if ((keysym >= 0x0020 && keysym <= 0x007e) || + (keysym >= 0x00a0 && keysym <= 0x00ff)) + { + return keysym; } - /* Also check for directly encoded 24-bit UCS characters */ - if( (keysym & 0xff000000) == 0x01000000 ) + // Also check for directly encoded 24-bit UCS characters + if ((keysym & 0xff000000) == 0x01000000) return keysym & 0x00ffffff; - /* Binary search in table */ - while( max >= min ) + // Binary search in table + while (max >= min) { mid = (min + max) / 2; - if( keysymtab[mid].keysym < keysym ) + if (keysymtab[mid].keysym < keysym) min = mid + 1; - else if( keysymtab[mid].keysym > keysym ) + else if (keysymtab[mid].keysym > keysym) max = mid - 1; else - { - /* Found it! */ return keysymtab[mid].ucs; - } } - /* No matching Unicode value found */ + // No matching Unicode value found return -1; } diff --git a/extern/glfw/src/xkb_unicode.h b/extern/glfw/src/xkb_unicode.h new file mode 100644 index 0000000..9772901 --- /dev/null +++ b/extern/glfw/src/xkb_unicode.h @@ -0,0 +1,33 @@ +//======================================================================== +// GLFW 3.1 Linux - www.glfw.org +//------------------------------------------------------------------------ +// Copyright (c) 2014 Jonas Ådahl +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== + +#ifndef _xkb_unicode_h_ +#define _xkb_unicode_h_ + + +long _glfwKeySym2Unicode(unsigned int keysym); + +#endif // _xkb_unicode_h_ diff --git a/extern/glfw/tests/CMakeLists.txt b/extern/glfw/tests/CMakeLists.txt index 56b000a..a5f5247 100644 --- a/extern/glfw/tests/CMakeLists.txt +++ b/extern/glfw/tests/CMakeLists.txt @@ -1,25 +1,24 @@ -link_libraries(glfw ${OPENGL_glu_LIBRARY}) +link_libraries(glfw "${OPENGL_glu_LIBRARY}") if (BUILD_SHARED_LIBS) add_definitions(-DGLFW_DLL) - link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY}) + link_libraries("${OPENGL_gl_LIBRARY}" "${MATH_LIBRARY}") else() link_libraries(${glfw_LIBRARIES}) endif() -include_directories(${GLFW_SOURCE_DIR}/include - ${GLFW_SOURCE_DIR}/deps) +include_directories("${GLFW_SOURCE_DIR}/include" + "${GLFW_SOURCE_DIR}/deps") -if (NOT APPLE) - # HACK: This is NOTFOUND on OS X 10.8 - include_directories(${OPENGL_INCLUDE_DIR}) +if ("${OPENGL_INCLUDE_DIR}") + include_directories("${OPENGL_INCLUDE_DIR}") endif() -set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h - ${GLFW_SOURCE_DIR}/deps/getopt.c) -set(TINYCTHREAD ${GLFW_SOURCE_DIR}/deps/tinycthread.h - ${GLFW_SOURCE_DIR}/deps/tinycthread.c) +set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" + "${GLFW_SOURCE_DIR}/deps/getopt.c") +set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" + "${GLFW_SOURCE_DIR}/deps/tinycthread.c") add_executable(clipboard clipboard.c ${GETOPT}) add_executable(defaults defaults.c) @@ -32,10 +31,17 @@ add_executable(joysticks joysticks.c) add_executable(modes modes.c ${GETOPT}) add_executable(peter peter.c) add_executable(reopen reopen.c) +add_executable(cursor cursor.c) + +add_executable(cursoranim WIN32 MACOSX_BUNDLE cursoranim.c) +set_target_properties(cursoranim PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Cursor animation") add_executable(accuracy WIN32 MACOSX_BUNDLE accuracy.c) set_target_properties(accuracy PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Accuracy") +add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD}) +set_target_properties(empty PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Empty Event") + add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c) set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") @@ -51,11 +57,15 @@ set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title") add_executable(windows WIN32 MACOSX_BUNDLE windows.c) set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows") -target_link_libraries(threads ${CMAKE_THREAD_LIBS_INIT} ${RT_LIBRARY}) +target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") +target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") -set(WINDOWS_BINARIES accuracy sharing tearing threads title windows) +set(WINDOWS_BINARIES accuracy empty sharing tearing threads title windows cursoranim) set(CONSOLE_BINARIES clipboard defaults events fsaa gamma glfwinfo - iconify joysticks modes peter reopen) + iconify joysticks modes peter reopen cursor) + +set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES + FOLDER "GLFW3/Tests") if (MSVC) # Tell MSVC to use main instead of WinMain for Windows subsystem executables diff --git a/extern/glfw/tests/accuracy.c b/extern/glfw/tests/accuracy.c index 01adbd1..6a63c88 100644 --- a/extern/glfw/tests/accuracy.c +++ b/extern/glfw/tests/accuracy.c @@ -29,7 +29,6 @@ // //======================================================================== -#define GLFW_INCLUDE_GLU #include #include @@ -65,7 +64,7 @@ static void framebuffer_size_callback(GLFWwindow* window, int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluOrtho2D(0.f, window_width, 0.f, window_height); + glOrtho(0.f, window_width, 0.f, window_height, 0.f, 1.f); } static void cursor_position_callback(GLFWwindow* window, double x, double y) diff --git a/extern/glfw/tests/cursor.c b/extern/glfw/tests/cursor.c new file mode 100644 index 0000000..9b89926 --- /dev/null +++ b/extern/glfw/tests/cursor.c @@ -0,0 +1,289 @@ +//======================================================================== +// Cursor & input mode tests +// Copyright (c) Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== +// +// System cursors and input modes tests. +// +//======================================================================== + +#define GLFW_INCLUDE_GLU +#include + +#include +#include + +static int W = 640; +static int H = 480; +static int delay = 0; + +static GLFWwindow* windows[2] = { NULL, NULL }; +static GLFWwindow* activeWindow = NULL; +static GLFWcursor* cursor = NULL; + +static struct +{ + int key; + double time; +} commands[] = { + {GLFW_KEY_H, 0}, + {GLFW_KEY_C, 0}, + {GLFW_KEY_D, 0}, + {GLFW_KEY_S, 0}, + {GLFW_KEY_N, 0}, + {GLFW_KEY_1, 0}, + {GLFW_KEY_2, 0}, + {GLFW_KEY_3, 0} +}; + +static int CommandCount = sizeof(commands) / sizeof(commands[0]); + +static struct +{ + int w, h; +} cursorSize[] = { + { 24, 24 }, { 13, 37 }, { 5, 53 }, { 43, 64 }, { 300, 300 } +}; + +static int SizeCount = sizeof(cursorSize) / sizeof(cursorSize[0]); +static int currentSize = 0; + +static void command_callback(int key) +{ + switch (key) + { + case GLFW_KEY_H: + { + printf("H: show this help\n"); + printf("C: call glfwCreateCursor()\n"); + printf("D: call glfwDestroyCursor()\n"); + printf("S: call glfwSetCursor()\n"); + printf("N: call glfwSetCursor() with NULL\n"); + printf("1: set GLFW_CURSOR_NORMAL\n"); + printf("2: set GLFW_CURSOR_HIDDEN\n"); + printf("3: set GLFW_CURSOR_DISABLED\n"); + printf("T: enable 3s delay for all previous commands\n"); + } + break; + + case GLFW_KEY_C: + { + int x, y; + GLFWimage image; + unsigned char* pixels; + + if (cursor) + break; + + image.width = cursorSize[currentSize].w; + image.height = cursorSize[currentSize].h; + + pixels = malloc(4 * image.width * image.height); + image.pixels = pixels; + + for (y = 0; y < image.height; y++) + { + for (x = 0; x < image.width; x++) + { + *pixels++ = 0xff; + *pixels++ = 0; + *pixels++ = 255 * y / image.height; + *pixels++ = 255 * x / image.width; + } + } + + cursor = glfwCreateCursor(&image, image.width / 2, image.height / 2); + currentSize = (currentSize + 1) % SizeCount; + free(image.pixels); + break; + } + + case GLFW_KEY_D: + { + if (cursor != NULL) + { + glfwDestroyCursor(cursor); + cursor = NULL; + } + + break; + } + + case GLFW_KEY_S: + { + if (cursor != NULL) + glfwSetCursor(activeWindow, cursor); + else + printf("The cursor is not created\n"); + + break; + } + + case GLFW_KEY_N: + glfwSetCursor(activeWindow, NULL); + break; + + case GLFW_KEY_1: + glfwSetInputMode(activeWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + break; + + case GLFW_KEY_2: + glfwSetInputMode(activeWindow, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); + break; + + case GLFW_KEY_3: + glfwSetInputMode(activeWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED); + break; + } +} + +static void error_callback(int error, const char* description) +{ + fprintf(stderr, "Error: %s\n", description); +} + +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) +{ + W = width; + H = height; + + glViewport(0, 0, W, H); +} + +static void refresh_callback(GLFWwindow* window) +{ + glfwMakeContextCurrent(window); + glClearColor(0.0f, window == activeWindow ? 0.8f : 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(window); +} + +static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) +{ + if (action != GLFW_PRESS) + return; + + switch (key) + { + case GLFW_KEY_ESCAPE: + glfwSetWindowShouldClose(window, GL_TRUE); + break; + + case GLFW_KEY_T: + delay = !delay; + printf("Delay %s.\n", delay ? "enabled" : "disabled"); + break; + + default: + { + if (delay) + { + int i = 0; + + while (i < CommandCount && commands[i].key != key) + i++; + + if (i < CommandCount) + commands[i].time = glfwGetTime(); + } + else + { + command_callback(key); + } + } + break; + } +} + +static void focus_callback(GLFWwindow* window, int focused) +{ + if (focused) + { + activeWindow = window; + refresh_callback(windows[0]); + refresh_callback(windows[1]); + } +} + +int main(void) +{ + int i; + GLboolean running = GL_TRUE; + + glfwSetErrorCallback(error_callback); + + if (!glfwInit()) + exit(EXIT_FAILURE); + + for (i = 0; i < 2; i++) + { + windows[i] = glfwCreateWindow(W, H, "Cursor testing", NULL, NULL); + + if (!windows[i]) + { + glfwTerminate(); + exit(EXIT_FAILURE); + } + + glfwSetWindowPos(windows[i], 100 + (i & 1) * (W + 50), 100); + + glfwSetWindowRefreshCallback(windows[i], refresh_callback); + glfwSetFramebufferSizeCallback(windows[i], framebuffer_size_callback); + glfwSetKeyCallback(windows[i], key_callback); + glfwSetWindowFocusCallback(windows[i], focus_callback); + + glfwMakeContextCurrent(windows[i]); + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(windows[i]); + } + + activeWindow = windows[0]; + + key_callback(NULL, GLFW_KEY_H, 0, GLFW_PRESS, 0); + + while (running) + { + if (delay) + { + int i; + double t = glfwGetTime(); + + for (i = 0; i < CommandCount; i++) + { + if (commands[i].time != 0 && t - commands[i].time >= 3.0) + { + command_callback(commands[i].key); + commands[i].time = 0; + } + } + } + + running = !(glfwWindowShouldClose(windows[0]) || glfwWindowShouldClose(windows[1])); + + glfwPollEvents(); + } + + glfwTerminate(); + exit(EXIT_SUCCESS); +} + diff --git a/extern/glfw/tests/cursoranim.c b/extern/glfw/tests/cursoranim.c new file mode 100644 index 0000000..39a229c --- /dev/null +++ b/extern/glfw/tests/cursoranim.c @@ -0,0 +1,135 @@ +//======================================================================== +// Cursor animation +// Copyright (c) Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== +// +// Cursor animation test. +// +//======================================================================== + +#include + +#include +#include + +#ifdef min + #undef min +#endif +#ifdef max + #undef max +#endif + +#define SIZE 64 // cursor size (width & height) +#define N 60 // number of frames + +unsigned char buffer[4 * SIZE * SIZE]; + +static float max(float a, float b) { return a > b ? a : b; } +static float min(float a, float b) { return a < b ? a : b; } + +static float star(int x, int y, float t) +{ + float c = SIZE / 2.0f; + + float i = (0.25f * (float)sin(2.0f * 3.1415926f * t) + 0.75f); + float k = SIZE * 0.046875f * i; + + float dist = (float)sqrt((x - c) * (x - c) + (y - c) * (y - c)); + + float salpha = 1.0f - dist / c; + float xalpha = (float)x == c ? c : k / (float)fabs(x - c); + float yalpha = (float)y == c ? c : k / (float)fabs(y - c); + + return max(0.0f, min(1.0f, i * salpha * 0.2f + salpha * xalpha * yalpha)); +} + +static GLFWcursor* load_frame(float t) +{ + int i = 0, x, y; + const GLFWimage image = { SIZE, SIZE, buffer }; + + for (y = 0; y < image.width; y++) + { + for (x = 0; x < image.height; x++) + { + buffer[i++] = 255; + buffer[i++] = 255; + buffer[i++] = 255; + buffer[i++] = (unsigned char)(255 * star(x, y, t)); + } + } + + return glfwCreateCursor(&image, image.width / 2, image.height / 2); +} + +int main(void) +{ + int i; + double t0, t1, frameTime = 0.0; + + GLFWwindow* window; + GLFWcursor* frames[N]; + + if (!glfwInit()) + exit(EXIT_FAILURE); + + window = glfwCreateWindow(640, 480, "Cursor animation", NULL, NULL); + + if (!window) + { + glfwTerminate(); + exit(EXIT_FAILURE); + } + + glfwMakeContextCurrent(window); + glfwSwapInterval(1); + + for (i = 0; i < N; i++) + frames[i] = load_frame(i / (float)N); + + i = 0; + + t0 = glfwGetTime(); + + while (!glfwWindowShouldClose(window)) + { + glClear(GL_COLOR_BUFFER_BIT); + glfwSetCursor(window, frames[i]); + glfwSwapBuffers(window); + glfwPollEvents(); + + t1 = glfwGetTime(); + frameTime += t1 - t0; + t0 = t1; + + while (frameTime > 1.0 / (double)N) + { + i = (i + 1) % N; + frameTime -= 1.0 / (double)N; + } + } + + glfwTerminate(); + exit(EXIT_SUCCESS); +} + diff --git a/extern/glfw/tests/defaults.c b/extern/glfw/tests/defaults.c index 2d48354..07ba5a4 100644 --- a/extern/glfw/tests/defaults.c +++ b/extern/glfw/tests/defaults.c @@ -29,8 +29,8 @@ // //======================================================================== +#define GLFW_INCLUDE_GLEXT #include -#include #include #include diff --git a/extern/glfw/tests/empty.c b/extern/glfw/tests/empty.c new file mode 100644 index 0000000..a4534ae --- /dev/null +++ b/extern/glfw/tests/empty.c @@ -0,0 +1,129 @@ +//======================================================================== +// Empty event test +// Copyright (c) Camilla Berglund +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would +// be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not +// be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source +// distribution. +// +//======================================================================== +// +// This test is intended to verify that posting of empty events works +// +//======================================================================== + +#include "tinycthread.h" + +#include + +#include +#include +#include + +static volatile GLboolean running = GL_TRUE; + +static void error_callback(int error, const char* description) +{ + fprintf(stderr, "Error: %s\n", description); +} + +static int thread_main(void* data) +{ + struct timespec time; + + while (running) + { + clock_gettime(CLOCK_REALTIME, &time); + time.tv_sec += 1; + thrd_sleep(&time, NULL); + + glfwPostEmptyEvent(); + } + + return 0; +} + +static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) +{ + if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) + glfwSetWindowShouldClose(window, GL_TRUE); +} + +static float nrand(void) +{ + return (float) rand() / (float) RAND_MAX; +} + +int main(void) +{ + int result; + thrd_t thread; + GLFWwindow* window; + + srand((unsigned int) time(NULL)); + + glfwSetErrorCallback(error_callback); + + if (!glfwInit()) + exit(EXIT_FAILURE); + + window = glfwCreateWindow(640, 480, "Empty Event Test", NULL, NULL); + if (!window) + { + glfwTerminate(); + exit(EXIT_FAILURE); + } + + glfwMakeContextCurrent(window); + glfwSetKeyCallback(window, key_callback); + + if (thrd_create(&thread, thread_main, NULL) != thrd_success) + { + fprintf(stderr, "Failed to create secondary thread\n"); + + glfwTerminate(); + exit(EXIT_FAILURE); + } + + while (running) + { + int width, height; + float r = nrand(), g = nrand(), b = nrand(); + float l = (float) sqrt(r * r + g * g + b * b); + + glfwGetFramebufferSize(window, &width, &height); + + glViewport(0, 0, width, height); + glClearColor(r / l, g / l, b / l, 1.f); + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(window); + + glfwWaitEvents(); + + if (glfwWindowShouldClose(window)) + running = GL_FALSE; + } + + glfwHideWindow(window); + thrd_join(thread, &result); + glfwDestroyWindow(window); + + glfwTerminate(); + exit(EXIT_SUCCESS); +} + diff --git a/extern/glfw/tests/events.c b/extern/glfw/tests/events.c index 7ac69c8..fda6816 100644 --- a/extern/glfw/tests/events.c +++ b/extern/glfw/tests/events.c @@ -41,12 +41,25 @@ #include "getopt.h" -// These must match the input mode defaults -static GLboolean closeable = GL_TRUE; - // Event index static unsigned int counter = 0; +typedef struct +{ + GLFWwindow* window; + int number; + int closeable; +} Slot; + +static void usage(void) +{ + printf("Usage: events [-f] [-h] [-n WINDOWS]\n"); + printf("Options:\n"); + printf(" -f use full screen\n"); + printf(" -h show this help\n"); + printf(" -n the number of windows to create\n"); +} + static const char* get_key_name(int key) { switch (key) @@ -174,9 +187,8 @@ static const char* get_key_name(int key) case GLFW_KEY_LEFT_SUPER: return "LEFT SUPER"; case GLFW_KEY_RIGHT_SUPER: return "RIGHT SUPER"; case GLFW_KEY_MENU: return "MENU"; - case GLFW_KEY_UNKNOWN: return "UNKNOWN"; - default: return NULL; + default: return "UNKNOWN"; } } @@ -205,15 +217,22 @@ static const char* get_button_name(int button) return "right"; case GLFW_MOUSE_BUTTON_MIDDLE: return "middle"; + default: + { + static char name[16]; + sprintf(name, "%i", button); + return name; + } } - - return NULL; } static const char* get_mods_name(int mods) { static char name[512]; + if (mods == 0) + return " no mods"; + name[0] = '\0'; if (mods & GLFW_MOD_SHIFT) @@ -248,114 +267,104 @@ static void error_callback(int error, const char* description) static void window_pos_callback(GLFWwindow* window, int x, int y) { - printf("%08x at %0.3f: Window position: %i %i\n", - counter++, - glfwGetTime(), - x, - y); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Window position: %i %i\n", + counter++, slot->number, glfwGetTime(), x, y); } static void window_size_callback(GLFWwindow* window, int width, int height) { - printf("%08x at %0.3f: Window size: %i %i\n", - counter++, - glfwGetTime(), - width, - height); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Window size: %i %i\n", + counter++, slot->number, glfwGetTime(), width, height); } static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { - printf("%08x at %0.3f: Framebuffer size: %i %i\n", - counter++, - glfwGetTime(), - width, - height); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Framebuffer size: %i %i\n", + counter++, slot->number, glfwGetTime(), width, height); glViewport(0, 0, width, height); } static void window_close_callback(GLFWwindow* window) { - printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime()); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Window close\n", + counter++, slot->number, glfwGetTime()); - glfwSetWindowShouldClose(window, closeable); + glfwSetWindowShouldClose(window, slot->closeable); } static void window_refresh_callback(GLFWwindow* window) { - printf("%08x at %0.3f: Window refresh\n", counter++, glfwGetTime()); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Window refresh\n", + counter++, slot->number, glfwGetTime()); - if (glfwGetCurrentContext()) - { - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); - } + glfwMakeContextCurrent(window); + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(window); } static void window_focus_callback(GLFWwindow* window, int focused) { - printf("%08x at %0.3f: Window %s\n", - counter++, - glfwGetTime(), + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Window %s\n", + counter++, slot->number, glfwGetTime(), focused ? "focused" : "defocused"); } static void window_iconify_callback(GLFWwindow* window, int iconified) { - printf("%08x at %0.3f: Window was %s\n", - counter++, - glfwGetTime(), + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Window was %s\n", + counter++, slot->number, glfwGetTime(), iconified ? "iconified" : "restored"); } static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { - const char* name = get_button_name(button); - - printf("%08x at %0.3f: Mouse button %i", counter++, glfwGetTime(), button); - - if (name) - printf(" (%s)", name); - - if (mods) - printf(" (with%s)", get_mods_name(mods)); - - printf(" was %s\n", get_action_name(action)); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Mouse button %i (%s) (with%s) was %s\n", + counter++, slot->number, glfwGetTime(), button, + get_button_name(button), + get_mods_name(mods), + get_action_name(action)); } static void cursor_position_callback(GLFWwindow* window, double x, double y) { - printf("%08x at %0.3f: Cursor position: %f %f\n", counter++, glfwGetTime(), x, y); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Cursor position: %f %f\n", + counter++, slot->number, glfwGetTime(), x, y); } static void cursor_enter_callback(GLFWwindow* window, int entered) { - printf("%08x at %0.3f: Cursor %s window\n", - counter++, - glfwGetTime(), + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Cursor %s window\n", + counter++, slot->number, glfwGetTime(), entered ? "entered" : "left"); } static void scroll_callback(GLFWwindow* window, double x, double y) { - printf("%08x at %0.3f: Scroll: %0.3f %0.3f\n", counter++, glfwGetTime(), x, y); + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Scroll: %0.3f %0.3f\n", + counter++, slot->number, glfwGetTime(), x, y); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { - const char* name = get_key_name(key); + Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x at %0.3f: Key 0x%04x Scancode 0x%04x", - counter++, glfwGetTime(), key, scancode); - - if (name) - printf(" (%s)", name); - - if (mods) - printf(" (with%s)", get_mods_name(mods)); - - printf(" was %s\n", 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; @@ -364,9 +373,9 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, { case GLFW_KEY_C: { - closeable = !closeable; + slot->closeable = !slot->closeable; - printf("(( closing %s ))\n", closeable ? "enabled" : "disabled"); + printf("(( closing %s ))\n", slot->closeable ? "enabled" : "disabled"); break; } } @@ -374,14 +383,34 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, static void char_callback(GLFWwindow* window, unsigned int codepoint) { - printf("%08x at %0.3f: Character 0x%08x (%s) input\n", - counter++, - glfwGetTime(), - codepoint, + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n", + counter++, slot->number, glfwGetTime(), codepoint, get_character_string(codepoint)); } -void monitor_callback(GLFWmonitor* monitor, int event) +static void char_mods_callback(GLFWwindow* window, unsigned int codepoint, int mods) +{ + Slot* slot = glfwGetWindowUserPointer(window); + printf("%08x to %i at %0.3f: Character 0x%08x (%s) with modifiers (with%s) input\n", + counter++, slot->number, glfwGetTime(), codepoint, + get_character_string(codepoint), + get_mods_name(mods)); +} + +static void drop_callback(GLFWwindow* window, int count, const char** names) +{ + int i; + Slot* slot = glfwGetWindowUserPointer(window); + + printf("%08x to %i at %0.3f: Drop input\n", + counter++, slot->number, glfwGetTime()); + + for (i = 0; i < count; i++) + printf(" %i: \"%s\"\n", i, names[i]); +} + +static void monitor_callback(GLFWmonitor* monitor, int event) { if (event == GLFW_CONNECTED) { @@ -410,9 +439,9 @@ void monitor_callback(GLFWmonitor* monitor, int event) int main(int argc, char** argv) { - GLFWwindow* window; + Slot* slots; GLFWmonitor* monitor = NULL; - int ch, width, height; + int ch, i, width, height, count = 1; setlocale(LC_ALL, ""); @@ -423,57 +452,129 @@ int main(int argc, char** argv) printf("Library initialized\n"); - while ((ch = getopt(argc, argv, "f")) != -1) + glfwSetMonitorCallback(monitor_callback); + + while ((ch = getopt(argc, argv, "hfn:")) != -1) { switch (ch) { + case 'h': + usage(); + exit(EXIT_SUCCESS); + case 'f': monitor = glfwGetPrimaryMonitor(); break; + + case 'n': + count = (int) strtol(optarg, NULL, 10); + break; + + default: + usage(); + exit(EXIT_FAILURE); } } - window = glfwCreateWindow(640, 480, "Event Linter", monitor, NULL); - if (!window) + if (monitor) { - glfwTerminate(); + const GLFWvidmode* mode = glfwGetVideoMode(monitor); + + glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); + glfwWindowHint(GLFW_RED_BITS, mode->redBits); + glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); + glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); + + width = mode->width; + height = mode->height; + } + else + { + width = 640; + height = 480; + } + + if (!count) + { + fprintf(stderr, "Invalid user\n"); exit(EXIT_FAILURE); } - printf("Window opened\n"); + slots = calloc(count, sizeof(Slot)); - glfwSetMonitorCallback(monitor_callback); + for (i = 0; i < count; i++) + { + char title[128]; - glfwSetWindowPosCallback(window, window_pos_callback); - glfwSetWindowSizeCallback(window, window_size_callback); - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); - glfwSetWindowCloseCallback(window, window_close_callback); - glfwSetWindowRefreshCallback(window, window_refresh_callback); - glfwSetWindowFocusCallback(window, window_focus_callback); - glfwSetWindowIconifyCallback(window, window_iconify_callback); - glfwSetMouseButtonCallback(window, mouse_button_callback); - glfwSetCursorPosCallback(window, cursor_position_callback); - glfwSetCursorEnterCallback(window, cursor_enter_callback); - glfwSetScrollCallback(window, scroll_callback); - glfwSetKeyCallback(window, key_callback); - glfwSetCharCallback(window, char_callback); + slots[i].closeable = GL_TRUE; + slots[i].number = i + 1; - glfwMakeContextCurrent(window); - glfwSwapInterval(1); + sprintf(title, "Event Linter (Window %i)", slots[i].number); - glfwGetWindowSize(window, &width, &height); - printf("Window size should be %ix%i\n", width, height); + if (monitor) + { + printf("Creating full screen window %i (%ix%i on %s)\n", + slots[i].number, + width, height, + glfwGetMonitorName(monitor)); + } + else + { + printf("Creating windowed mode window %i (%ix%i)\n", + slots[i].number, + width, height); + } + + slots[i].window = glfwCreateWindow(width, height, title, monitor, NULL); + if (!slots[i].window) + { + free(slots); + glfwTerminate(); + exit(EXIT_FAILURE); + } + + glfwSetWindowUserPointer(slots[i].window, slots + i); + + glfwSetWindowPosCallback(slots[i].window, window_pos_callback); + glfwSetWindowSizeCallback(slots[i].window, window_size_callback); + glfwSetFramebufferSizeCallback(slots[i].window, framebuffer_size_callback); + glfwSetWindowCloseCallback(slots[i].window, window_close_callback); + glfwSetWindowRefreshCallback(slots[i].window, window_refresh_callback); + glfwSetWindowFocusCallback(slots[i].window, window_focus_callback); + glfwSetWindowIconifyCallback(slots[i].window, window_iconify_callback); + glfwSetMouseButtonCallback(slots[i].window, mouse_button_callback); + glfwSetCursorPosCallback(slots[i].window, cursor_position_callback); + glfwSetCursorEnterCallback(slots[i].window, cursor_enter_callback); + glfwSetScrollCallback(slots[i].window, scroll_callback); + glfwSetKeyCallback(slots[i].window, key_callback); + glfwSetCharCallback(slots[i].window, char_callback); + glfwSetCharModsCallback(slots[i].window, char_mods_callback); + glfwSetDropCallback(slots[i].window, drop_callback); + + glfwMakeContextCurrent(slots[i].window); + glfwSwapInterval(1); + } printf("Main loop starting\n"); - while (!glfwWindowShouldClose(window)) + for (;;) { + for (i = 0; i < count; i++) + { + if (glfwWindowShouldClose(slots[i].window)) + break; + } + + if (i < count) + break; + glfwWaitEvents(); // Workaround for an issue with msvcrt and mintty fflush(stdout); } + free(slots); glfwTerminate(); exit(EXIT_SUCCESS); } diff --git a/extern/glfw/tests/fsaa.c b/extern/glfw/tests/fsaa.c index 1725825..b368745 100644 --- a/extern/glfw/tests/fsaa.c +++ b/extern/glfw/tests/fsaa.c @@ -1,5 +1,5 @@ //======================================================================== -// Fullscreen anti-aliasing test +// Full screen anti-aliasing test // Copyright (c) Camilla Berglund // // This software is provided 'as-is', without any express or implied @@ -29,9 +29,8 @@ // //======================================================================== -#define GLFW_INCLUDE_GLU +#define GLFW_INCLUDE_GLEXT #include -#include #include #include @@ -98,6 +97,7 @@ int main(int argc, char** argv) printf("Requesting that FSAA not be available\n"); glfwWindowHint(GLFW_SAMPLES, samples); + glfwWindowHint(GLFW_VISIBLE, GL_FALSE); window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL); if (!window) @@ -114,10 +114,14 @@ int main(int argc, char** argv) if (!glfwExtensionSupported("GL_ARB_multisample")) { + printf("GL_ARB_multisample extension not supported\n"); + glfwTerminate(); exit(EXIT_FAILURE); } + glfwShowWindow(window); + glGetIntegerv(GL_SAMPLES_ARB, &samples); if (samples) printf("Context reports FSAA is available with %i samples\n", samples); @@ -125,7 +129,7 @@ int main(int argc, char** argv) printf("Context reports FSAA is unavailable\n"); glMatrixMode(GL_PROJECTION); - gluOrtho2D(0.f, 1.f, 0.f, 0.5f); + glOrtho(0.f, 1.f, 0.f, 0.5f, 0.f, 1.f); glMatrixMode(GL_MODELVIEW); while (!glfwWindowShouldClose(window)) diff --git a/extern/glfw/tests/gamma.c b/extern/glfw/tests/gamma.c index 19dc35d..93a24e6 100644 --- a/extern/glfw/tests/gamma.c +++ b/extern/glfw/tests/gamma.c @@ -24,7 +24,7 @@ //======================================================================== // // This program is used to test the gamma correction functionality for -// both fullscreen and windowed mode windows +// both full screen and windowed mode windows // //======================================================================== @@ -128,6 +128,12 @@ int main(int argc, char** argv) if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); + + glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); + glfwWindowHint(GLFW_RED_BITS, mode->redBits); + glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); + glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); + width = mode->width; height = mode->height; } diff --git a/extern/glfw/tests/glfwinfo.c b/extern/glfw/tests/glfwinfo.c index fc312de..f07d700 100644 --- a/extern/glfw/tests/glfwinfo.c +++ b/extern/glfw/tests/glfwinfo.c @@ -48,22 +48,26 @@ #define PROFILE_NAME_CORE "core" #define PROFILE_NAME_COMPAT "compat" -#define STRATEGY_NAME_NONE "none" -#define STRATEGY_NAME_LOSE "lose" +#define STRATEGY_NAME_NONE "none" +#define STRATEGY_NAME_LOSE "lose" + +#define BEHAVIOR_NAME_NONE "none" +#define BEHAVIOR_NAME_FLUSH "flush" static void usage(void) { - printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-r STRATEGY]\n"); + printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-s STRATEGY] [-b BEHAVIOR]\n"); printf("Options:\n"); printf(" -a the client API to use (" API_OPENGL " or " API_OPENGL_ES ")\n"); + printf(" -b the release behavior to use (" BEHAVIOR_NAME_NONE " or " BEHAVIOR_NAME_FLUSH ")\n"); printf(" -d request a debug context\n"); printf(" -f require a forward-compatible context\n"); printf(" -h show this help\n"); printf(" -l list all client API extensions after context creation\n"); - printf(" -m the major number of the requred client API version\n"); - printf(" -n the minor number of the requred client API version\n"); + printf(" -m the major number of the required client API version\n"); + printf(" -n the minor number of the required client API version\n"); printf(" -p the OpenGL profile to use (" PROFILE_NAME_CORE " or " PROFILE_NAME_COMPAT ")\n"); - printf(" -r the robustness strategy to use (" STRATEGY_NAME_NONE " or " STRATEGY_NAME_LOSE ")\n"); + printf(" -s the robustness strategy to use (" STRATEGY_NAME_NONE " or " STRATEGY_NAME_LOSE ")\n"); } static void error_callback(int error, const char* description) @@ -188,12 +192,12 @@ static GLboolean valid_version(void) int main(int argc, char** argv) { - int ch, api = 0, profile = 0, strategy = 0, major = 1, minor = 0, revision; + int ch, api = 0, profile = 0, strategy = 0, behavior = 0, major = 1, minor = 0, revision; GLboolean debug = GL_FALSE, forward = GL_FALSE, list = GL_FALSE; GLint flags, mask; GLFWwindow* window; - while ((ch = getopt(argc, argv, "a:dfhlm:n:p:r:")) != -1) + while ((ch = getopt(argc, argv, "a:b:dfhlm:n:p:s:")) != -1) { switch (ch) { @@ -207,6 +211,18 @@ int main(int argc, char** argv) usage(); exit(EXIT_FAILURE); } + break; + case 'b': + if (strcasecmp(optarg, BEHAVIOR_NAME_NONE) == 0) + behavior = GLFW_RELEASE_BEHAVIOR_NONE; + else if (strcasecmp(optarg, BEHAVIOR_NAME_FLUSH) == 0) + behavior = GLFW_RELEASE_BEHAVIOR_FLUSH; + else + { + usage(); + exit(EXIT_FAILURE); + } + break; case 'd': debug = GL_TRUE; break; @@ -236,7 +252,7 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } break; - case 'r': + case 's': if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0) strategy = GLFW_NO_RESET_NOTIFICATION; else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0) @@ -284,6 +300,23 @@ int main(int argc, char** argv) if (strategy) glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, strategy); + if (behavior) + glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, behavior); + + glfwWindowHint(GLFW_RED_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_GREEN_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_BLUE_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_ALPHA_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_DEPTH_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_STENCIL_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_ACCUM_RED_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_ACCUM_GREEN_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_ACCUM_BLUE_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_AUX_BUFFERS, GLFW_DONT_CARE); + glfwWindowHint(GLFW_SAMPLES, GLFW_DONT_CARE); + glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_DONT_CARE); + glfwWindowHint(GLFW_VISIBLE, GL_FALSE); window = glfwCreateWindow(200, 200, "Version", NULL, NULL); diff --git a/extern/glfw/tests/iconify.c b/extern/glfw/tests/iconify.c index 361fe2f..037b85a 100644 --- a/extern/glfw/tests/iconify.c +++ b/extern/glfw/tests/iconify.c @@ -24,7 +24,7 @@ //======================================================================== // // This program is used to test the iconify/restore functionality for -// both fullscreen and windowed mode windows +// both full screen and windowed mode windows // //======================================================================== @@ -37,7 +37,12 @@ static void usage(void) { - printf("Usage: iconify [-h] [-f]\n"); + printf("Usage: iconify [-h] [-f [-a] [-n]]\n"); + printf("Options:\n"); + printf(" -a create windows for all monitors\n"); + printf(" -f create full screen window(s)\n"); + printf(" -h show this help\n"); + printf(" -n no automatic iconification of full screen windows\n"); } static void error_callback(int error, const char* description) @@ -91,38 +96,40 @@ static void window_iconify_callback(GLFWwindow* window, int iconified) iconified ? "iconified" : "restored"); } -int main(int argc, char** argv) +static void window_refresh_callback(GLFWwindow* window) { - int width, height, ch; - GLFWmonitor* monitor = NULL; + int width, height; + glfwGetFramebufferSize(window, &width, &height); + + glfwMakeContextCurrent(window); + + glEnable(GL_SCISSOR_TEST); + + glScissor(0, 0, width, height); + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); + + glScissor(0, 0, 640, 480); + glClearColor(1, 1, 1, 0); + glClear(GL_COLOR_BUFFER_BIT); + + glfwSwapBuffers(window); +} + +static GLFWwindow* create_window(GLFWmonitor* monitor) +{ + int width, height; GLFWwindow* window; - glfwSetErrorCallback(error_callback); - - if (!glfwInit()) - exit(EXIT_FAILURE); - - while ((ch = getopt(argc, argv, "fh")) != -1) - { - switch (ch) - { - case 'h': - usage(); - exit(EXIT_SUCCESS); - - case 'f': - monitor = glfwGetPrimaryMonitor(); - break; - - default: - usage(); - exit(EXIT_FAILURE); - } - } - if (monitor) { const GLFWvidmode* mode = glfwGetVideoMode(monitor); + + glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); + glfwWindowHint(GLFW_RED_BITS, mode->redBits); + glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); + glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); + width = mode->width; height = mode->height; } @@ -139,35 +146,106 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } - glfwMakeContextCurrent(window); - glfwSwapInterval(1); + return window; +} - glfwSetKeyCallback(window, key_callback); - glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); - glfwSetWindowSizeCallback(window, window_size_callback); - glfwSetWindowFocusCallback(window, window_focus_callback); - glfwSetWindowIconifyCallback(window, window_iconify_callback); +int main(int argc, char** argv) +{ + int ch, i, window_count; + GLboolean auto_iconify = GL_TRUE, fullscreen = GL_FALSE, all_monitors = GL_FALSE; + GLFWwindow** windows; - printf("Window is %s and %s\n", - glfwGetWindowAttrib(window, GLFW_ICONIFIED) ? "iconified" : "restored", - glfwGetWindowAttrib(window, GLFW_FOCUSED) ? "focused" : "defocused"); - - glEnable(GL_SCISSOR_TEST); - - while (!glfwWindowShouldClose(window)) + while ((ch = getopt(argc, argv, "afhn")) != -1) { - glfwGetFramebufferSize(window, &width, &height); + switch (ch) + { + case 'a': + all_monitors = GL_TRUE; + break; - glScissor(0, 0, width, height); - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); + case 'h': + usage(); + exit(EXIT_SUCCESS); - glScissor(0, 0, 640, 480); - glClearColor(1, 1, 1, 0); - glClear(GL_COLOR_BUFFER_BIT); + case 'f': + fullscreen = GL_TRUE; + break; - glfwSwapBuffers(window); + case 'n': + auto_iconify = GL_FALSE; + break; + + default: + usage(); + exit(EXIT_FAILURE); + } + } + + glfwSetErrorCallback(error_callback); + + if (!glfwInit()) + exit(EXIT_FAILURE); + + glfwWindowHint(GLFW_AUTO_ICONIFY, auto_iconify); + + if (fullscreen && all_monitors) + { + int monitor_count; + GLFWmonitor** monitors = glfwGetMonitors(&monitor_count); + + window_count = monitor_count; + windows = calloc(window_count, sizeof(GLFWwindow*)); + + for (i = 0; i < monitor_count; i++) + { + windows[i] = create_window(monitors[i]); + if (!windows[i]) + break; + } + } + else + { + GLFWmonitor* monitor = NULL; + + if (fullscreen) + monitor = glfwGetPrimaryMonitor(); + + window_count = 1; + windows = calloc(window_count, sizeof(GLFWwindow*)); + windows[0] = create_window(monitor); + } + + for (i = 0; i < window_count; i++) + { + glfwSetKeyCallback(windows[i], key_callback); + glfwSetFramebufferSizeCallback(windows[i], framebuffer_size_callback); + glfwSetWindowSizeCallback(windows[i], window_size_callback); + glfwSetWindowFocusCallback(windows[i], window_focus_callback); + glfwSetWindowIconifyCallback(windows[i], window_iconify_callback); + glfwSetWindowRefreshCallback(windows[i], window_refresh_callback); + + window_refresh_callback(windows[i]); + + printf("Window is %s and %s\n", + glfwGetWindowAttrib(windows[i], GLFW_ICONIFIED) ? "iconified" : "restored", + glfwGetWindowAttrib(windows[i], GLFW_FOCUSED) ? "focused" : "defocused"); + } + + for (;;) + { glfwPollEvents(); + + for (i = 0; i < window_count; i++) + { + if (glfwWindowShouldClose(windows[i])) + break; + } + + if (i < window_count) + break; + + // Workaround for an issue with msvcrt and mintty + fflush(stdout); } glfwTerminate(); diff --git a/extern/glfw/tests/modes.c b/extern/glfw/tests/modes.c index 7635368..58067e3 100644 --- a/extern/glfw/tests/modes.c +++ b/extern/glfw/tests/modes.c @@ -125,6 +125,7 @@ static void test_modes(GLFWmonitor* monitor) glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits); + glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate); printf("Testing mode %u on monitor %s: %s\n", (unsigned int) i, diff --git a/extern/glfw/tests/peter.c b/extern/glfw/tests/peter.c index 030ea50..723167a 100644 --- a/extern/glfw/tests/peter.c +++ b/extern/glfw/tests/peter.c @@ -1,5 +1,5 @@ //======================================================================== -// Cursor input bug test +// Cursor mode test // Copyright (c) Camilla Berglund // // This software is provided 'as-is', without any express or implied @@ -23,10 +23,7 @@ // //======================================================================== // -// This test came about as the result of bugs #1262764, #1726540 and -// #1726592, all reported by the user peterpp, hence the name -// -// The utility of this test outside of these bugs is uncertain +// This test allows you to switch between the various cursor modes // //======================================================================== @@ -39,20 +36,6 @@ static GLboolean reopen = GL_FALSE; static double cursor_x; static double cursor_y; -static void toggle_cursor(GLFWwindow* window) -{ - if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) - { - printf("Released cursor\n"); - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - } - else - { - printf("Captured cursor\n"); - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - } -} - static void error_callback(int error, const char* description) { fprintf(stderr, "Error: %s\n", description); @@ -60,30 +43,39 @@ static void error_callback(int error, const char* description) static void cursor_position_callback(GLFWwindow* window, double x, double y) { - printf("Cursor moved to: %f %f (%f %f)\n", x, y, x - cursor_x, y - cursor_y); + printf("%0.3f: Cursor position: %f %f (%f %f)\n", + glfwGetTime(), + x, y, x - cursor_x, y - cursor_y); + cursor_x = x; cursor_y = y; } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { + if (action != GLFW_PRESS) + return; + switch (key) { - case GLFW_KEY_SPACE: - { - if (action == GLFW_PRESS) - toggle_cursor(window); - + case GLFW_KEY_D: + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); + printf("(( cursor is disabled ))\n"); + break; + + case GLFW_KEY_H: + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); + printf("(( cursor is hidden ))\n"); + break; + + case GLFW_KEY_N: + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + printf("(( cursor is normal ))\n"); break; - } case GLFW_KEY_R: - { - if (action == GLFW_PRESS) - reopen = GL_TRUE; - + reopen = GL_TRUE; break; - } } } @@ -148,6 +140,9 @@ int main(void) reopen = GL_FALSE; } + + // Workaround for an issue with msvcrt and mintty + fflush(stdout); } glfwTerminate(); diff --git a/extern/glfw/tests/reopen.c b/extern/glfw/tests/reopen.c index 6f69b90..7af8e8a 100644 --- a/extern/glfw/tests/reopen.c +++ b/extern/glfw/tests/reopen.c @@ -26,7 +26,7 @@ // This test came about as the result of bug #1262773 // // It closes and re-opens the GLFW window every five seconds, alternating -// between windowed and fullscreen mode +// between windowed and full screen mode // // It also times and logs opening and closing actions and attempts to separate // user initiated window closing from its own @@ -124,7 +124,7 @@ int main(int argc, char** argv) { GLFWmonitor* monitor = NULL; - if (count & 1) + if (count % 2 == 0) { int monitorCount; GLFWmonitor** monitors = glfwGetMonitors(&monitorCount); diff --git a/extern/glfw/tests/sharing.c b/extern/glfw/tests/sharing.c index 030ea11..54b15c8 100644 --- a/extern/glfw/tests/sharing.c +++ b/extern/glfw/tests/sharing.c @@ -27,7 +27,6 @@ // //======================================================================== -#define GLFW_INCLUDE_GLU #include #include @@ -100,7 +99,7 @@ static void draw_quad(GLuint texture) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluOrtho2D(0.f, 1.f, 0.f, 1.f); + glOrtho(0.f, 1.f, 0.f, 1.f, 0.f, 1.f); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); diff --git a/extern/glfw/tests/threads.c b/extern/glfw/tests/threads.c index f4fcdd9..0a38578 100644 --- a/extern/glfw/tests/threads.c +++ b/extern/glfw/tests/threads.c @@ -1,5 +1,5 @@ //======================================================================== -// Multithreading test +// Multi-threading test // Copyright (c) Camilla Berglund // // This software is provided 'as-is', without any express or implied @@ -53,7 +53,7 @@ static void error_callback(int error, const char* description) static int thread_main(void* data) { - const Thread* thread = (const Thread*) data; + const Thread* thread = data; glfwMakeContextCurrent(thread->window); glfwSwapInterval(1); @@ -124,6 +124,9 @@ int main(void) } } + for (i = 0; i < count; i++) + glfwHideWindow(threads[i].window); + for (i = 0; i < count; i++) thrd_join(threads[i].id, &result); diff --git a/extern/glfw/tests/windows.c b/extern/glfw/tests/windows.c index b8ad663..164a298 100644 --- a/extern/glfw/tests/windows.c +++ b/extern/glfw/tests/windows.c @@ -32,7 +32,7 @@ #include #include -static const char* titles[] = +static const char* titles[4] = { "Foo", "Bar", @@ -45,6 +45,16 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } +static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) +{ + if (key == GLFW_KEY_SPACE && action == GLFW_PRESS) + { + int xpos, ypos; + glfwGetWindowPos(window, &xpos, &ypos); + glfwSetWindowPos(window, xpos, ypos); + } +} + int main(void) { int i; @@ -60,6 +70,8 @@ int main(void) for (i = 0; i < 4; i++) { + int left, top, right, bottom; + windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL); if (!windows[i]) { @@ -67,16 +79,23 @@ int main(void) exit(EXIT_FAILURE); } + glfwSetKeyCallback(windows[i], key_callback); + glfwMakeContextCurrent(windows[i]); glClearColor((GLclampf) (i & 1), (GLclampf) (i >> 1), i ? 0.f : 1.f, 0.f); - glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300); - glfwShowWindow(windows[i]); + glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom); + glfwSetWindowPos(windows[i], + 100 + (i & 1) * (200 + left + right), + 100 + (i >> 1) * (200 + top + bottom)); } + for (i = 0; i < 4; i++) + glfwShowWindow(windows[i]); + while (running) { for (i = 0; i < 4; i++)