Merge pull request #10 from Puddlestomper/master

Update this fork to match glfw/glfw
This commit is contained in:
Yan Chernikov 2019-09-20 17:41:14 +10:00 committed by GitHub
commit 9bed794ab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
134 changed files with 13633 additions and 15685 deletions

View File

@ -2,6 +2,7 @@ branches:
only: only:
- ci - ci
- master - master
- 3.3-stable
skip_tags: true skip_tags: true
environment: environment:
CFLAGS: /WX CFLAGS: /WX

4
.gitattributes vendored
View File

@ -1 +1,5 @@
*.m linguist-language=Objective-C *.m linguist-language=Objective-C
.gitignore export-ignore
.gitattributes export-ignore
.travis.yml export-ignore
.appveyor.yml export-ignore

9
.gitignore vendored
View File

@ -7,6 +7,7 @@ _ReSharper*
*.dir *.dir
*.vcxproj* *.vcxproj*
*.sln *.sln
.vs/
Win32 Win32
x64 x64
Debug Debug
@ -42,11 +43,11 @@ src/wayland-relative-pointer-unstable-v1-protocol.c
# Compiled binaries # Compiled binaries
src/libglfw.so src/libglfw.so
src/libglfw.so.3 src/libglfw.so.3
src/libglfw.so.3.3 src/libglfw.so.3.4
src/libglfw.dylib src/libglfw.dylib
src/libglfw.dylib src/libglfw.dylib
src/libglfw.3.dylib src/libglfw.3.dylib
src/libglfw.3.3.dylib src/libglfw.3.4.dylib
src/libglfw3.a src/libglfw3.a
src/glfw3.lib src/glfw3.lib
src/glfw3.dll src/glfw3.dll
@ -61,7 +62,7 @@ examples/offscreen
examples/particles examples/particles
examples/splitview examples/splitview
examples/sharing examples/sharing
examples/simple examples/triangle-opengl
examples/wave examples/wave
tests/*.app tests/*.app
tests/*.exe tests/*.exe
@ -81,6 +82,6 @@ tests/tearing
tests/threads tests/threads
tests/timeout tests/timeout
tests/title tests/title
tests/vulkan tests/triangle-vulkan
tests/windows tests/windows

View File

@ -4,31 +4,47 @@ branches:
only: only:
- ci - ci
- master - master
sudo: false - 3.3-stable
dist: trusty
addons:
apt:
packages:
- cmake
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev
matrix: matrix:
include: include:
- os: linux - os: linux
dist: xenial
sudo: false
name: "X11 shared library"
addons:
apt:
packages:
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev
env: env:
- BUILD_SHARED_LIBS=ON - BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror - CFLAGS=-Werror
- os: linux - os: linux
dist: xenial
sudo: false
name: "X11 static library"
addons:
apt:
packages:
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev
env: env:
- BUILD_SHARED_LIBS=OFF - BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror - CFLAGS=-Werror
- os: linux - os: linux
dist: xenial
sudo: required sudo: required
name: "Wayland shared library"
addons: addons:
apt: apt:
sources:
- ppa:kubuntu-ppa/backports
packages: packages:
- extra-cmake-modules
- libwayland-dev - libwayland-dev
- libxkbcommon-dev - libxkbcommon-dev
- libegl1-mesa-dev - libegl1-mesa-dev
@ -37,10 +53,15 @@ matrix:
- BUILD_SHARED_LIBS=ON - BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror - CFLAGS=-Werror
- os: linux - os: linux
dist: xenial
sudo: required sudo: required
name: "Wayland static library"
addons: addons:
apt: apt:
sources:
- ppa:kubuntu-ppa/backports
packages: packages:
- extra-cmake-modules
- libwayland-dev - libwayland-dev
- libxkbcommon-dev - libxkbcommon-dev
- libegl1-mesa-dev - libegl1-mesa-dev
@ -49,20 +70,25 @@ matrix:
- BUILD_SHARED_LIBS=OFF - BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror - CFLAGS=-Werror
- os: osx - os: osx
sudo: false
name: "Cocoa shared library"
env: env:
- BUILD_SHARED_LIBS=ON - BUILD_SHARED_LIBS=ON
- CFLAGS=-Werror - CFLAGS=-Werror
- os: osx - os: osx
sudo: false
name: "Cocoa static library"
env: env:
- BUILD_SHARED_LIBS=OFF - BUILD_SHARED_LIBS=OFF
- CFLAGS=-Werror - CFLAGS=-Werror
script: script:
- if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then echo Trailing whitespace found, aborting.; exit 1; fi - if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then
echo Trailing whitespace found, aborting;
exit 1;
fi
- mkdir build - mkdir build
- cd build - cd build
- if test -n "${USE_WAYLAND}"; - if test -n "${USE_WAYLAND}"; then
then wget https://mirrors.kernel.org/ubuntu/pool/universe/e/extra-cmake-modules/extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb;
sudo dpkg -i extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb;
git clone git://anongit.freedesktop.org/wayland/wayland-protocols; git clone git://anongit.freedesktop.org/wayland/wayland-protocols;
pushd wayland-protocols; pushd wayland-protocols;
git checkout 1.15 && ./autogen.sh --prefix=/usr && make && sudo make install; git checkout 1.15 && ./autogen.sh --prefix=/usr && make && sudo make install;

View File

@ -1,13 +0,0 @@
# Define the environment for cross compiling from Linux to Win64
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "amd64-mingw32msvc-gcc")
SET(CMAKE_CXX_COMPILER "amd64-mingw32msvc-g++")
SET(CMAKE_RC_COMPILER "amd64-mingw32msvc-windres")
SET(CMAKE_RANLIB "amd64-mingw32msvc-ranlib")
# Configure the behaviour of the find commands
SET(CMAKE_FIND_ROOT_PATH "/usr/amd64-mingw32msvc")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -1,13 +0,0 @@
# Define the environment for cross compiling from Linux to Win32
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "i586-mingw32msvc-gcc")
SET(CMAKE_CXX_COMPILER "i586-mingw32msvc-g++")
SET(CMAKE_RC_COMPILER "i586-mingw32msvc-windres")
SET(CMAKE_RANLIB "i586-mingw32msvc-ranlib")
# Configure the behaviour of the find commands
SET(CMAKE_FIND_ROOT_PATH "/usr/i586-mingw32msvc")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -1,13 +0,0 @@
# Define the environment for cross compiling from Linux to Win32
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "i686-pc-mingw32-gcc")
SET(CMAKE_CXX_COMPILER "i686-pc-mingw32-g++")
SET(CMAKE_RC_COMPILER "i686-pc-mingw32-windres")
SET(CMAKE_RANLIB "i686-pc-mingw32-ranlib")
#Configure the behaviour of the find commands
SET(CMAKE_FIND_ROOT_PATH "/opt/mingw/usr/i686-pc-mingw32")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -0,0 +1,13 @@
# Define the environment for cross-compiling with 32-bit MinGW-w64 Clang
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang")
SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++")
SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
# Configure the behaviour of the find commands
SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -1,4 +1,4 @@
# Define the environment for cross compiling from Linux to Win32 # Define the environment for cross-compiling with 32-bit MinGW-w64 GCC
SET(CMAKE_SYSTEM_NAME Windows) # Target system name SET(CMAKE_SYSTEM_NAME Windows) # Target system name
SET(CMAKE_SYSTEM_VERSION 1) SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc") SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc")

View File

@ -1,41 +0,0 @@
# Find Vulkan
#
# VULKAN_INCLUDE_DIR
# VULKAN_LIBRARY
# VULKAN_FOUND
if (WIN32)
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
"$ENV{VULKAN_SDK}/Include"
"$ENV{VK_SDK_PATH}/Include")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
"$ENV{VULKAN_SDK}/Lib"
"$ENV{VULKAN_SDK}/Bin"
"$ENV{VK_SDK_PATH}/Bin")
find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
"$ENV{VULKAN_SDK}/Lib"
"$ENV{VULKAN_SDK}/Bin"
"$ENV{VK_SDK_PATH}/Bin")
else()
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
"$ENV{VULKAN_SDK}/Lib32"
"$ENV{VULKAN_SDK}/Bin32"
"$ENV{VK_SDK_PATH}/Bin32")
find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
"$ENV{VULKAN_SDK}/Lib32"
"$ENV{VULKAN_SDK}/Bin32"
"$ENV{VK_SDK_PATH}/Bin32")
endif()
else()
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
"$ENV{VULKAN_SDK}/include")
find_library(VULKAN_LIBRARY NAMES vulkan HINTS
"$ENV{VULKAN_SDK}/lib")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY VULKAN_STATIC_LIBRARY)

View File

@ -0,0 +1,13 @@
# Define the environment for cross-compiling with 64-bit MinGW-w64 Clang
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang")
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++")
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
# Configure the behaviour of the find commands
SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -1,4 +1,4 @@
# Define the environment for cross compiling from Linux to Win32 # Define the environment for cross-compiling with 64-bit MinGW-w64 GCC
SET(CMAKE_SYSTEM_NAME Windows) # Target system name SET(CMAKE_SYSTEM_NAME Windows) # Target system name
SET(CMAKE_SYSTEM_VERSION 1) SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc") SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc")

View File

@ -1,45 +1,41 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(GLFW C) project(GLFW VERSION 3.4.0 LANGUAGES C)
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
if (NOT CMAKE_VERSION VERSION_LESS "3.1") if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
endif() endif()
set(GLFW_VERSION_MAJOR "3") if (POLICY CMP0077)
set(GLFW_VERSION_MINOR "3") cmake_policy(SET CMP0077 NEW)
set(GLFW_VERSION_PATCH "0") endif()
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) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(GLFW_STANDALONE TRUE)
endif()
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON) option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON) option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON) option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
option(GLFW_INSTALL "Generate installation target" ON) option(GLFW_INSTALL "Generate installation target" ON)
option(GLFW_VULKAN_STATIC "Use the Vulkan loader statically linked into application" OFF) option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
if (UNIX) include(GNUInstallDirs)
option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF) include(CMakeDependentOption)
endif()
if (WIN32) cmake_dependent_option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF
option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF) "UNIX" OFF)
endif() cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
"WIN32" OFF)
if (UNIX AND NOT APPLE) cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF) "UNIX;NOT APPLE" OFF)
endif() cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
"MSVC" OFF)
if (MSVC)
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
set(_GLFW_BUILD_DLL 1) set(_GLFW_BUILD_DLL 1)
@ -53,13 +49,17 @@ else()
endif() endif()
if (GLFW_VULKAN_STATIC) if (GLFW_VULKAN_STATIC)
if (BUILD_SHARED_LIBS)
# If you absolutely must do this, remove this line and add the Vulkan
# loader static library via the CMAKE_SHARED_LINKER_FLAGS
message(FATAL_ERROR "You are trying to link the Vulkan loader static library into the GLFW shared library")
endif()
set(_GLFW_VULKAN_STATIC 1) set(_GLFW_VULKAN_STATIC 1)
endif() endif()
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules") list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(Vulkan)
if (GLFW_BUILD_DOCS) if (GLFW_BUILD_DOCS)
set(DOXYGEN_SKIP_DOT TRUE) set(DOXYGEN_SKIP_DOT TRUE)
@ -156,24 +156,6 @@ else()
message(FATAL_ERROR "No supported platform was detected") message(FATAL_ERROR "No supported platform was detected")
endif() endif()
#--------------------------------------------------------------------
# Add Vulkan static library if requested
#--------------------------------------------------------------------
if (GLFW_VULKAN_STATIC)
if (VULKAN_FOUND AND VULKAN_STATIC_LIBRARY)
list(APPEND glfw_LIBRARIES "${VULKAN_STATIC_LIBRARY}")
if (BUILD_SHARED_LIBS)
message(WARNING "Linking Vulkan loader static library into GLFW")
endif()
else()
if (BUILD_SHARED_LIBS OR GLFW_BUILD_EXAMPLES OR GLFW_BUILD_TESTS)
message(FATAL_ERROR "Vulkan loader static library not found")
else()
message(WARNING "Vulkan loader static library not found")
endif()
endif()
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Find and add Unix math and time libraries # Find and add Unix math and time libraries
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -224,29 +206,35 @@ if (_GLFW_X11)
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
# Check for XRandR (modern resolution switching and gamma control) # Check for XRandR (modern resolution switching and gamma control)
if (NOT X11_Xrandr_FOUND) if (NOT X11_Xrandr_INCLUDE_PATH)
message(FATAL_ERROR "The RandR headers were not found") message(FATAL_ERROR "The RandR headers were not found")
endif() endif()
# Check for Xinerama (legacy multi-monitor support) # Check for Xinerama (legacy multi-monitor support)
if (NOT X11_Xinerama_FOUND) if (NOT X11_Xinerama_INCLUDE_PATH)
message(FATAL_ERROR "The Xinerama headers were not found") message(FATAL_ERROR "The Xinerama headers were not found")
endif() endif()
# Check for Xkb (X keyboard extension) # Check for Xkb (X keyboard extension)
if (NOT X11_Xkb_FOUND) if (NOT X11_Xkb_INCLUDE_PATH)
message(FATAL_ERROR "The X keyboard extension headers were not found") message(FATAL_ERROR "The X keyboard extension headers were not found")
endif() endif()
# Check for Xcursor (cursor creation from RGBA images) # Check for Xcursor (cursor creation from RGBA images)
if (NOT X11_Xcursor_FOUND) if (NOT X11_Xcursor_INCLUDE_PATH)
message(FATAL_ERROR "The Xcursor headers were not found") message(FATAL_ERROR "The Xcursor headers were not found")
endif() endif()
# Check for XInput (modern HID input)
if (NOT X11_Xi_INCLUDE_PATH)
message(FATAL_ERROR "The XInput headers were not found")
endif()
list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}" list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}"
"${X11_Xinerama_INCLUDE_PATH}" "${X11_Xinerama_INCLUDE_PATH}"
"${X11_Xkb_INCLUDE_PATH}" "${X11_Xkb_INCLUDE_PATH}"
"${X11_Xcursor_INCLUDE_PATH}") "${X11_Xcursor_INCLUDE_PATH}"
"${X11_Xi_INCLUDE_PATH}")
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -305,6 +293,13 @@ if (_GLFW_COCOA)
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo") set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo")
endif() endif()
#--------------------------------------------------------------------
# Add the Vulkan loader as a dependency if necessary
#--------------------------------------------------------------------
if (GLFW_VULKAN_STATIC)
list(APPEND glfw_PKG_DEPS "vulkan")
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Export GLFW library dependencies # Export GLFW library dependencies
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -320,7 +315,7 @@ endforeach()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
set(GLFW_CONFIG_PATH "lib${LIB_SUFFIX}/cmake/glfw3") set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3")
configure_package_config_file(src/glfw3Config.cmake.in configure_package_config_file(src/glfw3Config.cmake.in
src/glfw3Config.cmake src/glfw3Config.cmake
@ -328,7 +323,7 @@ configure_package_config_file(src/glfw3Config.cmake.in
NO_CHECK_REQUIRED_COMPONENTS_MACRO) NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file(src/glfw3ConfigVersion.cmake write_basic_package_version_file(src/glfw3ConfigVersion.cmake
VERSION ${GLFW_VERSION_FULL} VERSION ${GLFW_VERSION}
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY) configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY)
@ -357,7 +352,7 @@ endif()
# The library is installed by src/CMakeLists.txt # The library is installed by src/CMakeLists.txt
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (GLFW_INSTALL) if (GLFW_INSTALL)
install(DIRECTORY include/GLFW DESTINATION include install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
@ -368,7 +363,7 @@ if (GLFW_INSTALL)
EXPORT_LINK_INTERFACE_LIBRARIES EXPORT_LINK_INTERFACE_LIBRARIES
DESTINATION "${GLFW_CONFIG_PATH}") DESTINATION "${GLFW_CONFIG_PATH}")
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
DESTINATION "lib${LIB_SUFFIX}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
# Only generate this target if no higher-level project already has # Only generate this target if no higher-level project already has
if (NOT TARGET uninstall) if (NOT TARGET uninstall)

228
README.md
View File

@ -10,24 +10,22 @@ GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan
application development. It provides a simple, platform-independent API for application development. It provides a simple, platform-independent API for
creating windows, contexts and surfaces, reading input, handling events, etc. creating windows, contexts and surfaces, reading input, handling events, etc.
GLFW natively supports Windows, macOS and Linux and other Unix-like systems. GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On
An experimental implementation for the Wayland protocol is available but not Linux both X11 and Wayland is supported.
yet officially supported.
GLFW is licensed under the [zlib/libpng GLFW is licensed under the [zlib/libpng
license](http://www.glfw.org/license.html). license](http://www.glfw.org/license.html).
The latest stable release is version 3.2.1. You can [download](http://www.glfw.org/download.html) the latest stable release
as source or Windows binaries, or fetch the `latest` branch from GitHub. Each
See the [downloads](http://www.glfw.org/download.html) page for details and release starting with 3.0 also has a corresponding [annotated
files, or fetch the `latest` branch, which always points to the latest stable
release. Each release starting with 3.0 also has a corresponding [annotated
tag](https://github.com/glfw/glfw/releases) with source and binary archives. tag](https://github.com/glfw/glfw/releases) with source and binary archives.
The [version history](http://www.glfw.org/changelog.html) lists all user-visible
changes for every release.
This is a development branch for version 3.3, which is _not yet described_. The [documentation](http://www.glfw.org/docs/latest/) is available online and is
Pre-release documentation is available [here](http://www.glfw.org/docs/3.3/). included in all source and binary archives. See the [release
notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and
deprecations in the latest release. For more details see the [version
history](http://www.glfw.org/changelog.html).
The `master` branch is the stable integration branch and _should_ always compile The `master` branch is the stable integration branch and _should_ always compile
and run on all supported platforms, although details of newly added features may and run on all supported platforms, although details of newly added features may
@ -44,9 +42,10 @@ guide](http://www.glfw.org/docs/latest/moving.html) for moving to the GLFW
## Compiling GLFW ## Compiling GLFW
GLFW itself requires only the headers and libraries for your window system. It GLFW itself requires only the headers and libraries for your OS and window
does not need the headers for any context creation API (WGL, GLX, EGL, NSGL, system. It does not need the headers for any context creation API (WGL, GLX,
OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable support for them. EGL, NSGL, OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable
support for them.
GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and
MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
@ -75,7 +74,7 @@ more information.
## System requirements ## System requirements
GLFW supports Windows XP and later and macOS 10.7 and later. Linux and other GLFW supports Windows XP and later and macOS 10.8 and later. Linux and other
Unix-like systems running the X Window System are supported even without Unix-like systems running the X Window System are supported even without
a desktop environment or modern extensions, although some features require a desktop environment or modern extensions, although some features require
a running window or clipboard manager. The OSMesa backend requires Mesa 6.3. a running window or clipboard manager. The OSMesa backend requires Mesa 6.3.
@ -98,17 +97,12 @@ located in the `deps/` directory.
with command-line options with command-line options
- [TinyCThread](https://github.com/tinycthread/tinycthread) for threaded - [TinyCThread](https://github.com/tinycthread/tinycthread) for threaded
examples examples
- An OpenGL 3.2 core loader generated by - [glad2](https://github.com/Dav1dde/glad) for loading OpenGL and Vulkan
[glad](https://github.com/Dav1dde/glad) for examples using modern OpenGL functions
- [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in - [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in
examples examples
- [Nuklear](https://github.com/vurtun/nuklear) for test and example UI - [Nuklear](https://github.com/vurtun/nuklear) for test and example UI
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
- [Vulkan headers](https://www.khronos.org/registry/vulkan/) for Vulkan tests
The Vulkan example additionally requires the LunarG Vulkan SDK to be installed,
or it will not be included in the build. On macOS you need to provide the path
to the SDK manually as it has no standard installation location.
The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can
find that tool. find that tool.
@ -124,165 +118,19 @@ information on what to include when reporting a bug.
## Changelog ## Changelog
- Added `glfwGetError` function for querying the last error code and its - Disabled tests and examples by default when built as a CMake subdirectory
description (#970) - Bugfix: The CMake config-file package used an absolute path and was not
- Added `glfwUpdateGamepadMappings` function for importing gamepad mappings in relocatable (#1470)
SDL\_GameControllerDB format (#900) - [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
- Added `glfwJoystickIsGamepad` function for querying whether a joystick has symbol redefinition (#1524)
a gamepad mapping (#900) - [Win32] Bugfix: The cursor position event was emitted before its cursor enter
- Added `glfwGetJoystickGUID` function for querying the SDL compatible GUID of event (#1490)
a joystick (#900) - [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
- Added `glfwGetGamepadName` function for querying the name provided by the window (#1499)
gamepad mapping (#900) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
- Added `glfwGetGamepadState` function, `GLFW_GAMEPAD_*` and `GLFWgamepadstate` - [X11] Bugfix: Key names were not updated when the keyboard layout changed
for retrieving gamepad input state (#900) (#1462,#1528)
- Added `glfwGetWindowContentScale`, `glfwGetMonitorContentScale` and - [NSGL] Removed enforcement of forward-compatible flag for core contexts
`glfwSetWindowContentScaleCallback` for DPI-aware rendering
(#235,#439,#677,#845,#898)
- Added `glfwRequestWindowAttention` function for requesting attention from the
user (#732,#988)
- Added `glfwGetKeyScancode` function that allows retrieving platform dependent
scancodes for keys (#830)
- Added `glfwSetWindowMaximizeCallback` and `GLFWwindowmaximizefun` for
receiving window maximization events (#778)
- Added `glfwSetWindowAttrib` function for changing window attributes (#537)
- Added `glfwGetJoystickHats` function for querying joystick hats
(#889,#906,#934)
- Added `glfwInitHint` for setting initialization hints
- Added `glfwWindowHintString` for setting string type window hints (#893,#1139)
- Added `glfwGetWindowOpacity` and `glfwSetWindowOpacity` for controlling whole
window transparency (#1089)
- Added `glfwSetMonitorUserPointer` and `glfwGetMonitorUserPointer` for
per-monitor user pointers
- Added `glfwSetJoystickUserPointer` and `glfwGetJoystickUserPointer` for
per-joystick user pointers
- Added `glfwGetX11SelectionString` and `glfwSetX11SelectionString`
functions for accessing X11 primary selection (#894,#1056)
- Added headless [OSMesa](http://mesa3d.org/osmesa.html) backend (#850)
- Added definition of `GLAPIENTRY` to public header
- Added `GLFW_TRANSPARENT_FRAMEBUFFER` window hint and attribute for controlling
per-pixel framebuffer transparency (#197,#663,#715,#723,#1078)
- Added `GLFW_HOVERED` window attribute for polling cursor hover state (#1166)
- Added `GLFW_CENTER_CURSOR` window hint for controlling cursor centering
(#749,#842)
- Added `GLFW_FOCUS_ON_SHOW` window hint and attribute to control input focus
on calling show window (#1189)
- Added `GLFW_SCALE_TO_MONITOR` window hint for automatic window resizing
(#676,#1115)
- Added `GLFW_JOYSTICK_HAT_BUTTONS` init hint (#889)
- Added `GLFW_LOCK_KEY_MODS` input mode and `GLFW_MOD_*_LOCK` mod bits (#946)
- Added macOS specific `GLFW_COCOA_RETINA_FRAMEBUFFER` window hint
- Added macOS specific `GLFW_COCOA_FRAME_NAME` window hint (#195)
- Added macOS specific `GLFW_COCOA_GRAPHICS_SWITCHING` window hint (#377,#935)
- Added macOS specific `GLFW_COCOA_CHDIR_RESOURCES` init hint
- Added macOS specific `GLFW_COCOA_MENUBAR` init hint
- Added X11 specific `GLFW_X11_CLASS_NAME` and `GLFW_X11_INSTANCE_NAME` window
hints (#893,#1139)
- Added `GLFW_INCLUDE_ES32` for including the OpenGL ES 3.2 header
- Added `GLFW_OSMESA_CONTEXT_API` for creating OpenGL contexts with
[OSMesa](https://www.mesa3d.org/osmesa.html) (#281)
- Added `GenerateMappings.cmake` script for updating gamepad mappings
- Made `glfwCreateWindowSurface` emit an error when the window has a context
(#1194,#1205)
- Deprecated window parameter of clipboard string functions
- Deprecated charmods callback
- Removed `GLFW_USE_RETINA` compile-time option
- Removed `GLFW_USE_CHDIR` compile-time option
- Removed `GLFW_USE_MENUBAR` compile-time option
- Bugfix: Calling `glfwMaximizeWindow` on a full screen window was not ignored
- Bugfix: `GLFW_INCLUDE_VULKAN` could not be combined with the corresponding
OpenGL and OpenGL ES header macros
- Bugfix: `glfwGetInstanceProcAddress` returned `NULL` for
`vkGetInstanceProcAddr` when `_GLFW_VULKAN_STATIC` was enabled
- Bugfix: Invalid library paths were used in test and example CMake files (#930)
- Bugfix: The scancode for synthetic key release events was always zero
- Bugfix: The generated Doxyfile did not handle paths with spaces (#1081)
- [Win32] Added system error strings to relevant GLFW error descriptions (#733)
- [Win32] Moved to `WM_INPUT` for disabled cursor mode motion input (#125)
- [Win32] Removed XInput circular deadzone from joystick axis data (#1045)
- [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861)
- [Win32] Bugfix: Deadzone logic could underflow with some controllers (#910)
- [Win32] Bugfix: Bitness test in `FindVulkan.cmake` was VS specific (#928)
- [Win32] Bugfix: `glfwVulkanSupported` emitted an error on systems with
a loader but no ICD (#916)
- [Win32] Bugfix: Non-iconified full sreeen windows did not prevent screen
blanking or password enabled screensavers (#851)
- [Win32] Bugfix: Mouse capture logic lost secondary release messages (#954)
- [Win32] Bugfix: The 32-bit Vulkan loader library static was not searched for
- [Win32] Bugfix: Vulkan libraries have a new path as of SDK 1.0.42.0 (#956)
- [Win32] Bugfix: Monitors with no display devices were not enumerated (#960)
- [Win32] Bugfix: Monitor events were not emitted (#784)
- [Win32] Bugfix: The Cygwin DLL was installed to the wrong directory (#1035)
- [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045)
- [Win32] Bugfix: `glfw3native.h` would undefine a foreign `APIENTRY` (#1062)
- [Win32] Bugfix: Disabled cursor mode prevented use of caption buttons
(#650,#1071)
- [Win32] Bugfix: Returned key names did not match other platforms (#943)
- [Win32] Bugfix: Undecorated windows did not maximize to workarea (#899)
- [Win32] Bugfix: Window was resized twice when entering full screen (#1085)
- [Win32] Bugfix: The HID device notification was not unregistered (#1170)
- [Win32] Bugfix: `glfwCreateWindow` activated window even with `GLFW_FOCUSED`
hint set to false (#1179,#1180)
- [Win32] Bugfix: The keypad equals key was reported as `GLFW_KEY_UNKNOWN`
(#1315,#1316)
- [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X
- [X11] Bugfix: Dynamic X11 library loading did not use full sonames (#941)
- [X11] Bugfix: Window creation on 64-bit would read past top of stack (#951)
- [X11] Bugfix: XDND support had multiple non-conformance issues (#968)
- [X11] Bugfix: The RandR monitor path was disabled despite working RandR (#972)
- [X11] Bugfix: IM-duplicated key events would leak at low polling rates (#747)
- [X11] Bugfix: Gamma ramp setting via RandR did not validate ramp size
- [X11] Bugfix: Key name string encoding depended on current locale (#981,#983)
- [X11] Bugfix: Incremental reading of selections was not supported (#275)
- [X11] Bugfix: Selection I/O reported but did not support `COMPOUND_TEXT`
- [X11] Bugfix: Latin-1 text read from selections was not converted to UTF-8
- [X11] Bugfix: NVidia EGL would segfault if unloaded before closing the display
- [X11] Bugfix: Checking window maximized attrib could crash some WMs (#1356)
- [X11] Bugfix: Update cursor position on enter event (#1366)
- [Linux] Added workaround for missing `SYN_DROPPED` in pre-2.6.39 kernel
headers (#1196)
- [Linux] Moved to evdev for joystick input (#906,#1005)
- [Linux] Bugfix: Event processing did not detect joystick disconnection (#932)
- [Linux] Bugfix: The joystick device path could be truncated (#1025)
- [Linux] Bugfix: `glfwInit` would fail if inotify creation failed (#833)
- [Linux] Bugfix: `strdup` was used without any required feature macro (#1055)
- [Cocoa] Added support for Vulkan window surface creation via
[MoltenVK](https://moltengl.com/moltenvk/) (#870)
- [Cocoa] Added support for loading a `MainMenu.nib` when available
- [Cocoa] Bugfix: Disabling window aspect ratio would assert (#852)
- [Cocoa] Bugfix: Window creation failed to set first responder (#876,#883)
- [Cocoa] Bugfix: Removed use of deprecated `CGDisplayIOServicePort` function
(#165,#192,#508,#511)
- [Cocoa] Bugfix: Disabled use of deprecated `CGDisplayModeCopyPixelEncoding`
function on macOS 10.12+
- [Cocoa] Bugfix: Running in AppSandbox would emit warnings (#816,#882)
- [Cocoa] Bugfix: Windows created after the first were not cascaded (#195)
- [Cocoa] Bugfix: Leaving video mode with `glfwSetWindowMonitor` would set
incorrect position and size (#748)
- [Cocoa] Bugfix: Iconified full screen windows could not be restored (#848)
- [Cocoa] Bugfix: Value range was ignored for joystick hats and buttons (#888)
- [Cocoa] Bugfix: Full screen framebuffer was incorrectly sized for some video
modes (#682)
- [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050)
- [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user
notification was shown (#971,#1028)
- [Cocoa] Bugfix: Some characters did not repeat due to Press and Hold (#1010)
- [Cocoa] Bugfix: Window title was lost when full screen or undecorated (#1082)
- [Cocoa] Bugfix: Window was resized twice when entering full screen (#1085)
- [Cocoa] Bugfix: Duplicate size events were not filtered (#1085)
- [Cocoa] Bugfix: Event polling did not initialize AppKit if necessary (#1218)
- [Cocoa] Bugfix: OpenGL rendering was not initially visible on 10.14
(#1334,#1346)
- [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
- [WGL] Added support for `WGL_ARB_create_context_no_error`
- [GLX] Added support for `GLX_ARB_create_context_no_error`
- [GLX] Bugfix: Context creation could segfault if no GLXFBConfigs were
available (#1040)
- [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871)
- [EGL] Added support for `EGL_KHR_context_flush_control`
- [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid
## Contact ## Contact
@ -314,6 +162,7 @@ skills.
- John Bartholomew - John Bartholomew
- Coşku Baş - Coşku Baş
- Niklas Behrens - Niklas Behrens
- Andrew Belt
- Niklas Bergström - Niklas Bergström
- Denis Bernard - Denis Bernard
- Doug Binks - Doug Binks
@ -327,6 +176,7 @@ skills.
- Ian Clarkson - Ian Clarkson
- Michał Cichoń - Michał Cichoń
- Lambert Clara - Lambert Clara
- Anna Clarke
- Yaron Cohen-Tal - Yaron Cohen-Tal
- Omar Cornut - Omar Cornut
- Andrew Corrigan - Andrew Corrigan
@ -351,6 +201,7 @@ skills.
- Mário Freitas - Mário Freitas
- GeO4d - GeO4d
- Marcus Geelnard - Marcus Geelnard
- Charles Giessen
- Stephen Gowen - Stephen Gowen
- Kovid Goyal - Kovid Goyal
- Eloi Marín Gratacós - Eloi Marín Gratacós
@ -362,6 +213,7 @@ skills.
- Lucas Hinderberger - Lucas Hinderberger
- Paul Holden - Paul Holden
- Warren Hu - Warren Hu
- Charles Huber
- IntellectualKitty - IntellectualKitty
- Aaron Jacobs - Aaron Jacobs
- Erik S. V. Jansson - Erik S. V. Jansson
@ -379,11 +231,16 @@ skills.
- Robin Leffmann - Robin Leffmann
- Glenn Lewis - Glenn Lewis
- Shane Liesegang - Shane Liesegang
- Anders Lindqvist
- Leon Linhart
- Eyal Lotem - Eyal Lotem
- Aaron Loucks
- Luflosi
- Tristam MacDonald - Tristam MacDonald
- Hans Mackowiak - Hans Mackowiak
- Дмитри Малышев - Дмитри Малышев
- Zbigniew Mandziejewicz - Zbigniew Mandziejewicz
- Adam Marcus
- Célestin Marot - Célestin Marot
- Kyle McDonald - Kyle McDonald
- David Medlock - David Medlock
@ -391,11 +248,13 @@ skills.
- Jonathan Mercier - Jonathan Mercier
- Marcel Metz - Marcel Metz
- Liam Middlebrook - Liam Middlebrook
- Ave Milia
- Jonathan Miller - Jonathan Miller
- Kenneth Miller - Kenneth Miller
- Bruce Mitchener - Bruce Mitchener
- Jack Moffitt - Jack Moffitt
- Jeff Molofee - Jeff Molofee
- Alexander Monakov
- Pierre Morel - Pierre Morel
- Jon Morton - Jon Morton
- Pierre Moulon - Pierre Moulon
@ -417,10 +276,13 @@ skills.
- Cyril Pichard - Cyril Pichard
- Keith Pitt - Keith Pitt
- Stanislav Podgorskiy - Stanislav Podgorskiy
- Konstantin Podsvirov
- Nathan Poirier
- Alexandre Pretyman - Alexandre Pretyman
- przemekmirek - przemekmirek
- Philip Rideout - Philip Rideout
- Eddie Ringle - Eddie Ringle
- Max Risuhin
- Jorge Rodriguez - Jorge Rodriguez
- Ed Ropple - Ed Ropple
- Aleksey Rybalkin - Aleksey Rybalkin
@ -435,6 +297,7 @@ skills.
- Dmitri Shuralyov - Dmitri Shuralyov
- Daniel Skorupski - Daniel Skorupski
- Bradley Smith - Bradley Smith
- Cliff Smolinsky
- Patrick Snape - Patrick Snape
- Erlend Sogge Heggen - Erlend Sogge Heggen
- Julian Squires - Julian Squires
@ -465,6 +328,7 @@ skills.
- Jay Weisskopf - Jay Weisskopf
- Frank Wille - Frank Wille
- Ryogo Yoshimura - Ryogo Yoshimura
- Lukas Zanner
- Andrey Zholos - Andrey Zholos
- Santi Zupancic - Santi Zupancic
- Jonas Ådahl - Jonas Ådahl

1678
deps/glad.c vendored

File diff suppressed because it is too large Load Diff

3840
deps/glad/gl.h vendored Normal file

File diff suppressed because it is too large Load Diff

3680
deps/glad/glad.h vendored

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#define __khrplatform_h_ #define __khrplatform_h_
/* /*
** Copyright (c) 2008-2009 The Khronos Group Inc. ** Copyright (c) 2008-2018 The Khronos Group Inc.
** **
** Permission is hereby granted, free of charge, to any person obtaining a ** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the ** copy of this software and/or associated documentation files (the
@ -26,18 +26,16 @@
/* Khronos platform-specific types and definitions. /* Khronos platform-specific types and definitions.
* *
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ * The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
* *
* Adopters may modify this file to suit their platform. Adopters are * Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos * encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file. * group so that they can be included in future versions of this file.
* Please submit changes by sending them to the public Khronos Bugzilla * Please submit changes by filing pull requests or issues on
* (http://khronos.org/bugzilla) by filing a bug against product * the EGL Registry repository linked above.
* "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 * See the Implementer's Guidelines for information about where this file
@ -101,6 +99,8 @@
# define KHRONOS_APICALL __declspec(dllimport) # define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__) #elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C # define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else #else
# define KHRONOS_APICALL # define KHRONOS_APICALL
#endif #endif

View File

@ -1,6 +1,6 @@
// /* */
// File: vk_platform.h /* File: vk_platform.h */
// /* */
/* /*
** Copyright (c) 2014-2017 The Khronos Group Inc. ** Copyright (c) 2014-2017 The Khronos Group Inc.
** **
@ -24,7 +24,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif // __cplusplus #endif /* __cplusplus */
/* /*
*************************************************************************************************** ***************************************************************************************************
@ -47,22 +47,22 @@ extern "C"
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
*/ */
#if defined(_WIN32) #if defined(_WIN32)
// On Windows, Vulkan commands use the stdcall convention /* On Windows, Vulkan commands use the stdcall convention */
#define VKAPI_ATTR #define VKAPI_ATTR
#define VKAPI_CALL __stdcall #define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL #define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
#error "Vulkan isn't supported for the 'armeabi' NDK ABI" #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
// calling convention, i.e. float parameters are passed in registers. This /* calling convention, i.e. float parameters are passed in registers. This */
// is true even if the rest of the application passes floats on the stack, /* is true even if the rest of the application passes floats on the stack, */
// as it does by default when compiling for the armeabi-v7a NDK ABI. /* as it does by default when compiling for the armeabi-v7a NDK ABI. */
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
#define VKAPI_CALL #define VKAPI_CALL
#define VKAPI_PTR VKAPI_ATTR #define VKAPI_PTR VKAPI_ATTR
#else #else
// On other platforms, use the default calling convention /* On other platforms, use the default calling convention */
#define VKAPI_ATTR #define VKAPI_ATTR
#define VKAPI_CALL #define VKAPI_CALL
#define VKAPI_PTR #define VKAPI_PTR
@ -83,10 +83,10 @@ extern "C"
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif
#endif // !defined(VK_NO_STDINT_H) #endif /* !defined(VK_NO_STDINT_H) */
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } /* extern "C" */
#endif // __cplusplus #endif /* __cplusplus */
#endif #endif

3480
deps/glad/vulkan.h vendored Normal file

File diff suppressed because it is too large Load Diff

1791
deps/glad_gl.c vendored Normal file

File diff suppressed because it is too large Load Diff

593
deps/glad_vulkan.c vendored Normal file
View File

@ -0,0 +1,593 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/vulkan.h>
#ifndef GLAD_IMPL_UTIL_C_
#define GLAD_IMPL_UTIL_C_
#ifdef _MSC_VER
#define GLAD_IMPL_UTIL_SSCANF sscanf_s
#else
#define GLAD_IMPL_UTIL_SSCANF sscanf
#endif
#endif /* GLAD_IMPL_UTIL_C_ */
int GLAD_VK_VERSION_1_0 = 0;
int GLAD_VK_VERSION_1_1 = 0;
int GLAD_VK_EXT_debug_report = 0;
int GLAD_VK_KHR_surface = 0;
int GLAD_VK_KHR_swapchain = 0;
PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR = NULL;
PFN_vkAcquireNextImageKHR glad_vkAcquireNextImageKHR = NULL;
PFN_vkAllocateCommandBuffers glad_vkAllocateCommandBuffers = NULL;
PFN_vkAllocateDescriptorSets glad_vkAllocateDescriptorSets = NULL;
PFN_vkAllocateMemory glad_vkAllocateMemory = NULL;
PFN_vkBeginCommandBuffer glad_vkBeginCommandBuffer = NULL;
PFN_vkBindBufferMemory glad_vkBindBufferMemory = NULL;
PFN_vkBindBufferMemory2 glad_vkBindBufferMemory2 = NULL;
PFN_vkBindImageMemory glad_vkBindImageMemory = NULL;
PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL;
PFN_vkCmdDraw glad_vkCmdDraw = NULL;
PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL;
PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL;
PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL;
PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL;
PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
PFN_vkCreateComputePipelines glad_vkCreateComputePipelines = NULL;
PFN_vkCreateDebugReportCallbackEXT glad_vkCreateDebugReportCallbackEXT = NULL;
PFN_vkCreateDescriptorPool glad_vkCreateDescriptorPool = NULL;
PFN_vkCreateDescriptorSetLayout glad_vkCreateDescriptorSetLayout = NULL;
PFN_vkCreateDescriptorUpdateTemplate glad_vkCreateDescriptorUpdateTemplate = NULL;
PFN_vkCreateDevice glad_vkCreateDevice = NULL;
PFN_vkCreateEvent glad_vkCreateEvent = NULL;
PFN_vkCreateFence glad_vkCreateFence = NULL;
PFN_vkCreateFramebuffer glad_vkCreateFramebuffer = NULL;
PFN_vkCreateGraphicsPipelines glad_vkCreateGraphicsPipelines = NULL;
PFN_vkCreateImage glad_vkCreateImage = NULL;
PFN_vkCreateImageView glad_vkCreateImageView = NULL;
PFN_vkCreateInstance glad_vkCreateInstance = NULL;
PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
PFN_vkCreateSampler glad_vkCreateSampler = NULL;
PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
PFN_vkCreateShaderModule glad_vkCreateShaderModule = NULL;
PFN_vkCreateSwapchainKHR glad_vkCreateSwapchainKHR = NULL;
PFN_vkDebugReportMessageEXT glad_vkDebugReportMessageEXT = NULL;
PFN_vkDestroyBuffer glad_vkDestroyBuffer = NULL;
PFN_vkDestroyBufferView glad_vkDestroyBufferView = NULL;
PFN_vkDestroyCommandPool glad_vkDestroyCommandPool = NULL;
PFN_vkDestroyDebugReportCallbackEXT glad_vkDestroyDebugReportCallbackEXT = NULL;
PFN_vkDestroyDescriptorPool glad_vkDestroyDescriptorPool = NULL;
PFN_vkDestroyDescriptorSetLayout glad_vkDestroyDescriptorSetLayout = NULL;
PFN_vkDestroyDescriptorUpdateTemplate glad_vkDestroyDescriptorUpdateTemplate = NULL;
PFN_vkDestroyDevice glad_vkDestroyDevice = NULL;
PFN_vkDestroyEvent glad_vkDestroyEvent = NULL;
PFN_vkDestroyFence glad_vkDestroyFence = NULL;
PFN_vkDestroyFramebuffer glad_vkDestroyFramebuffer = NULL;
PFN_vkDestroyImage glad_vkDestroyImage = NULL;
PFN_vkDestroyImageView glad_vkDestroyImageView = NULL;
PFN_vkDestroyInstance glad_vkDestroyInstance = NULL;
PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
PFN_vkDestroySampler glad_vkDestroySampler = NULL;
PFN_vkDestroySamplerYcbcrConversion glad_vkDestroySamplerYcbcrConversion = NULL;
PFN_vkDestroySemaphore glad_vkDestroySemaphore = NULL;
PFN_vkDestroyShaderModule glad_vkDestroyShaderModule = NULL;
PFN_vkDestroySurfaceKHR glad_vkDestroySurfaceKHR = NULL;
PFN_vkDestroySwapchainKHR glad_vkDestroySwapchainKHR = NULL;
PFN_vkDeviceWaitIdle glad_vkDeviceWaitIdle = NULL;
PFN_vkEndCommandBuffer glad_vkEndCommandBuffer = NULL;
PFN_vkEnumerateDeviceExtensionProperties glad_vkEnumerateDeviceExtensionProperties = NULL;
PFN_vkEnumerateDeviceLayerProperties glad_vkEnumerateDeviceLayerProperties = NULL;
PFN_vkEnumerateInstanceExtensionProperties glad_vkEnumerateInstanceExtensionProperties = NULL;
PFN_vkEnumerateInstanceLayerProperties glad_vkEnumerateInstanceLayerProperties = NULL;
PFN_vkEnumerateInstanceVersion glad_vkEnumerateInstanceVersion = NULL;
PFN_vkEnumeratePhysicalDeviceGroups glad_vkEnumeratePhysicalDeviceGroups = NULL;
PFN_vkEnumeratePhysicalDevices glad_vkEnumeratePhysicalDevices = NULL;
PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL;
PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
PFN_vkFreeMemory glad_vkFreeMemory = NULL;
PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
PFN_vkGetEventStatus glad_vkGetEventStatus = NULL;
PFN_vkGetFenceStatus glad_vkGetFenceStatus = NULL;
PFN_vkGetImageMemoryRequirements glad_vkGetImageMemoryRequirements = NULL;
PFN_vkGetImageMemoryRequirements2 glad_vkGetImageMemoryRequirements2 = NULL;
PFN_vkGetImageSparseMemoryRequirements glad_vkGetImageSparseMemoryRequirements = NULL;
PFN_vkGetImageSparseMemoryRequirements2 glad_vkGetImageSparseMemoryRequirements2 = NULL;
PFN_vkGetImageSubresourceLayout glad_vkGetImageSubresourceLayout = NULL;
PFN_vkGetInstanceProcAddr glad_vkGetInstanceProcAddr = NULL;
PFN_vkGetPhysicalDeviceExternalBufferProperties glad_vkGetPhysicalDeviceExternalBufferProperties = NULL;
PFN_vkGetPhysicalDeviceExternalFenceProperties glad_vkGetPhysicalDeviceExternalFenceProperties = NULL;
PFN_vkGetPhysicalDeviceExternalSemaphoreProperties glad_vkGetPhysicalDeviceExternalSemaphoreProperties = NULL;
PFN_vkGetPhysicalDeviceFeatures glad_vkGetPhysicalDeviceFeatures = NULL;
PFN_vkGetPhysicalDeviceFeatures2 glad_vkGetPhysicalDeviceFeatures2 = NULL;
PFN_vkGetPhysicalDeviceFormatProperties glad_vkGetPhysicalDeviceFormatProperties = NULL;
PFN_vkGetPhysicalDeviceFormatProperties2 glad_vkGetPhysicalDeviceFormatProperties2 = NULL;
PFN_vkGetPhysicalDeviceImageFormatProperties glad_vkGetPhysicalDeviceImageFormatProperties = NULL;
PFN_vkGetPhysicalDeviceImageFormatProperties2 glad_vkGetPhysicalDeviceImageFormatProperties2 = NULL;
PFN_vkGetPhysicalDeviceMemoryProperties glad_vkGetPhysicalDeviceMemoryProperties = NULL;
PFN_vkGetPhysicalDeviceMemoryProperties2 glad_vkGetPhysicalDeviceMemoryProperties2 = NULL;
PFN_vkGetPhysicalDevicePresentRectanglesKHR glad_vkGetPhysicalDevicePresentRectanglesKHR = NULL;
PFN_vkGetPhysicalDeviceProperties glad_vkGetPhysicalDeviceProperties = NULL;
PFN_vkGetPhysicalDeviceProperties2 glad_vkGetPhysicalDeviceProperties2 = NULL;
PFN_vkGetPhysicalDeviceQueueFamilyProperties glad_vkGetPhysicalDeviceQueueFamilyProperties = NULL;
PFN_vkGetPhysicalDeviceQueueFamilyProperties2 glad_vkGetPhysicalDeviceQueueFamilyProperties2 = NULL;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties glad_vkGetPhysicalDeviceSparseImageFormatProperties = NULL;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = NULL;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = NULL;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
PFN_vkMapMemory glad_vkMapMemory = NULL;
PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL;
PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
PFN_vkResetEvent glad_vkResetEvent = NULL;
PFN_vkResetFences glad_vkResetFences = NULL;
PFN_vkSetEvent glad_vkSetEvent = NULL;
PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
PFN_vkWaitForFences glad_vkWaitForFences = NULL;
static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_VERSION_1_0) return;
vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load("vkAllocateCommandBuffers", userptr);
vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load("vkAllocateDescriptorSets", userptr);
vkAllocateMemory = (PFN_vkAllocateMemory) load("vkAllocateMemory", userptr);
vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load("vkBeginCommandBuffer", userptr);
vkBindBufferMemory = (PFN_vkBindBufferMemory) load("vkBindBufferMemory", userptr);
vkBindImageMemory = (PFN_vkBindImageMemory) load("vkBindImageMemory", userptr);
vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load("vkCmdBeginQuery", userptr);
vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load("vkCmdBeginRenderPass", userptr);
vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load("vkCmdBindDescriptorSets", userptr);
vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load("vkCmdBindIndexBuffer", userptr);
vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load("vkCmdBindPipeline", userptr);
vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load("vkCmdBindVertexBuffers", userptr);
vkCmdBlitImage = (PFN_vkCmdBlitImage) load("vkCmdBlitImage", userptr);
vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load("vkCmdClearAttachments", userptr);
vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load("vkCmdClearColorImage", userptr);
vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load("vkCmdClearDepthStencilImage", userptr);
vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load("vkCmdCopyBuffer", userptr);
vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load("vkCmdCopyBufferToImage", userptr);
vkCmdCopyImage = (PFN_vkCmdCopyImage) load("vkCmdCopyImage", userptr);
vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load("vkCmdCopyImageToBuffer", userptr);
vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load("vkCmdCopyQueryPoolResults", userptr);
vkCmdDispatch = (PFN_vkCmdDispatch) load("vkCmdDispatch", userptr);
vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load("vkCmdDispatchIndirect", userptr);
vkCmdDraw = (PFN_vkCmdDraw) load("vkCmdDraw", userptr);
vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load("vkCmdDrawIndexed", userptr);
vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load("vkCmdDrawIndexedIndirect", userptr);
vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load("vkCmdDrawIndirect", userptr);
vkCmdEndQuery = (PFN_vkCmdEndQuery) load("vkCmdEndQuery", userptr);
vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load("vkCmdEndRenderPass", userptr);
vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load("vkCmdExecuteCommands", userptr);
vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load("vkCmdFillBuffer", userptr);
vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load("vkCmdNextSubpass", userptr);
vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load("vkCmdPipelineBarrier", userptr);
vkCmdPushConstants = (PFN_vkCmdPushConstants) load("vkCmdPushConstants", userptr);
vkCmdResetEvent = (PFN_vkCmdResetEvent) load("vkCmdResetEvent", userptr);
vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load("vkCmdResetQueryPool", userptr);
vkCmdResolveImage = (PFN_vkCmdResolveImage) load("vkCmdResolveImage", userptr);
vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load("vkCmdSetBlendConstants", userptr);
vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load("vkCmdSetDepthBias", userptr);
vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load("vkCmdSetDepthBounds", userptr);
vkCmdSetEvent = (PFN_vkCmdSetEvent) load("vkCmdSetEvent", userptr);
vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load("vkCmdSetLineWidth", userptr);
vkCmdSetScissor = (PFN_vkCmdSetScissor) load("vkCmdSetScissor", userptr);
vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load("vkCmdSetStencilCompareMask", userptr);
vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load("vkCmdSetStencilReference", userptr);
vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load("vkCmdSetStencilWriteMask", userptr);
vkCmdSetViewport = (PFN_vkCmdSetViewport) load("vkCmdSetViewport", userptr);
vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load("vkCmdUpdateBuffer", userptr);
vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load("vkCmdWaitEvents", userptr);
vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load("vkCmdWriteTimestamp", userptr);
vkCreateBuffer = (PFN_vkCreateBuffer) load("vkCreateBuffer", userptr);
vkCreateBufferView = (PFN_vkCreateBufferView) load("vkCreateBufferView", userptr);
vkCreateCommandPool = (PFN_vkCreateCommandPool) load("vkCreateCommandPool", userptr);
vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load("vkCreateComputePipelines", userptr);
vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load("vkCreateDescriptorPool", userptr);
vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load("vkCreateDescriptorSetLayout", userptr);
vkCreateDevice = (PFN_vkCreateDevice) load("vkCreateDevice", userptr);
vkCreateEvent = (PFN_vkCreateEvent) load("vkCreateEvent", userptr);
vkCreateFence = (PFN_vkCreateFence) load("vkCreateFence", userptr);
vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load("vkCreateFramebuffer", userptr);
vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load("vkCreateGraphicsPipelines", userptr);
vkCreateImage = (PFN_vkCreateImage) load("vkCreateImage", userptr);
vkCreateImageView = (PFN_vkCreateImageView) load("vkCreateImageView", userptr);
vkCreateInstance = (PFN_vkCreateInstance) load("vkCreateInstance", userptr);
vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load("vkCreatePipelineCache", userptr);
vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load("vkCreatePipelineLayout", userptr);
vkCreateQueryPool = (PFN_vkCreateQueryPool) load("vkCreateQueryPool", userptr);
vkCreateRenderPass = (PFN_vkCreateRenderPass) load("vkCreateRenderPass", userptr);
vkCreateSampler = (PFN_vkCreateSampler) load("vkCreateSampler", userptr);
vkCreateSemaphore = (PFN_vkCreateSemaphore) load("vkCreateSemaphore", userptr);
vkCreateShaderModule = (PFN_vkCreateShaderModule) load("vkCreateShaderModule", userptr);
vkDestroyBuffer = (PFN_vkDestroyBuffer) load("vkDestroyBuffer", userptr);
vkDestroyBufferView = (PFN_vkDestroyBufferView) load("vkDestroyBufferView", userptr);
vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load("vkDestroyCommandPool", userptr);
vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load("vkDestroyDescriptorPool", userptr);
vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load("vkDestroyDescriptorSetLayout", userptr);
vkDestroyDevice = (PFN_vkDestroyDevice) load("vkDestroyDevice", userptr);
vkDestroyEvent = (PFN_vkDestroyEvent) load("vkDestroyEvent", userptr);
vkDestroyFence = (PFN_vkDestroyFence) load("vkDestroyFence", userptr);
vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load("vkDestroyFramebuffer", userptr);
vkDestroyImage = (PFN_vkDestroyImage) load("vkDestroyImage", userptr);
vkDestroyImageView = (PFN_vkDestroyImageView) load("vkDestroyImageView", userptr);
vkDestroyInstance = (PFN_vkDestroyInstance) load("vkDestroyInstance", userptr);
vkDestroyPipeline = (PFN_vkDestroyPipeline) load("vkDestroyPipeline", userptr);
vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load("vkDestroyPipelineCache", userptr);
vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load("vkDestroyPipelineLayout", userptr);
vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load("vkDestroyQueryPool", userptr);
vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load("vkDestroyRenderPass", userptr);
vkDestroySampler = (PFN_vkDestroySampler) load("vkDestroySampler", userptr);
vkDestroySemaphore = (PFN_vkDestroySemaphore) load("vkDestroySemaphore", userptr);
vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load("vkDestroyShaderModule", userptr);
vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load("vkDeviceWaitIdle", userptr);
vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load("vkEndCommandBuffer", userptr);
vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load("vkEnumerateDeviceExtensionProperties", userptr);
vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load("vkEnumerateDeviceLayerProperties", userptr);
vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load("vkEnumerateInstanceExtensionProperties", userptr);
vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load("vkEnumerateInstanceLayerProperties", userptr);
vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load("vkEnumeratePhysicalDevices", userptr);
vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load("vkFlushMappedMemoryRanges", userptr);
vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load("vkFreeCommandBuffers", userptr);
vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load("vkFreeDescriptorSets", userptr);
vkFreeMemory = (PFN_vkFreeMemory) load("vkFreeMemory", userptr);
vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load("vkGetBufferMemoryRequirements", userptr);
vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load("vkGetDeviceMemoryCommitment", userptr);
vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load("vkGetDeviceProcAddr", userptr);
vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load("vkGetDeviceQueue", userptr);
vkGetEventStatus = (PFN_vkGetEventStatus) load("vkGetEventStatus", userptr);
vkGetFenceStatus = (PFN_vkGetFenceStatus) load("vkGetFenceStatus", userptr);
vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load("vkGetImageMemoryRequirements", userptr);
vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load("vkGetImageSparseMemoryRequirements", userptr);
vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load("vkGetImageSubresourceLayout", userptr);
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load("vkGetInstanceProcAddr", userptr);
vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load("vkGetPhysicalDeviceFeatures", userptr);
vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load("vkGetPhysicalDeviceFormatProperties", userptr);
vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load("vkGetPhysicalDeviceImageFormatProperties", userptr);
vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load("vkGetPhysicalDeviceMemoryProperties", userptr);
vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load("vkGetPhysicalDeviceProperties", userptr);
vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load("vkGetPhysicalDeviceQueueFamilyProperties", userptr);
vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load("vkGetPhysicalDeviceSparseImageFormatProperties", userptr);
vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load("vkGetPipelineCacheData", userptr);
vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load("vkGetQueryPoolResults", userptr);
vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load("vkGetRenderAreaGranularity", userptr);
vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load("vkInvalidateMappedMemoryRanges", userptr);
vkMapMemory = (PFN_vkMapMemory) load("vkMapMemory", userptr);
vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load("vkMergePipelineCaches", userptr);
vkQueueBindSparse = (PFN_vkQueueBindSparse) load("vkQueueBindSparse", userptr);
vkQueueSubmit = (PFN_vkQueueSubmit) load("vkQueueSubmit", userptr);
vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load("vkQueueWaitIdle", userptr);
vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load("vkResetCommandBuffer", userptr);
vkResetCommandPool = (PFN_vkResetCommandPool) load("vkResetCommandPool", userptr);
vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load("vkResetDescriptorPool", userptr);
vkResetEvent = (PFN_vkResetEvent) load("vkResetEvent", userptr);
vkResetFences = (PFN_vkResetFences) load("vkResetFences", userptr);
vkSetEvent = (PFN_vkSetEvent) load("vkSetEvent", userptr);
vkUnmapMemory = (PFN_vkUnmapMemory) load("vkUnmapMemory", userptr);
vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load("vkUpdateDescriptorSets", userptr);
vkWaitForFences = (PFN_vkWaitForFences) load("vkWaitForFences", userptr);
}
static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_VERSION_1_1) return;
vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load("vkBindBufferMemory2", userptr);
vkBindImageMemory2 = (PFN_vkBindImageMemory2) load("vkBindImageMemory2", userptr);
vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load("vkCmdDispatchBase", userptr);
vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load("vkCmdSetDeviceMask", userptr);
vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load("vkCreateDescriptorUpdateTemplate", userptr);
vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load("vkCreateSamplerYcbcrConversion", userptr);
vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load("vkDestroyDescriptorUpdateTemplate", userptr);
vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load("vkDestroySamplerYcbcrConversion", userptr);
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr);
vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load("vkEnumeratePhysicalDeviceGroups", userptr);
vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load("vkGetBufferMemoryRequirements2", userptr);
vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load("vkGetDescriptorSetLayoutSupport", userptr);
vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load("vkGetDeviceGroupPeerMemoryFeatures", userptr);
vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load("vkGetDeviceQueue2", userptr);
vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load("vkGetImageMemoryRequirements2", userptr);
vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load("vkGetImageSparseMemoryRequirements2", userptr);
vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load("vkGetPhysicalDeviceExternalBufferProperties", userptr);
vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load("vkGetPhysicalDeviceExternalFenceProperties", userptr);
vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load("vkGetPhysicalDeviceExternalSemaphoreProperties", userptr);
vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load("vkGetPhysicalDeviceFeatures2", userptr);
vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load("vkGetPhysicalDeviceFormatProperties2", userptr);
vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load("vkGetPhysicalDeviceImageFormatProperties2", userptr);
vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load("vkGetPhysicalDeviceMemoryProperties2", userptr);
vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load("vkGetPhysicalDeviceProperties2", userptr);
vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load("vkGetPhysicalDeviceQueueFamilyProperties2", userptr);
vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load("vkGetPhysicalDeviceSparseImageFormatProperties2", userptr);
vkTrimCommandPool = (PFN_vkTrimCommandPool) load("vkTrimCommandPool", userptr);
vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load("vkUpdateDescriptorSetWithTemplate", userptr);
}
static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_EXT_debug_report) return;
vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load("vkCreateDebugReportCallbackEXT", userptr);
vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load("vkDebugReportMessageEXT", userptr);
vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load("vkDestroyDebugReportCallbackEXT", userptr);
}
static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_KHR_surface) return;
vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load("vkDestroySurfaceKHR", userptr);
vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", userptr);
vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load("vkGetPhysicalDeviceSurfaceFormatsKHR", userptr);
vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load("vkGetPhysicalDeviceSurfacePresentModesKHR", userptr);
vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load("vkGetPhysicalDeviceSurfaceSupportKHR", userptr);
}
static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_KHR_swapchain) return;
vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load("vkAcquireNextImage2KHR", userptr);
vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load("vkAcquireNextImageKHR", userptr);
vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load("vkCreateSwapchainKHR", userptr);
vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load("vkDestroySwapchainKHR", userptr);
vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load("vkGetDeviceGroupPresentCapabilitiesKHR", userptr);
vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load("vkGetDeviceGroupSurfacePresentModesKHR", userptr);
vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load("vkGetPhysicalDevicePresentRectanglesKHR", userptr);
vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load("vkGetSwapchainImagesKHR", userptr);
vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load("vkQueuePresentKHR", userptr);
}
static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *out_extension_count, char ***out_extensions) {
uint32_t i;
uint32_t instance_extension_count = 0;
uint32_t device_extension_count = 0;
uint32_t max_extension_count;
uint32_t total_extension_count;
char **extensions;
VkExtensionProperties *ext_properties;
VkResult result;
if (vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && vkEnumerateDeviceExtensionProperties == NULL)) {
return 0;
}
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
if (result != VK_SUCCESS) {
return 0;
}
if (physical_device != NULL) {
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
if (result != VK_SUCCESS) {
return 0;
}
}
total_extension_count = instance_extension_count + device_extension_count;
max_extension_count = instance_extension_count > device_extension_count
? instance_extension_count : device_extension_count;
ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
if (ext_properties == NULL) {
return 0;
}
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
if (result != VK_SUCCESS) {
free((void*) ext_properties);
return 0;
}
extensions = (char**) calloc(total_extension_count, sizeof(char*));
if (extensions == NULL) {
free((void*) ext_properties);
return 0;
}
for (i = 0; i < instance_extension_count; ++i) {
VkExtensionProperties ext = ext_properties[i];
size_t extension_name_length = strlen(ext.extensionName) + 1;
extensions[i] = (char*) malloc(extension_name_length * sizeof(char));
memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char));
}
if (physical_device != NULL) {
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
if (result != VK_SUCCESS) {
for (i = 0; i < instance_extension_count; ++i) {
free((void*) extensions[i]);
}
free(extensions);
return 0;
}
for (i = 0; i < device_extension_count; ++i) {
VkExtensionProperties ext = ext_properties[i];
size_t extension_name_length = strlen(ext.extensionName) + 1;
extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char));
memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char));
}
}
free((void*) ext_properties);
*out_extension_count = total_extension_count;
*out_extensions = extensions;
return 1;
}
static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) {
uint32_t i;
for(i = 0; i < extension_count ; ++i) {
free((void*) (extensions[i]));
}
free((void*) extensions);
}
static int glad_vk_has_extension(const char *name, uint32_t extension_count, char **extensions) {
uint32_t i;
for (i = 0; i < extension_count; ++i) {
if(strcmp(name, extensions[i]) == 0) {
return 1;
}
}
return 0;
}
static GLADapiproc glad_vk_get_proc_from_userptr(const char* name, void *userptr) {
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
}
static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
uint32_t extension_count = 0;
char **extensions = NULL;
if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0;
GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions);
GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions);
GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions);
glad_vk_free_extensions(extension_count, extensions);
return 1;
}
static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
int major = 1;
int minor = 0;
#ifdef VK_VERSION_1_1
if (vkEnumerateInstanceVersion != NULL) {
uint32_t version;
VkResult result;
result = vkEnumerateInstanceVersion(&version);
if (result == VK_SUCCESS) {
major = (int) VK_VERSION_MAJOR(version);
minor = (int) VK_VERSION_MINOR(version);
}
}
#endif
if (physical_device != NULL && vkGetPhysicalDeviceProperties != NULL) {
VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(physical_device, &properties);
major = (int) VK_VERSION_MAJOR(properties.apiVersion);
minor = (int) VK_VERSION_MINOR(properties.apiVersion);
}
GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
return GLAD_MAKE_VERSION(major, minor);
}
int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr) {
int version;
#ifdef VK_VERSION_1_1
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr);
#endif
version = glad_vk_find_core_vulkan( physical_device);
if (!version) {
return 0;
}
glad_vk_load_VK_VERSION_1_0(load, userptr);
glad_vk_load_VK_VERSION_1_1(load, userptr);
if (!glad_vk_find_extensions_vulkan( physical_device)) return 0;
glad_vk_load_VK_EXT_debug_report(load, userptr);
glad_vk_load_VK_KHR_surface(load, userptr);
glad_vk_load_VK_KHR_swapchain(load, userptr);
return version;
}
int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) {
return gladLoadVulkanUserPtr( physical_device, glad_vk_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
}

2
deps/nuklear.h vendored
View File

@ -13644,7 +13644,7 @@ nk_font_atlas_bake(struct nk_font_atlas *atlas, int *width, int *height,
#ifdef NK_INCLUDE_DEFAULT_FONT #ifdef NK_INCLUDE_DEFAULT_FONT
/* no font added so just use default font */ /* no font added so just use default font */
if (!atlas->font_num) if (!atlas->font_num)
atlas->default_font = nk_font_atlas_add_default(atlas, 20.0f, 0); atlas->default_font = nk_font_atlas_add_default(atlas, 13.0f, 0);
#endif #endif
NK_ASSERT(atlas->font_num); NK_ASSERT(atlas->font_num);
if (!atlas->font_num) return 0; if (!atlas->font_num) return 0;

73
deps/vulkan/vulkan.h vendored
View File

@ -1,73 +0,0 @@
#ifndef VULKAN_H_
#define VULKAN_H_ 1
/*
** Copyright (c) 2015-2018 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#include "vk_platform.h"
#include "vulkan_core.h"
#ifdef VK_USE_PLATFORM_ANDROID_KHR
#include "vulkan_android.h"
#endif
#ifdef VK_USE_PLATFORM_IOS_MVK
#include "vulkan_ios.h"
#endif
#ifdef VK_USE_PLATFORM_MACOS_MVK
#include "vulkan_macos.h"
#endif
#ifdef VK_USE_PLATFORM_VI_NN
#include "vulkan_vi.h"
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <wayland-client.h>
#include "vulkan_wayland.h"
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
#include <windows.h>
#include "vulkan_win32.h"
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
#include <xcb/xcb.h>
#include "vulkan_xcb.h"
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
#include <X11/Xlib.h>
#include "vulkan_xlib.h"
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#include "vulkan_xlib_xrandr.h"
#endif
#endif // VULKAN_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,27 @@
set(glfw_DOCS_SOURCES # NOTE: The order of this list determines the order of items in the Guides
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h" # (i.e. Pages) list in the generated documentation
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h" set(GLFW_DOXYGEN_SOURCES
"${GLFW_SOURCE_DIR}/docs/main.dox" "include/GLFW/glfw3.h"
"${GLFW_SOURCE_DIR}/docs/news.dox" "include/GLFW/glfw3native.h"
"${GLFW_SOURCE_DIR}/docs/moving.dox" "docs/main.dox"
"${GLFW_SOURCE_DIR}/docs/quick.dox" "docs/news.dox"
"${GLFW_SOURCE_DIR}/docs/compile.dox" "docs/quick.dox"
"${GLFW_SOURCE_DIR}/docs/build.dox" "docs/moving.dox"
"${GLFW_SOURCE_DIR}/docs/intro.dox" "docs/compile.dox"
"${GLFW_SOURCE_DIR}/docs/context.dox" "docs/build.dox"
"${GLFW_SOURCE_DIR}/docs/monitor.dox" "docs/intro.dox"
"${GLFW_SOURCE_DIR}/docs/window.dox" "docs/context.dox"
"${GLFW_SOURCE_DIR}/docs/input.dox" "docs/monitor.dox"
"${GLFW_SOURCE_DIR}/docs/vulkan.dox" "docs/window.dox"
"${GLFW_SOURCE_DIR}/docs/compat.dox" "docs/input.dox"
"${GLFW_SOURCE_DIR}/docs/internal.dox") "docs/vulkan.dox"
"docs/compat.dox"
"docs/internal.dox")
foreach(arg ${glfw_DOCS_SOURCES}) # Format the source list into a Doxyfile INPUT value that Doxygen can parse
set(GLFW_DOCS_SOURCES "${GLFW_DOCS_SOURCES} \\\n\"${arg}\"") foreach(path IN LISTS GLFW_DOXYGEN_SOURCES)
set(GLFW_DOXYGEN_INPUT "${GLFW_DOXYGEN_INPUT} \\\n\"${GLFW_SOURCE_DIR}/${path}\"")
endforeach() endforeach()
configure_file(Doxyfile.in Doxyfile @ONLY) configure_file(Doxyfile.in Doxyfile @ONLY)

View File

@ -32,7 +32,7 @@ PROJECT_NAME = "GLFW"
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = @GLFW_VERSION_FULL@ PROJECT_NUMBER = @GLFW_VERSION@
# Using the PROJECT_BRIEF tag one can provide an optional one line description # 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 # for a project that appears at the top of each page and should give viewer
@ -195,12 +195,13 @@ TAB_SIZE = 8
# will result in a user-defined paragraph with heading "Side Effects:". # 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. # You can put \n's in the value part of an alias to insert newlines.
ALIASES = "thread_safety=@par Thread safety\n" \ ALIASES = "thread_safety=@par Thread safety^^" \
"pointer_lifetime=@par Pointer lifetime\n" \ "pointer_lifetime=@par Pointer lifetime^^" \
"analysis=@par Analysis\n" \ "analysis=@par Analysis^^" \
"reentrancy=@par Reentrancy\n" \ "reentrancy=@par Reentrancy^^" \
"errors=@par Errors\n" \ "errors=@par Errors^^" \
"glfw3=@par\n__GLFW 3:__" \ "callback_signature=@par Callback signature^^" \
"glfw3=__GLFW 3:__" \
"x11=__X11:__" \ "x11=__X11:__" \
"wayland=__Wayland:__" \ "wayland=__Wayland:__" \
"win32=__Windows:__" \ "win32=__Windows:__" \
@ -589,7 +590,7 @@ FILE_VERSION_FILTER =
# You can optionally specify a file name after the option, if omitted # You can optionally specify a file name after the option, if omitted
# DoxygenLayout.xml will be used as the name of the layout file. # DoxygenLayout.xml will be used as the name of the layout file.
LAYOUT_FILE = LAYOUT_FILE = "@GLFW_SOURCE_DIR@/docs/DoxygenLayout.xml"
# The CITE_BIB_FILES tag can be used to specify one or more bib files # 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 # containing the references data. This must be a list of .bib files. The
@ -662,7 +663,7 @@ WARN_LOGFILE = "@GLFW_BINARY_DIR@/docs/warnings.txt"
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = @GLFW_DOCS_SOURCES@ INPUT = @GLFW_DOXYGEN_INPUT@
# This tag can be used to specify the character encoding of the source files # 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 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

View File

@ -1,115 +1,21 @@
<doxygenlayout version="1.0"> <doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.3.1 --> <!-- Generated by doxygen 1.8.14 -->
<!-- Navigation index tabs for HTML output --> <!-- Navigation index tabs for HTML output -->
<navindex> <navindex>
<tab type="mainpage" visible="yes" title="Introduction"/> <tab type="mainpage" visible="yes" title="Introduction"/>
<tab type="user" url="quick_guide.html" title="Tutorial"/>
<tab type="pages" visible="yes" title="Guides" intro=""/> <tab type="pages" visible="yes" title="Guides" intro=""/>
<tab type="modules" visible="yes" title="Reference" intro=""/> <tab type="modules" visible="yes" title="Reference" intro=""/>
<tab type="namespaces" visible="yes" title=""> <tab type="filelist" visible="yes" title="Files"/>
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="no" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="Header Files">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex> </navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page --> <!-- Layout definition for a file page -->
<file> <file>
<briefdescription visible="yes"/> <detaileddescription title="Description"/>
<includes visible="$SHOW_INCLUDE_FILES"/> <includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/> <sourcelink visible="yes"/>
<memberdecl> <memberdecl>
<classes visible="yes" title=""/> <constantgroups visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<defines title=""/> <defines title=""/>
<typedefs title=""/> <typedefs title=""/>
<enums title=""/> <enums title=""/>
@ -117,9 +23,7 @@
<variables title=""/> <variables title=""/>
<membergroups visible="yes"/> <membergroups visible="yes"/>
</memberdecl> </memberdecl>
<detaileddescription title=""/>
<memberdef> <memberdef>
<inlineclasses title=""/>
<defines title=""/> <defines title=""/>
<typedefs title=""/> <typedefs title=""/>
<enums title=""/> <enums title=""/>
@ -131,46 +35,26 @@
<!-- Layout definition for a group page --> <!-- Layout definition for a group page -->
<group> <group>
<briefdescription visible="yes"/>
<detaileddescription title="Description"/> <detaileddescription title="Description"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl> <memberdecl>
<nestedgroups visible="yes" title=""/> <nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/> <dirs visible="yes" title=""/>
<files visible="yes" title=""/> <files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/> <defines title=""/>
<typedefs title=""/> <typedefs title=""/>
<enums title=""/> <enums title=""/>
<enumvalues title=""/> <enumvalues title=""/>
<functions title=""/> <functions title=""/>
<variables title=""/> <variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl> </memberdecl>
<memberdef> <memberdef>
<pagedocs/> <pagedocs/>
<inlineclasses title=""/>
<defines title=""/> <defines title=""/>
<typedefs title=""/> <typedefs title=""/>
<enums title=""/> <enums title=""/>
<enumvalues title=""/> <enumvalues title=""/>
<functions title=""/> <functions title=""/>
<variables title=""/> <variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef> </memberdef>
<authorsection visible="yes"/> <authorsection visible="yes"/>
</group> </group>
@ -178,7 +62,6 @@
<!-- Layout definition for a directory page --> <!-- Layout definition for a directory page -->
<directory> <directory>
<briefdescription visible="yes"/> <briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl> <memberdecl>
<dirs visible="yes"/> <dirs visible="yes"/>
<files visible="yes"/> <files visible="yes"/>

View File

@ -52,7 +52,7 @@ If you are using an OpenGL extension loading library such as
be included _before_ the GLFW one. be included _before_ the GLFW one.
@code @code
#include <glad/glad.h> #include <glad/gl.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@endcode @endcode
@ -62,7 +62,7 @@ prevent the GLFW header from including the OpenGL header.
@code @code
#define GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <glad/glad.h> #include <glad/gl.h>
@endcode @endcode
@ -186,18 +186,8 @@ build_link_cmake_package.
With a few changes to your `CMakeLists.txt` you can have the GLFW source tree With a few changes to your `CMakeLists.txt` you can have the GLFW source tree
built along with your application. built along with your application.
When including GLFW as part of your build, you probably don't want to build the Add the root directory of the GLFW source tree to your project. This will add
GLFW tests, examples and documentation. To disable these, set the corresponding the `glfw` target and the necessary cache variables to your project.
cache variables before adding the GLFW source tree.
@code
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
@endcode
Then 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.
@code{.cmake} @code{.cmake}
add_subdirectory(path/to/glfw) add_subdirectory(path/to/glfw)
@ -253,7 +243,7 @@ With a few changes to your `CMakeLists.txt` you can locate the package and
target files generated when GLFW is installed. target files generated when GLFW is installed.
@code{.cmake} @code{.cmake}
find_package(glfw3 3.3 REQUIRED) find_package(glfw3 3.4 REQUIRED)
@endcode @endcode
Once GLFW has been added to the project, link against it with the `glfw` target. Once GLFW has been added to the project, link against it with the `glfw` target.

View File

@ -104,11 +104,7 @@ has been configured in the compositor.
GLFW uses the [xdg-shell GLFW uses the [xdg-shell
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml) protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
to provide better window management. This protocol is part of to provide better window management. This protocol is part of
wayland-protocols 1.12, and mandatory at build time. If the running compositor wayland-protocols 1.12, and mandatory at build time.
does not support this protocol, the older [wl_shell
interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972)
will be used instead. This will result in a worse integration with the
desktop, especially on tiling compositors.
GLFW uses the [relative pointer GLFW uses the [relative pointer
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml) protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
@ -126,13 +122,18 @@ wayland-protocols 1.6, and mandatory at build time. If the running compositor
does not support this protocol, the screensaver may start even for full screen does not support this protocol, the screensaver may start even for full screen
windows. windows.
GLFW uses the [viewporter GLFW uses the [xdg-decoration
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
to request decorations to be drawn around its windows. This protocol is part
of wayland-protocols 1.15, and mandatory at build time. If the running
compositor does not support this protocol, a very simple frame will be drawn by
GLFW itself, using the [viewporter
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml) protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml)
alongside alongside
[subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598) [subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598).
to draw decorations around windows. This protocol is part of wayland-protocols This protocol is part of wayland-protocols 1.4, and mandatory at build time.
1.4, and mandatory at build time. If the running compositor does not support If the running compositor does not support this protocol either, no decorations
this protocol, no decorations will be drawn around windows. will be drawn around windows.
@section compat_glx GLX extensions @section compat_glx GLX extensions

View File

@ -210,18 +210,15 @@ cmake -DBUILD_SHARED_LIBS=ON .
__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static __BUILD_SHARED_LIBS__ determines whether GLFW is built as a static
library or as a DLL / shared library / dynamic library. library or as a DLL / shared library / dynamic library.
@anchor LIB_SUFFIX
__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`.
@anchor GLFW_BUILD_EXAMPLES @anchor GLFW_BUILD_EXAMPLES
__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built __GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
along with the library. along with the library. This is enabled by default unless GLFW is being built
as a sub-project.
@anchor GLFW_BUILD_TESTS @anchor GLFW_BUILD_TESTS
__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are __GLFW_BUILD_TESTS__ determines whether the GLFW test programs are
built along with the library. built along with the library. This is enabled by default unless GLFW is being
built as a sub-project.
@anchor GLFW_BUILD_DOCS @anchor GLFW_BUILD_DOCS
__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along __GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
@ -229,7 +226,7 @@ with the library.
@anchor GLFW_VULKAN_STATIC @anchor GLFW_VULKAN_STATIC
__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked __GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
statically into the application. directly with the application.
@subsubsection compile_options_win32 Windows specific CMake options @subsubsection compile_options_win32 Windows specific CMake options
@ -273,7 +270,7 @@ ramps and clipboard. The options are:
If you are building GLFW as a shared library / dynamic library / DLL then you If you are building GLFW as a shared library / dynamic library / DLL then you
must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it. must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it.
If you are linking the Vulkan loader statically into your application then you If you are linking the Vulkan loader directly with your application then you
must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the
external version. external version.

File diff suppressed because one or more lines are too long

View File

@ -127,7 +127,7 @@ div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.a
display:none; display:none;
} }
html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code { html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven {
background:@header-footer-background-color; background:@header-footer-background-color;
} }

View File

@ -57,8 +57,7 @@ glfwWaitEvents();
It puts the thread to sleep until at least one event has been received and then It puts the thread to sleep until at least one event has been received and then
processes all received events. This saves a great deal of CPU cycles and is processes all received events. This saves a great deal of CPU cycles and is
useful for, for example, editing tools. There must be at least one GLFW window useful for, for example, editing tools.
for this function to sleep.
If you want to wait for events but have UI elements or other tasks that need If you want to wait for events but have UI elements or other tasks that need
periodic updates, @ref glfwWaitEventsTimeout lets you specify a timeout. periodic updates, @ref glfwWaitEventsTimeout lets you specify a timeout.
@ -234,7 +233,7 @@ arguments can always be passed unmodified to this function.
@section input_mouse Mouse input @section input_mouse Mouse input
Mouse input comes in many forms, including cursor motion, button presses and Mouse input comes in many forms, including mouse motion, button presses and
scrolling offsets. The cursor appearance can also be changed, either to scrolling offsets. The cursor appearance can also be changed, either to
a custom image or a standard cursor shape from the system theme. a custom image or a standard cursor shape from the system theme.
@ -249,7 +248,7 @@ glfwSetCursorPosCallback(window, cursor_position_callback);
@endcode @endcode
The callback functions receives the cursor position, measured in screen The callback functions receives the cursor position, measured in screen
coordinates but relative to the top-left corner of the window client area. On coordinates but relative to the top-left corner of the window content area. On
platforms that provide it, the full sub-pixel cursor position is passed on. platforms that provide it, the full sub-pixel cursor position is passed on.
@code @code
@ -309,6 +308,31 @@ glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
@endcode @endcode
@anchor GLFW_RAW_MOUSE_MOTION
@subsection raw_mouse_motion Raw mouse motion
When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can
be enabled if available.
Raw mouse motion is closer to the actual motion of the mouse across a surface.
It is not affected by the scaling and acceleration applied to the motion of the
desktop cursor. That processing is suitable for a cursor while raw motion is
better for controlling for example a 3D camera. Because of this, raw mouse
motion is only provided when the cursor is disabled.
Call @ref glfwRawMouseMotionSupported to check if the current machine provides
raw motion and set the `GLFW_RAW_MOUSE_MOTION` input mode to enable it. It is
disabled by default.
@code
if (glfwRawMouseMotionSupported())
glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
@endcode
If supported, raw mouse motion can be enabled or disabled per-window and at any
time but it will only be provided when the cursor is disabled.
@subsection cursor_object Cursor objects @subsection cursor_object Cursor objects
GLFW supports creating both custom and system theme cursor images, encapsulated GLFW supports creating both custom and system theme cursor images, encapsulated
@ -378,7 +402,7 @@ glfwSetCursor(window, cursor);
@endcode @endcode
Once set, the cursor image will be used as long as the system cursor is over the Once set, the cursor image will be used as long as the system cursor is over the
client area of the window and the [cursor mode](@ref cursor_mode) is set content area of the window and the [cursor mode](@ref cursor_mode) is set
to `GLFW_CURSOR_NORMAL`. to `GLFW_CURSOR_NORMAL`.
A single cursor may be set for any number of windows. A single cursor may be set for any number of windows.
@ -395,7 +419,7 @@ default cursor. This does not affect the cursor mode.
@subsection cursor_enter Cursor enter/leave events @subsection cursor_enter Cursor enter/leave events
If you wish to be notified when the cursor enters or leaves the client area of If you wish to be notified when the cursor enters or leaves the content area of
a window, set a cursor enter/leave callback. a window, set a cursor enter/leave callback.
@code @code
@ -409,16 +433,16 @@ void cursor_enter_callback(GLFWwindow* window, int entered)
{ {
if (entered) if (entered)
{ {
// The cursor entered the client area of the window // The cursor entered the content area of the window
} }
else else
{ {
// The cursor left the client area of the window // The cursor left the content area of the window
} }
} }
@endcode @endcode
You can query whether the cursor is currently inside the client area of the You can query whether the cursor is currently inside the content area of the
window with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. window with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute.
@code @code
@ -583,7 +607,7 @@ const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count);
Each element in the returned array is one of the following: Each element in the returned array is one of the following:
Name | Value Name | Value
--------------------- | -------------------------------- ---- | -----
`GLFW_HAT_CENTERED` | 0 `GLFW_HAT_CENTERED` | 0
`GLFW_HAT_UP` | 1 `GLFW_HAT_UP` | 1
`GLFW_HAT_RIGHT` | 2 `GLFW_HAT_RIGHT` | 2
@ -762,7 +786,7 @@ time of release. Newer ones can be added at runtime with @ref
glfwUpdateGamepadMappings. glfwUpdateGamepadMappings.
@code @code
const char* mappings = load_file_contents("gamecontrollerdb.txt"); const char* mappings = load_file_contents("game/data/gamecontrollerdb.txt");
glfwUpdateGamepadMappings(mappings); glfwUpdateGamepadMappings(mappings);
@endcode @endcode
@ -840,28 +864,29 @@ GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
double seconds = glfwGetTime(); double seconds = glfwGetTime();
@endcode @endcode
It returns the number of seconds since the timer was started when the library It returns the number of seconds since the library was initialized with @ref
was initialized with @ref glfwInit. The platform-specific time sources used glfwInit. The platform-specific time sources used typically have micro- or
usually have micro- or nanosecond resolution. nanosecond resolution.
You can modify the reference time with @ref glfwSetTime. You can modify the base time with @ref glfwSetTime.
@code @code
glfwSetTime(4.0); glfwSetTime(4.0);
@endcode @endcode
This sets the timer to the specified time, in seconds. This sets the time to the specified time, in seconds, and it continues to count
from there.
You can also access the raw timer value, measured in 1&nbsp;/&nbsp;frequency You can also access the raw timer used to implement the functions above,
seconds, with @ref glfwGetTimerValue. with @ref glfwGetTimerValue.
@code @code
uint64_t value = glfwGetTimerValue(); uint64_t value = glfwGetTimerValue();
@endcode @endcode
The frequency of the raw timer varies depending on what time sources are This value is in 1&nbsp;/&nbsp;frequency seconds. The frequency of the raw
available on the machine. You can query its frequency, in Hz, with @ref timer varies depending on the operating system and hardware. You can query the
glfwGetTimerFrequency. frequency, in Hz, with @ref glfwGetTimerFrequency.
@code @code
uint64_t freqency = glfwGetTimerFrequency(); uint64_t freqency = glfwGetTimerFrequency();

View File

@ -91,12 +91,12 @@ glfwGetJoystickHats. Set this with @ref glfwInitHint.
@subsubsection init_hints_osx macOS specific init hints @subsubsection init_hints_osx macOS specific init hints
@anchor GLFW_COCOA_CHDIR_RESOURCES @anchor GLFW_COCOA_CHDIR_RESOURCES_hint
__GLFW_COCOA_CHDIR_RESOURCES__ specifies whether to set the current directory to __GLFW_COCOA_CHDIR_RESOURCES__ specifies whether to set the current directory to
the application to the `Contents/Resources` subdirectory of the application's the application to the `Contents/Resources` subdirectory of the application's
bundle, if present. Set this with @ref glfwInitHint. bundle, if present. Set this with @ref glfwInitHint.
@anchor GLFW_COCOA_MENUBAR @anchor GLFW_COCOA_MENUBAR_hint
__GLFW_COCOA_MENUBAR__ specifies whether to create a basic menu bar, either from __GLFW_COCOA_MENUBAR__ specifies whether to create a basic menu bar, either from
a nib or manually, when the first window is created, which is when AppKit is a nib or manually, when the first window is created, which is when AppKit is
initialized. Set this with @ref glfwInitHint. initialized. Set this with @ref glfwInitHint.
@ -208,24 +208,24 @@ future that same call may generate a different error or become valid.
@section coordinate_systems Coordinate systems @section coordinate_systems Coordinate systems
GLFW has two primary coordinate systems: the _virtual screen_ and the window GLFW has two primary coordinate systems: the _virtual screen_ and the window
_client area_ or _content area_. Both use the same unit: _virtual screen _content area_ or _content area_. Both use the same unit: _virtual screen
coordinates_, or just _screen coordinates_, which don't necessarily correspond coordinates_, or just _screen coordinates_, which don't necessarily correspond
to pixels. to pixels.
<img src="spaces.svg" width="90%" /> <img src="spaces.svg" width="90%" />
Both the virtual screen and the client area coordinate systems have the X-axis Both the virtual screen and the content area coordinate systems have the X-axis
pointing to the right and the Y-axis pointing down. pointing to the right and the Y-axis pointing down.
Window and monitor positions are specified as the position of the upper-left Window and monitor positions are specified as the position of the upper-left
corners of their content areas relative to the virtual screen, while cursor corners of their content areas relative to the virtual screen, while cursor
positions are specified relative to a window's client area. positions are specified relative to a window's content area.
Because the origin of the window's client area coordinate system is also the Because the origin of the window's content area coordinate system is also the
point from which the window position is specified, you can translate client area point from which the window position is specified, you can translate content
coordinates to the virtual screen by adding the window position. The window area coordinates to the virtual screen by adding the window position. The
frame, when present, extends out from the client area but does not affect the window frame, when present, extends out from the content area but does not
window position. affect the window position.
Almost all positions and sizes in GLFW are measured in screen coordinates Almost all positions and sizes in GLFW are measured in screen coordinates
relative to one of the two origins above. This includes cursor positions, relative to one of the two origins above. This includes cursor positions,

View File

@ -8,8 +8,7 @@ GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and
Vulkan application development. It provides a simple, platform-independent API Vulkan application development. It provides a simple, platform-independent API
for creating windows, contexts and surfaces, reading input, handling events, etc. for creating windows, contexts and surfaces, reading input, handling events, etc.
See @ref news_33 for highlights or the @ref news_34 list new features, caveats and deprecations.
[version history](https://www.glfw.org/changelog.html) for details.
@ref quick_guide is a guide for users new to GLFW. It takes you through how to @ref quick_guide is a guide for users new to GLFW. It takes you through how to
write a small but complete program. write a small but complete program.

View File

@ -94,8 +94,8 @@ for a disconnected monitor and only before the monitor callback returns.
@section monitor_properties Monitor properties @section monitor_properties Monitor properties
Each monitor has a current video mode, a list of supported video modes, Each monitor has a current video mode, a list of supported video modes,
a virtual position, a human-readable name, a user pointer, an estimated physical a virtual position, a content scale, a human-readable name, a user pointer, an
size and a gamma ramp. estimated physical size and a gamma ramp.
@subsection monitor_modes Video modes @subsection monitor_modes Video modes
@ -153,9 +153,11 @@ glfwGetMonitorContentScale(monitor, &xscale, &yscale);
@endcode @endcode
The content scale is the ratio between the current DPI and the platform's The content scale is the ratio between the current DPI and the platform's
default DPI. If you scale all pixel dimensions by this scale then your content default DPI. This is especially important for text and any UI elements. If the
should appear at an appropriate size. This is especially important for text and pixel dimensions of your UI scaled by this look appropriate on your machine then
any UI elements. it should appear at a reasonable size on other machines regardless of their DPI
and scaling settings. This relies on the system DPI and scaling settings being
somewhat correct.
The content scale may depend on both the monitor resolution and pixel density The content scale may depend on both the monitor resolution and pixel density
and on user settings. It may be very different from the raw DPI calculated from and on user settings. It may be very different from the raw DPI calculated from
@ -174,6 +176,18 @@ glfwGetMonitorPos(monitor, &xpos, &ypos);
@endcode @endcode
@subsection monitor_workarea Work area
The area of a monitor not occupied by global task bars or menu bars is the work
area. This is specified in [screen coordinates](@ref coordinate_systems) and
can be retrieved with @ref glfwGetMonitorWorkarea.
@code
int xpos, ypos, width, height;
glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height);
@endcode
@subsection monitor_name Human-readable name @subsection monitor_name Human-readable name
The human-readable, UTF-8 encoded name of a monitor is returned by @ref The human-readable, UTF-8 encoded name of a monitor is returned by @ref

View File

@ -2,72 +2,76 @@
@page news Release notes @page news Release notes
@section news_33 Release notes for 3.3 @tableofcontents
@subsection news_33_focusonshow GLFW_FOCUS_ON_SHOW window hint and attribute
GLFW now supports the [GLFW_FOCUS_ON_SHOW](@ref GLFW_DECORATED_hint) window hint
and attribute for controlling input focus when calling @ref glfwShowWindow
@see @ref window_hide
@subsection news_33_geterror Error query
GLFW now supports querying the last error code for the calling thread and its
human-readable description with @ref glfwGetError.
@see @ref error_handling
@subsection news_33_gamepad SDL_GameControllerDB support and gamepad input @section news_34 Release notes for version 3.4
GLFW now supports remapping of gamepads and controllers to a 360-like controller @subsection features_34 New features in version 3.4
layout with @ref glfwJoystickIsGamepad, @ref glfwGetJoystickGUID, @ref
glfwGetGamepadName, @ref glfwGetGamepadState and @ref glfwUpdateGamepadMappings,
and the input state struct @ref GLFWgamepadstate.
@sa @ref gamepad @subsection caveats_34 Caveats for version 3.4
@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project
GLFW now does not build the tests and examples when it is added as
a subdirectory of another CMake project. To enable these, set the @ref
GLFW_BUILD_TESTS and @ref GLFW_BUILD_EXAMPLES cache variables before adding the
GLFW subdirectory.
@code{.cmake}
set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
add_subdirectory(path/to/glfw)
@endcode
@subsection news_33_attention User attention request @subsection deprecations_34 Deprecations in version 3.4
GLFW now supports requesting user attention to a specific window (on macOS to @subsection removals_34 Removals in 3.4
the application as a whole) with @ref glfwRequestWindowAttention.
@see @ref window_attention @subsection symbols_34 New symbols in version 3.4
@subsubsection functions_34 New functions in version 3.4
@subsubsection types_34 New types in version 3.4
@subsubsection constants_34 New constants in version 3.4
@subsection news_33_maximize Window maximization callback @section news_33 Release notes for version 3.3
GLFW now supports notifying the application that the window has been maximized These are the release notes for version 3.3. For a more detailed view including
@ref glfwSetWindowMaximizeCallback. all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
@see @ref window_maximize Please review the caveats, deprecations and removals if your project was written
against an earlier version of GLFW 3.
@subsection news_33_keyscancode Platform-specific key scancode query @subsection features_33 New features in version 3.3
GLFW now supports querying the platform dependent scancode of any physical key @subsubsection gamepad_33 Gamepad input via SDL_GameControllerDB
with @ref glfwGetKeyScancode.
@see @ref input_key GLFW can now remap game controllers to a standard Xbox-like layout using
a built-in copy of SDL_GameControllerDB. Call @ref glfwJoystickIsGamepad to
check if a joystick has a mapping, @ref glfwGetGamepadState to retrieve its
input state, @ref glfwUpdateGamepadMappings to add newer mappings and @ref
glfwGetGamepadName and @ref glfwGetJoystickGUID for mapping related information.
For more information see @ref gamepad.
@subsection news_33_setwindowattrib Support for updating window attributes @subsubsection moltenvk_33 Support for Vulkan on macOS via MoltenVK
GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib), GLFW now supports [MoltenVK](https://moltengl.com/moltenvk/), a Vulkan
[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib), implementation on top of the Metal API, and its `VK_MVK_macos_surface` window
[GLFW_FLOATING](@ref GLFW_FLOATING_attrib) and surface creation extension. MoltenVK is included in the [macOS Vulkan
[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) attributes for existing SDK](https://vulkan.lunarg.com/).
windows with @ref glfwSetWindowAttrib.
@see @ref window_attribs For more information see @ref vulkan_guide.
@subsection news_33_contentscale Content scale queries for DPI-aware rendering @subsubsection content_scale_33 Content scale queries for DPI-aware rendering
GLFW now supports querying the window and monitor content scale, i.e. the ratio GLFW now provides content scales for windows and monitors, i.e. the ratio
between the current DPI and the platform's default DPI, with @ref between their current DPI and the platform's default DPI, with @ref
glfwGetWindowContentScale and @ref glfwGetMonitorContentScale. glfwGetWindowContentScale and @ref glfwGetMonitorContentScale.
Changes of the content scale of a window can be received with the window content Changes of the content scale of a window can be received with the window content
@ -75,38 +79,93 @@ scale callback, set with @ref glfwSetWindowContentScaleCallback.
The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a
window by the content scale of the monitor it is placed, on platforms like window by the content scale of the monitor it is placed, on platforms like
Windows and X11 where this is necessary. Windows where this is necessary. This takes effect both on creation and when
the window is moved between monitors. It is related to but different from
[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
@see @ref window_scale For more information see @ref window_scale.
@subsection news_33_inithint Support for initialization hints @subsubsection setwindowattrib_33 Support for updating window attributes
GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
[GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
[GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) attributes for existing
windows with @ref glfwSetWindowAttrib.
For more information see @ref window_attribs.
@subsubsection raw_motion_33 Support for raw mouse motion
GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled
cursor mode with the [GLFW_RAW_MOUSE_MOTION](@ref GLFW_RAW_MOUSE_MOTION) input
mode. Raw mouse motion input is not yet implemented on macOS. Call @ref
glfwRawMouseMotionSupported to check if GLFW can provide raw mouse motion on the
current system.
For more information see @ref raw_mouse_motion.
@subsubsection joysticks_33 Joystick hats
GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with
@ref glfwGetJoystickHats. For compatibility, hats are also exposed as buttons.
This can be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS initialization
hint.
For more information see @ref joystick_hat.
@subsubsection geterror_33 Error query
GLFW now supports querying the last error code for the calling thread and its
human-readable description with @ref glfwGetError. This can be used instead of
or together with the error callback.
For more information see @ref error_handling.
@subsubsection init_hints_33 Support for initialization hints
GLFW now supports setting library initialization hints with @ref glfwInitHint. GLFW now supports setting library initialization hints with @ref glfwInitHint.
These must be set before initialization to take effect. These must be set before initialization to take effect. Some of these hints are
platform specific but are safe to set on any platform.
@see @ref init_hints For more information see @ref init_hints.
@subsection news_33_platformhints Support for platform specific hints @subsubsection attention_33 User attention request
GLFW now supports platform specific init and window hints to control system GLFW now supports requesting user attention with @ref
features that are only available on a single platform. glfwRequestWindowAttention. Where possible this calls attention to the
specified window. On platforms like macOS it calls attention to the whole
application.
@see @ref init_hints_osx For more information see @ref window_attention.
@see @ref window_hints_osx
@subsection news_33_joyhats Support for joystick hats @subsubsection maximize_33 Window maximization callback
GLFW now supports querying the hats (or POVs or D-pads) of a joystick with @ref GLFW now supports notifying the application that the window has been maximized
glfwGetJoystickHats. Hats are by default also exposed as buttons, but this can @ref glfwSetWindowMaximizeCallback. This is called both when the window was
be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS init hint. maximized by the user and when it was done with @ref glfwMaximizeWindow.
@see @ref joystick_hat For more information see @ref window_maximize.
@subsection news_33_transparent Support for transparent windows and framebuffers @subsubsection workarea_33 Query for the monitor work area
GLFW now supports querying the work area of a monitor, i.e. the area not
occupied by task bars or global menu bars, with @ref glfwGetMonitorWorkarea. On
platforms that lack this concept, the whole area of the monitor is returned.
For more information see @ref monitor_workarea.
@subsubsection transparency_33 Transparent windows and framebuffers
GLFW now supports the creation of windows with transparent framebuffers on GLFW now supports the creation of windows with transparent framebuffers on
systems with desktop compositing enabled with the @ref systems with desktop compositing enabled with the @ref
@ -118,73 +177,340 @@ and @ref glfwSetWindowOpacity. This value controls the opacity of the whole
window including decorations and unlike framebuffer transparency can be changed window including decorations and unlike framebuffer transparency can be changed
at any time after window creation. at any time after window creation.
For more information see @ref window_transparency.
@subsection news_33_centercursor Cursor centering window hint
@subsubsection key_scancode_33 Query for the scancode of a key
GLFW now supports querying the platform dependent scancode of any physical key
with @ref glfwGetKeyScancode.
For more information see @ref input_key.
@subsubsection center_cursor_33 Cursor centering window hint
GLFW now supports controlling whether the cursor is centered over newly created GLFW now supports controlling whether the cursor is centered over newly created
full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint) full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint)
window hint. It is enabled by default. window hint. It is enabled by default.
@subsection news_33_hover Mouse cursor hover window attribute @subsubsection cursor_hover_33 Mouse cursor hover window attribute
GLFW now supports polling whether the cursor is hovering over the window client GLFW now supports polling whether the cursor is hovering over the window content
area with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. This area with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. This
attribute corresponds to the [cursor enter/leave](@ref cursor_enter) event. attribute corresponds to the [cursor enter/leave](@ref cursor_enter) event.
@subsection news_33_rawmotion Support for raw mouse motion @subsubsection focusonshow_33 Window hint and attribute for input focus on show
GLFW now uses raw (unscaled and unaccelerated) mouse motion in disabled cursor GLFW now has the [GLFW_FOCUS_ON_SHOW](@ref GLFW_DECORATED_hint) window hint and
mode on platforms where this is available, specifically Windows and X11. attribute for controlling whether a window gets input focus when shown. It is
enabled by default. It applies both when creating an visible window with @ref
glfwCreateWindow and when showing it with @ref glfwShowWindow.
This is a workaround for GLFW 3.0 lacking @ref glfwFocusWindow and will be
corrected in the next major version.
For more information see @ref window_hide.
@subsection news_33_moltenvk Support for Vulkan on macOS via MoltenVK @subsubsection device_userptr_33 Monitor and joystick user pointers
GLFW now supports the `VK_MVK_macos_surface` window surface creation extension GLFW now supports setting and querying user pointers for connected monitors and
provided by MoltenVK in the [LunarG Vulkan SDK](https://vulkan.lunarg.com/). joysticks with @ref glfwSetMonitorUserPointer, @ref glfwGetMonitorUserPointer,
@ref glfwSetJoystickUserPointer and @ref glfwGetJoystickUserPointer.
@see @ref vulkan_guide For more information see @ref monitor_userptr and @ref joystick_userptr.
@subsection news_33_osmesa OSMesa backend for headless software rendering @subsubsection macos_nib_33 macOS menu bar from nib file
GLFW now supports creating offscreen OpenGL contexts using GLFW will now load a `MainMenu.nib` file if found in the `Contents/Resources`
directory of the application bundle, as a way to replace the GLFW menu bar
without recompiling GLFW. This behavior can be disabled with the
[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) initialization hint.
@subsubsection glext_33 Support for more context creation extensions
The context hint @ref GLFW_SRGB_CAPABLE now supports OpenGL ES via
`WGL_EXT_colorspace`, the context hint @ref GLFW_CONTEXT_NO_ERROR now supports
`WGL_ARB_create_context_no_error` and `GLX_ARB_create_context_no_error`, the
context hint @ref GLFW_CONTEXT_RELEASE_BEHAVIOR now supports
`EGL_KHR_context_flush_control` and @ref glfwGetProcAddress now supports
`EGL_KHR_get_all_proc_addresses`.
@subsubsection osmesa_33 OSMesa off-screen context creation support
GLFW now supports creating off-screen OpenGL contexts using
[OSMesa](https://www.mesa3d.org/osmesa.html) by setting [OSMesa](https://www.mesa3d.org/osmesa.html) by setting
[GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) to [GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) to
`GLFW_OSMESA_CONTEXT_API`. `GLFW_OSMESA_CONTEXT_API`. Native access function have been added to retrieve
the OSMesa color and depth buffers.
There is also a new null backend that uses OSMesa as its native context There is also a new null backend that uses OSMesa as its native context
creation API, intended for automated testing. This backend does not provide creation API, intended for automated testing. This backend does not provide
input. input.
@subsection news_33_userptr Monitor and joystick user pointers @subsection caveats_33 Caveats for version 3.3
GLFW now supports setting and querying user pointers for connected monitors and @subsubsection joystick_layout_33 Layout of joysticks have changed
joysticks with @ref glfwSetMonitorUserPointer, @ref glfwGetMonitorUserPointer,
@ref glfwSetJoystickUserPointer and @ref glfwGetJoystickUserPointer. The way joystick elements are arranged have changed to match SDL2 in order to
support SDL_GameControllerDB mappings. The layout of joysticks may
change again if required for compatibility with SDL2. If you need a known and
stable layout for game controllers, see if you can switch to @ref gamepad.
Existing code that depends on a specific joystick layout will likely have to be
updated.
@subsection news_33_primary X11 primary selection access @subsubsection wait_events_33 No window required to wait for events
GLFW now supports querying and setting the X11 primary selection via the native The @ref glfwWaitEvents and @ref glfwWaitEventsTimeout functions no longer need
access functions @ref glfwGetX11SelectionString and @ref a window to be created to wait for events. Before version 3.3 these functions
glfwSetX11SelectionString. would return immediately if there were no user-created windows. On platforms
where only windows can receive events, an internal helper window is used.
Existing code that depends on the earlier behavior will likely have to be
updated.
@subsection news_33_mir_removal Experimental Mir support has been removed @subsubsection gamma_ramp_size_33 Gamma ramp size of 256 may be rejected
As per the release of Mir 1.0, the recommended API is now Wayland, the The documentation for versions before 3.3 stated that a gamma ramp size of 256
experimental Mir display server backend introduced in GLFW 3.1 has thus been would always be accepted. This was never the case on X11 and could lead to
removed. To use the experimental Wayland backend, pass -DGLFW_USE_WAYLAND=ON artifacts on macOS. The @ref glfwSetGamma function has been updated to always
to cmake where you previously passed the now-removed -DGLFW_USE_MIR=ON. generate a ramp of the correct size.
Existing code that hardcodes a size of 256 should be updated to use the size of
the current ramp of a monitor when setting a new ramp for that monitor.
@subsubsection xinput_deadzone_33 Windows XInput deadzone removed
GLFW no longer applies any deadzone to the input state received from the XInput
API. This was never done for any other platform joystick API so this change
makes the behavior more consistent but you will need to apply your own deadzone
if desired.
@subsubsection x11_clipboard_33 X11 clipboard transfer limits
GLFW now supports reading clipboard text via the `INCR` method, which removes
the limit on how much text can be read with @ref glfwGetClipboardString.
However, writing via this method is not yet supported, so you may not be able to
write a very large string with @ref glfwSetClipboardString even if you read it
from the clipboard earlier.
The exact size limit for writing to the clipboard is negotiated with each
receiving application but is at least several tens of kilobytes. Note that only
the read limit has changed. Any string that could be written before still can
be.
@subsubsection x11_linking_33 X11 extension libraries are loaded dynamically
GLFW now loads all X11 extension libraries at initialization. The only X11
library you need to link against is `libX11`. The header files for the
extension libraries are still required for compilation.
Existing projects and makefiles that link GLFW directly against the extension
libraries should still build correctly but will add these libraries as load-time
dependencies.
@subsubsection cmake_version_33 CMake 3.0 or later is required
The minimum CMake version has been raised from 2.8.12 to 3.0. This is only
a requirement of the GLFW CMake files. The GLFW source files do not depend on
CMake.
@subsection deprecations_33 Deprecations in version 3.3
@subsubsection charmods_callback_33 Character with modifiers callback
The character with modifiers callback set with @ref glfwSetCharModsCallback has
been deprecated and should if possible not be used.
Existing code should still work but further bug fixes will likely not be made.
The callback will be removed in the next major version.
@subsubsection clipboard_window_33 Window parameter to clipboard functions
The window parameter of the clipboard functions @ref glfwGetClipboardString and
@ref glfwSetClipboardString has been deprecated and is no longer used on any
platform. On platforms where the clipboard must be owned by a specific window,
an internal helper window is used.
Existing code should still work unless it depends on a specific window owning
the clipboard. New code may pass `NULL` as the window argument. The parameter
will be removed in a future release.
@subsection removals_33 Removals in 3.3
@subsubsection macos_options_33 macOS specific CMake options and macros
The `GLFW_USE_RETINA`, `GLFW_USE_CHDIR` and `GLFW_USE_MENUBAR` CMake options and
the `_GLFW_USE_RETINA`, `_GLFW_USE_CHDIR` and `_GLFW_USE_MENUBAR` compile-time
macros have been removed.
These options and macros are replaced by the window hint
[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
and the init hints
[GLFW_COCOA_CHDIR_RESOURCES](@ref GLFW_COCOA_CHDIR_RESOURCES_hint) and
[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint).
Existing projects and makefiles that set these options or define these macros
during compilation of GLFW will still build but it will have no effect and the
default behaviors will be used.
@subsubsection vulkan_sdk_33 LunarG Vulkan SDK dependency
The GLFW test programs that previously depended on the LunarG Vulkan SDK now
instead uses a Vulkan loader generated by
[glad2](https://github.com/Dav1dde/glad). This means the GLFW CMake files no
longer look for the Vulkan SDK.
Existing CMake projects that depended on the Vulkan SDK cache variables from
GLFW will need to call `find_package(Vulkan)` themselves. CMake 3.7 and later
already comes with a
[Vulkan find module](https://cmake.org/cmake/help/latest/module/FindVulkan.html)
similar to the one GLFW previously included.
@subsubsection lib_suffix_33 CMake option LIB_SUFFIX
The `LIB_SUFFIX` CMake option has been removed. GLFW now uses the
GNUInstallDirs CMake package to handle platform specific details like the
library directory suffix and the `LIB_SUFFIX` CMake option has been removed.
Existing projects and makefiles that set the `LIB_SUFFIX` option will use the
suffix chosen by the GNUInstallDirs package and the option will be ignored.
@subsubsection mir_removed_33 Mir support
The experimental Mir support has been completely removed as the Mir project has
implemented support for the Wayland protocol and is recommending that
applications use that instead.
Existing projects and makefiles that select Mir when compiling GLFW will fail.
Use Wayland or X11 instead.
@subsection symbols_33 New symbols in version 3.3
@subsubsection functions_33 New functions in version 3.3
- @ref glfwInitHint
- @ref glfwGetError
- @ref glfwGetMonitorWorkarea
- @ref glfwGetMonitorContentScale
- @ref glfwGetMonitorUserPointer
- @ref glfwSetMonitorUserPointer
- @ref glfwWindowHintString
- @ref glfwGetWindowContentScale
- @ref glfwGetWindowOpacity
- @ref glfwSetWindowOpacity
- @ref glfwRequestWindowAttention
- @ref glfwSetWindowAttrib
- @ref glfwSetWindowMaximizeCallback
- @ref glfwSetWindowContentScaleCallback
- @ref glfwRawMouseMotionSupported
- @ref glfwGetKeyScancode
- @ref glfwGetJoystickHats
- @ref glfwGetJoystickGUID
- @ref glfwGetJoystickUserPointer
- @ref glfwSetJoystickUserPointer
- @ref glfwJoystickIsGamepad
- @ref glfwUpdateGamepadMappings
- @ref glfwGetGamepadName
- @ref glfwGetGamepadState
@subsubsection types_33 New types in version 3.3
- @ref GLFWwindowmaximizefun
- @ref GLFWwindowcontentscalefun
- @ref GLFWgamepadstate
@subsubsection constants_33 New constants in version 3.3
- @ref GLFW_NO_ERROR
- @ref GLFW_JOYSTICK_HAT_BUTTONS
- @ref GLFW_COCOA_CHDIR_RESOURCES
- @ref GLFW_COCOA_MENUBAR
- @ref GLFW_CENTER_CURSOR
- @ref GLFW_TRANSPARENT_FRAMEBUFFER
- @ref GLFW_HOVERED
- @ref GLFW_FOCUS_ON_SHOW
- @ref GLFW_SCALE_TO_MONITOR
- @ref GLFW_COCOA_RETINA_FRAMEBUFFER
- @ref GLFW_COCOA_FRAME_NAME
- @ref GLFW_COCOA_GRAPHICS_SWITCHING
- @ref GLFW_X11_CLASS_NAME
- @ref GLFW_X11_INSTANCE_NAME
- @ref GLFW_OSMESA_CONTEXT_API
- @ref GLFW_HAT_CENTERED
- @ref GLFW_HAT_UP
- @ref GLFW_HAT_RIGHT
- @ref GLFW_HAT_DOWN
- @ref GLFW_HAT_LEFT
- @ref GLFW_HAT_RIGHT_UP
- @ref GLFW_HAT_RIGHT_DOWN
- @ref GLFW_HAT_LEFT_UP
- @ref GLFW_HAT_LEFT_DOWN
- @ref GLFW_MOD_CAPS_LOCK
- @ref GLFW_MOD_NUM_LOCK
- @ref GLFW_LOCK_KEY_MODS
- @ref GLFW_RAW_MOUSE_MOTION
- @ref GLFW_GAMEPAD_BUTTON_A
- @ref GLFW_GAMEPAD_BUTTON_B
- @ref GLFW_GAMEPAD_BUTTON_X
- @ref GLFW_GAMEPAD_BUTTON_Y
- @ref GLFW_GAMEPAD_BUTTON_LEFT_BUMPER
- @ref GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER
- @ref GLFW_GAMEPAD_BUTTON_BACK
- @ref GLFW_GAMEPAD_BUTTON_START
- @ref GLFW_GAMEPAD_BUTTON_GUIDE
- @ref GLFW_GAMEPAD_BUTTON_LEFT_THUMB
- @ref GLFW_GAMEPAD_BUTTON_RIGHT_THUMB
- @ref GLFW_GAMEPAD_BUTTON_DPAD_UP
- @ref GLFW_GAMEPAD_BUTTON_DPAD_RIGHT
- @ref GLFW_GAMEPAD_BUTTON_DPAD_DOWN
- @ref GLFW_GAMEPAD_BUTTON_DPAD_LEFT
- @ref GLFW_GAMEPAD_BUTTON_LAST
- @ref GLFW_GAMEPAD_BUTTON_CROSS
- @ref GLFW_GAMEPAD_BUTTON_CIRCLE
- @ref GLFW_GAMEPAD_BUTTON_SQUARE
- @ref GLFW_GAMEPAD_BUTTON_TRIANGLE
- @ref GLFW_GAMEPAD_AXIS_LEFT_X
- @ref GLFW_GAMEPAD_AXIS_LEFT_Y
- @ref GLFW_GAMEPAD_AXIS_RIGHT_X
- @ref GLFW_GAMEPAD_AXIS_RIGHT_Y
- @ref GLFW_GAMEPAD_AXIS_LEFT_TRIGGER
- @ref GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
- @ref GLFW_GAMEPAD_AXIS_LAST
@section news_32 Release notes for 3.2 @section news_32 Release notes for 3.2
These are the release notes for version 3.2. For a more detailed view including
all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
@subsection news_32_vulkan Support for Vulkan
@subsection features_32 New features in version 3.2
@subsubsection news_32_vulkan Support for Vulkan
GLFW now supports basic integration with Vulkan with @ref glfwVulkanSupported, GLFW now supports basic integration with Vulkan with @ref glfwVulkanSupported,
@ref glfwGetRequiredInstanceExtensions, @ref glfwGetInstanceProcAddress, @ref @ref glfwGetRequiredInstanceExtensions, @ref glfwGetInstanceProcAddress, @ref
@ -193,79 +519,79 @@ Vulkan header inclusion can be selected with
@ref GLFW_INCLUDE_VULKAN. @ref GLFW_INCLUDE_VULKAN.
@subsection news_32_setwindowmonitor Window mode switching @subsubsection news_32_setwindowmonitor Window mode switching
GLFW now supports switching between windowed and full screen modes and updating GLFW now supports switching between windowed and full screen modes and updating
the monitor and desired resolution and refresh rate of full screen windows with the monitor and desired resolution and refresh rate of full screen windows with
@ref glfwSetWindowMonitor. @ref glfwSetWindowMonitor.
@subsection news_32_maximize Window maxmimization support @subsubsection news_32_maximize Window maxmimization support
GLFW now supports window maximization with @ref glfwMaximizeWindow and the GLFW now supports window maximization with @ref glfwMaximizeWindow and the
@ref GLFW_MAXIMIZED window hint and attribute. @ref GLFW_MAXIMIZED window hint and attribute.
@subsection news_32_focus Window input focus control @subsubsection news_32_focus Window input focus control
GLFW now supports giving windows input focus with @ref glfwFocusWindow. GLFW now supports giving windows input focus with @ref glfwFocusWindow.
@subsection news_32_sizelimits Window size limit support @subsubsection news_32_sizelimits Window size limit support
GLFW now supports setting both absolute and relative window size limits with GLFW now supports setting both absolute and relative window size limits with
@ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio. @ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio.
@subsection news_32_keyname Localized key names @subsubsection news_32_keyname Localized key names
GLFW now supports querying the localized name of printable keys with @ref GLFW now supports querying the localized name of printable keys with @ref
glfwGetKeyName, either by key token or by scancode. glfwGetKeyName, either by key token or by scancode.
@subsection news_32_waittimeout Wait for events with timeout @subsubsection news_32_waittimeout Wait for events with timeout
GLFW now supports waiting for events for a set amount of time with @ref GLFW now supports waiting for events for a set amount of time with @ref
glfwWaitEventsTimeout. glfwWaitEventsTimeout.
@subsection news_32_icon Window icon support @subsubsection news_32_icon Window icon support
GLFW now supports setting the icon of windows with @ref glfwSetWindowIcon. GLFW now supports setting the icon of windows with @ref glfwSetWindowIcon.
@subsection news_32_timer Raw timer access @subsubsection news_32_timer Raw timer access
GLFW now supports raw timer values with @ref glfwGetTimerValue and @ref GLFW now supports raw timer values with @ref glfwGetTimerValue and @ref
glfwGetTimerFrequency. glfwGetTimerFrequency.
@subsection news_32_joystick Joystick connection callback @subsubsection news_32_joystick Joystick connection callback
GLFW now supports notifying when a joystick has been connected or disconnected GLFW now supports notifying when a joystick has been connected or disconnected
with @ref glfwSetJoystickCallback. with @ref glfwSetJoystickCallback.
@subsection news_32_noapi Context-less windows @subsubsection news_32_noapi Context-less windows
GLFW now supports creating windows without a OpenGL or OpenGL ES context by GLFW now supports creating windows without a OpenGL or OpenGL ES context by
setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
@subsection news_32_contextapi Run-time context creation API selection @subsubsection news_32_contextapi Run-time context creation API selection
GLFW now supports selecting and querying the context creation API at run-time GLFW now supports selecting and querying the context creation API at run-time
with the @ref GLFW_CONTEXT_CREATION_API hint and attribute. with the @ref GLFW_CONTEXT_CREATION_API hint and attribute.
@subsection news_32_noerror Error-free context creation @subsubsection news_32_noerror Error-free context creation
GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do
not emit errors with the @ref GLFW_CONTEXT_NO_ERROR hint, provided the machine not emit errors with the @ref GLFW_CONTEXT_NO_ERROR hint, provided the machine
supports the `GL_KHR_no_error` extension. supports the `GL_KHR_no_error` extension.
@subsection news_32_cmake CMake config-file package support @subsubsection news_32_cmake CMake config-file package support
GLFW now supports being used as a GLFW now supports being used as a
[config-file package](@ref build_link_cmake_package) from other projects for [config-file package](@ref build_link_cmake_package) from other projects for
@ -274,11 +600,13 @@ easy linking with the library and its dependencies.
@section news_31 Release notes for 3.1 @section news_31 Release notes for 3.1
These are the release highlights. For a full list of changes see the These are the release notes for version 3.1. For a more detailed view including
[version history](https://www.glfw.org/changelog.html). all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
@subsection news_31_cursor Custom mouse cursor images @subsection features_31 New features in version 3.1
@subsubsection news_31_cursor Custom mouse cursor images
GLFW now supports creating and setting both custom cursor images and standard GLFW now supports creating and setting both custom cursor images and standard
cursor shapes. They are created with @ref glfwCreateCursor or @ref cursor shapes. They are created with @ref glfwCreateCursor or @ref
@ -288,7 +616,7 @@ glfwDestroyCursor.
@see @ref cursor_object @see @ref cursor_object
@subsection news_31_drop Path drop event @subsubsection news_31_drop Path drop event
GLFW now provides a callback for receiving the paths of files and directories GLFW now provides a callback for receiving the paths of files and directories
dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback. dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback.
@ -296,7 +624,7 @@ dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback.
@see @ref path_drop @see @ref path_drop
@subsection news_31_emptyevent Main thread wake-up @subsubsection news_31_emptyevent Main thread wake-up
GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty
event from another thread to the main thread event queue, causing @ref event from another thread to the main thread event queue, causing @ref
@ -305,15 +633,15 @@ glfwWaitEvents to return.
@see @ref events @see @ref events
@subsection news_31_framesize Window frame size query @subsubsection news_31_framesize Window frame size query
GLFW now supports querying the size, on each side, of the frame around the GLFW now supports querying the size, on each side, of the frame around the
client area of a window, with @ref glfwGetWindowFrameSize. content area of a window, with @ref glfwGetWindowFrameSize.
@see [Window size](@ref window_size) @see [Window size](@ref window_size)
@subsection news_31_autoiconify Simultaneous multi-monitor rendering @subsubsection news_31_autoiconify Simultaneous multi-monitor rendering
GLFW now supports disabling auto-iconification of full screen windows with GLFW now supports disabling auto-iconification of full screen windows with
the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint. This is the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint. This is
@ -321,25 +649,25 @@ intended for people building multi-monitor installations, where you need windows
to stay in full screen despite losing input focus. to stay in full screen despite losing input focus.
@subsection news_31_floating Floating windows @subsubsection news_31_floating Floating windows
GLFW now supports floating windows, also called topmost or always on top, for GLFW now supports floating windows, also called topmost or always on top, for
easier debugging with the @ref GLFW_FLOATING window hint and attribute. easier debugging with the @ref GLFW_FLOATING window hint and attribute.
@subsection news_31_focused Initially unfocused windows @subsubsection news_31_focused Initially unfocused windows
GLFW now supports preventing a windowed mode window from gaining input focus on GLFW now supports preventing a windowed mode window from gaining input focus on
creation, with the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint. creation, with the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint.
@subsection news_31_direct Direct access for window attributes and cursor position @subsubsection news_31_direct Direct access for window attributes and cursor position
GLFW now queries the window input focus, visibility and iconification attributes GLFW now queries the window input focus, visibility and iconification attributes
and the cursor position directly instead of returning cached data. and the cursor position directly instead of returning cached data.
@subsection news_31_charmods Character with modifiers callback @subsubsection news_31_charmods Character with modifiers callback
GLFW now provides a callback for character events with modifier key bits. The GLFW now provides a callback for character events with modifier key bits. The
callback is set with @ref glfwSetCharModsCallback. Unlike the regular character callback is set with @ref glfwSetCharModsCallback. Unlike the regular character
@ -349,13 +677,13 @@ being input, for example if the Control key is held down.
@see @ref input_char @see @ref input_char
@subsection news_31_single Single buffered framebuffers @subsubsection news_31_single Single buffered framebuffers
GLFW now supports the creation of single buffered windows, with the @ref GLFW now supports the creation of single buffered windows, with the @ref
GLFW_DOUBLEBUFFER hint. GLFW_DOUBLEBUFFER hint.
@subsection news_31_glext Macro for including extension header @subsubsection news_31_glext Macro for including extension header
GLFW now includes the extension header appropriate for the chosen OpenGL or GLFW now includes the extension header appropriate for the chosen OpenGL or
OpenGL ES header when @ref GLFW_INCLUDE_GLEXT is defined. GLFW does not provide OpenGL ES header when @ref GLFW_INCLUDE_GLEXT is defined. GLFW does not provide
@ -363,7 +691,7 @@ these headers. They must be provided by your development environment or your
OpenGL or OpenGL ES SDK. OpenGL or OpenGL ES SDK.
@subsection news_31_release Context release behaviors @subsubsection news_31_release Context release behaviors
GLFW now supports controlling and querying whether the pipeline is flushed when GLFW now supports controlling and querying whether the pipeline is flushed when
a context is made non-current, with the @ref GLFW_CONTEXT_RELEASE_BEHAVIOR hint a context is made non-current, with the @ref GLFW_CONTEXT_RELEASE_BEHAVIOR hint
@ -371,13 +699,13 @@ and attribute, provided the machine supports the `GL_KHR_context_flush_control`
extension. extension.
@subsection news_31_wayland (Experimental) Wayland support @subsubsection news_31_wayland (Experimental) Wayland support
GLFW now has an _experimental_ Wayland display protocol backend that can be GLFW now has an _experimental_ Wayland display protocol backend that can be
selected on Linux with a CMake option. selected on Linux with a CMake option.
@subsection news_31_mir (Experimental) Mir support @subsubsection news_31_mir (Experimental) Mir support
GLFW now has an _experimental_ Mir display server backend that can be selected GLFW now has an _experimental_ Mir display server backend that can be selected
on Linux with a CMake option. on Linux with a CMake option.
@ -385,11 +713,13 @@ on Linux with a CMake option.
@section news_30 Release notes for 3.0 @section news_30 Release notes for 3.0
These are the release highlights. For a full list of changes see the These are the release notes for version 3.0. For a more detailed view including
[version history](https://www.glfw.org/changelog.html). all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
@subsection news_30_cmake CMake build system @subsection features_30 New features in version 3.0
@subsubsection news_30_cmake CMake build system
GLFW now uses the CMake build system instead of the various makefiles and 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 project files used by earlier versions. CMake is available for all platforms
@ -400,7 +730,7 @@ For more information on how to use CMake, see the
[CMake manual](https://cmake.org/cmake/help/documentation.html). [CMake manual](https://cmake.org/cmake/help/documentation.html).
@subsection news_30_multiwnd Multi-window support @subsubsection news_30_multiwnd Multi-window support
GLFW now supports the creation of multiple windows, each with their own OpenGL 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 or OpenGL ES context, and all window functions now take a window handle. Event
@ -409,7 +739,7 @@ received the event. The @ref glfwMakeContextCurrent function has been added to
select which context is current on a given thread. select which context is current on a given thread.
@subsection news_30_multimon Multi-monitor support @subsubsection news_30_multimon Multi-monitor support
GLFW now explicitly supports multiple monitors. They can be enumerated with GLFW now explicitly supports multiple monitors. They can be enumerated with
@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref @ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref
@ -418,7 +748,7 @@ and specified at window creation to make the newly created window full screen on
that specific monitor. that specific monitor.
@subsection news_30_unicode Unicode support @subsubsection news_30_unicode Unicode support
All string arguments to GLFW functions and all strings returned by GLFW now use 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 the UTF-8 encoding. This includes the window title, error string, clipboard
@ -426,21 +756,21 @@ text, monitor and joystick names as well as the extension function arguments (as
ASCII is a subset of UTF-8). ASCII is a subset of UTF-8).
@subsection news_30_clipboard Clipboard text I/O @subsubsection news_30_clipboard Clipboard text I/O
GLFW now supports reading and writing plain text to and from the system GLFW now supports reading and writing plain text to and from the system
clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString
functions. functions.
@subsection news_30_gamma Gamma ramp support @subsubsection news_30_gamma Gamma ramp support
GLFW now supports setting and reading back the gamma ramp of monitors, with the GLFW now supports setting and reading back the gamma ramp of monitors, with the
@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref @ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref
glfwSetGamma, which generates a ramp from a gamma value and then sets it. glfwSetGamma, which generates a ramp from a gamma value and then sets it.
@subsection news_30_gles OpenGL ES support @subsubsection news_30_gles OpenGL ES support
GLFW now supports the creation of OpenGL ES contexts, by setting the GLFW now supports the creation of OpenGL ES contexts, by setting the
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_OPENGL_ES_API`, where [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_OPENGL_ES_API`, where
@ -450,13 +780,13 @@ Nvidia and Intel drivers support creation of OpenGL ES context using the GLX and
WGL APIs, while AMD provides an EGL implementation instead. WGL APIs, while AMD provides an EGL implementation instead.
@subsection news_30_egl (Experimental) EGL support @subsubsection news_30_egl (Experimental) EGL support
GLFW now has an experimental EGL context creation back end that can be selected GLFW now has an experimental EGL context creation back end that can be selected
through CMake options. through CMake options.
@subsection news_30_hidpi High-DPI support @subsubsection news_30_hidpi High-DPI support
GLFW now supports high-DPI monitors on both Windows and macOS, giving windows GLFW now supports high-DPI monitors on both Windows and macOS, giving windows
full resolution framebuffers where other UI elements are scaled up. To achieve full resolution framebuffers where other UI elements are scaled up. To achieve
@ -466,56 +796,56 @@ screen coordinates. This is important as OpenGL uses pixels, not screen
coordinates. coordinates.
@subsection news_30_error Error callback @subsubsection news_30_error Error callback
GLFW now has an error callback, which can provide your application with much GLFW now has an error callback, which can provide your application with much
more detailed diagnostics than was previously possible. The callback is passed more detailed diagnostics than was previously possible. The callback is passed
an error code and a description string. an error code and a description string.
@subsection news_30_wndptr Per-window user pointer @subsubsection news_30_wndptr Per-window user pointer
Each window now has a user-defined pointer, retrieved with @ref Each window now has a user-defined pointer, retrieved with @ref
glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
easier to integrate GLFW into C++ code. easier to integrate GLFW into C++ code.
@subsection news_30_iconifyfun Window iconification callback @subsubsection news_30_iconifyfun Window iconification callback
Each window now has a callback for iconification and restoration events, Each window now has a callback for iconification and restoration events,
which is set with @ref glfwSetWindowIconifyCallback. which is set with @ref glfwSetWindowIconifyCallback.
@subsection news_30_wndposfun Window position callback @subsubsection news_30_wndposfun Window position callback
Each window now has a callback for position events, which is set with @ref Each window now has a callback for position events, which is set with @ref
glfwSetWindowPosCallback. glfwSetWindowPosCallback.
@subsection news_30_wndpos Window position query @subsubsection news_30_wndpos Window position query
The position of a window can now be retrieved using @ref glfwGetWindowPos. The position of a window can now be retrieved using @ref glfwGetWindowPos.
@subsection news_30_focusfun Window focus callback @subsubsection news_30_focusfun Window focus callback
Each windows now has a callback for focus events, which is set with @ref Each windows now has a callback for focus events, which is set with @ref
glfwSetWindowFocusCallback. glfwSetWindowFocusCallback.
@subsection news_30_enterleave Cursor enter/leave callback @subsubsection news_30_enterleave Cursor enter/leave callback
Each window now has a callback for when the mouse cursor enters or leaves its Each window now has a callback for when the mouse cursor enters or leaves its
client area, which is set with @ref glfwSetCursorEnterCallback. content area, which is set with @ref glfwSetCursorEnterCallback.
@subsection news_30_wndtitle Initial window title @subsubsection news_30_wndtitle Initial window title
The title of a window is now specified at creation time, as one of the arguments The title of a window is now specified at creation time, as one of the arguments
to @ref glfwCreateWindow. to @ref glfwCreateWindow.
@subsection news_30_hidden Hidden windows @subsubsection news_30_hidden Hidden windows
Windows can now be hidden with @ref glfwHideWindow, shown using @ref Windows can now be hidden with @ref glfwHideWindow, shown using @ref
glfwShowWindow and created initially hidden with the @ref GLFW_VISIBLE window glfwShowWindow and created initially hidden with the @ref GLFW_VISIBLE window
@ -524,20 +854,20 @@ with most drivers, as well as moving a window to a specific position before
showing it. showing it.
@subsection news_30_undecorated Undecorated windows @subsubsection news_30_undecorated Undecorated windows
Windowed mode windows can now be created without decorations, e.g. things like Windowed mode windows can now be created without decorations, e.g. things like
a frame, a title bar, with the @ref GLFW_DECORATED window hint and attribute. a frame, a title bar, with the @ref GLFW_DECORATED window hint and attribute.
This allows for the creation of things like splash screens. This allows for the creation of things like splash screens.
@subsection news_30_keymods Modifier key bit masks @subsubsection news_30_keymods Modifier key bit masks
[Modifier key bit mask](@ref mods) parameters have been added to the [Modifier key bit mask](@ref mods) parameters have been added to the
[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks. [mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks.
@subsection news_30_scancode Platform-specific scancodes @subsubsection news_30_scancode Platform-specific scancodes
A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys 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 that don't have a [key token](@ref keys) still get passed on with the key
@ -545,12 +875,12 @@ parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines
and are intended to be used for key bindings. and are intended to be used for key bindings.
@subsection news_30_jsname Joystick names @subsubsection news_30_jsname Joystick names
The name of a joystick can now be retrieved using @ref glfwGetJoystickName. The name of a joystick can now be retrieved using @ref glfwGetJoystickName.
@subsection news_30_doxygen Doxygen documentation @subsubsection news_30_doxygen Doxygen documentation
You are reading it. You are reading it.

View File

@ -4,7 +4,7 @@
@tableofcontents @tableofcontents
This guide takes you through writing a simple application using GLFW 3. The This guide takes you through writing a small application using GLFW 3. The
application will create a window and OpenGL context, render a rotating triangle application will create a window and OpenGL context, render a rotating triangle
and exit when the user closes the window or presses _Escape_. This guide will and exit when the user closes the window or presses _Escape_. This guide will
introduce a few of the most commonly used functions, but there are many more. introduce a few of the most commonly used functions, but there are many more.
@ -47,11 +47,11 @@ exposes OpenGL 1.2. The easiest way to work around this is to use an
If you are using such a library then you should include its header _before_ the If you are using such a library then you should include its header _before_ the
GLFW header. This lets it replace the OpenGL header included by GLFW without GLFW header. This lets it replace the OpenGL header included by GLFW without
conflicts. This example uses conflicts. This example uses
[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such [glad2](https://github.com/Dav1dde/glad), but the same rule applies to all such
libraries. libraries.
@code @code
#include <glad/glad.h> #include <glad/gl.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
@endcode @endcode
@ -135,9 +135,14 @@ require a minimum OpenGL version by setting the `GLFW_CONTEXT_VERSION_MAJOR` and
`GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation. If the required minimum `GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation. If the required minimum
version is not supported on the machine, context (and window) creation fails. version is not supported on the machine, context (and window) creation fails.
You can select the OpenGL profile by setting the `GLFW_OPENGL_PROFILE` hint.
This program uses the core profile as that is the only profile macOS supports
for OpenGL 3.x and 4.x.
@code @code
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
if (!window) if (!window)
{ {
@ -177,7 +182,7 @@ a current context to load from. This example uses
libraries. libraries.
@code @code
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
@endcode @endcode
@ -326,19 +331,20 @@ for example, many kinds of editing tools.
@section quick_example Putting it together @section quick_example Putting it together
Now that you know how to initialize GLFW, create a window and poll for Now that you know how to initialize GLFW, create a window and poll for
keyboard input, it's possible to create a simple program. keyboard input, it's possible to create a small program.
This program creates a 640 by 480 windowed mode window and starts a loop that This program creates a 640 by 480 windowed mode window and starts a loop that
clears the screen, renders a triangle and processes events until the user either clears the screen, renders a triangle and processes events until the user either
presses _Escape_ or closes the window. presses _Escape_ or closes the window.
@snippet simple.c code @snippet triangle-opengl.c code
The program above can be found in the The program above can be found in the
[source package](https://www.glfw.org/download.html) as `examples/simple.c` [source package](https://www.glfw.org/download.html) as
and is compiled along with all other examples when you build GLFW. If you `examples/triangle-opengl.c` and is compiled along with all other examples when
built GLFW from the source package then already have this as `simple.exe` on you build GLFW. If you built GLFW from the source package then you already have
Windows, `simple` on Linux or `simple.app` on macOS. this as `triangle-opengl.exe` on Windows, `triangle-opengl` on Linux or
`triangle-opengl.app` on macOS.
This tutorial used only a few of the many functions GLFW provides. There are This tutorial used only a few of the many functions GLFW provides. There are
guides for each of the areas covered by GLFW. Each guide will introduce all the guides for each of the areas covered by GLFW. Each guide will introduce all the

View File

@ -13,7 +13,7 @@
height="327.98221" height="327.98221"
id="svg2" id="svg2"
version="1.1" version="1.1"
inkscape:version="0.48.4 r9939" inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="spaces.svg"> sodipodi:docname="spaces.svg">
<defs <defs
id="defs4"> id="defs4">
@ -38,11 +38,11 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="2.5611424" inkscape:zoom="1.8110012"
inkscape:cx="344.24359" inkscape:cx="320.68941"
inkscape:cy="163.9911" inkscape:cy="159.80509"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="svg2" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1021" inkscape:window-height="1021"
@ -475,18 +475,18 @@
inkscape:export-ydpi="109.89113" /> inkscape:export-ydpi="109.89113" />
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
x="21.213203" x="21.213203"
y="340.20465" y="340.20465"
id="text3803" id="text3803"
sodipodi:linespacing="125%"
inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png" inkscape:export-filename="/home/elmindreda/projects/glfw/glfw/docs/spaces.png"
inkscape:export-xdpi="109.89113" inkscape:export-xdpi="109.89113"
inkscape:export-ydpi="109.89113"><tspan inkscape:export-ydpi="109.89113"><tspan
sodipodi:role="line" sodipodi:role="line"
id="tspan3805" id="tspan3805"
x="21.213203" x="21.213203"
y="340.20465" /></text> y="340.20465"
style="font-size:12px;line-height:1.25;font-family:sans-serif"> </tspan></text>
<g <g
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
id="text3807"> id="text3807">
@ -647,74 +647,6 @@
style="font-size:10px" style="font-size:10px"
id="path3239" /> id="path3239" />
</g> </g>
<g
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
id="text3826">
<path
d="m 172.22728,456.1171 0,1.04004 c -0.33204,-0.30924 -0.68686,-0.54036 -1.06445,-0.69336 -0.37436,-0.15299 -0.77312,-0.22949 -1.19629,-0.2295 -0.83334,10e-6 -1.47136,0.25554 -1.91407,0.76661 -0.44271,0.50781 -0.66406,1.24349 -0.66406,2.20703 0,0.96029 0.22135,1.69596 0.66406,2.20703 0.44271,0.50781 1.08073,0.76172 1.91407,0.76172 0.42317,0 0.82193,-0.0765 1.19629,-0.2295 0.37759,-0.15299 0.73241,-0.38411 1.06445,-0.69336 l 0,1.03028 c -0.34506,0.23437 -0.71127,0.41015 -1.09863,0.52734 -0.38412,0.11719 -0.79102,0.17578 -1.22071,0.17578 -1.10351,0 -1.97265,-0.33691 -2.60742,-1.01074 -0.63476,-0.67708 -0.95215,-1.59993 -0.95215,-2.76855 0,-1.17187 0.31739,-2.09472 0.95215,-2.76856 0.63477,-0.67707 1.50391,-1.01562 2.60742,-1.01562 0.4362,0 0.84635,0.0586 1.23047,0.17578 0.38737,0.11394 0.75032,0.28646 1.08887,0.51758"
style="font-size:10px"
id="path3108" />
<path
d="m 173.72142,455.24796 0.89844,0 0,7.59765 -0.89844,0 0,-7.59765"
style="font-size:10px"
id="path3110" />
<path
d="m 176.49486,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
style="font-size:10px"
id="path3112" />
<path
d="m 183.94603,459.88663 0,0.43945 -4.13086,0 c 0.0391,0.61849 0.22461,1.0905 0.55664,1.41602 0.33528,0.32226 0.80078,0.4834 1.39649,0.48339 0.34504,1e-5 0.6787,-0.0423 1.00097,-0.12695 0.32552,-0.0846 0.64778,-0.21159 0.9668,-0.38086 l 0,0.84961 c -0.32227,0.13672 -0.65268,0.24089 -0.99121,0.3125 -0.33855,0.0716 -0.68197,0.10742 -1.03028,0.10742 -0.87239,0 -1.56413,-0.2539 -2.07519,-0.76172 -0.50781,-0.50781 -0.76172,-1.19466 -0.76172,-2.06054 0,-0.89518 0.24088,-1.60482 0.72266,-2.12891 0.48502,-0.52734 1.13769,-0.79101 1.958,-0.79101 0.73568,0 1.31673,0.23763 1.74317,0.71289 0.42968,0.47201 0.64452,1.11491 0.64453,1.92871 m -0.89844,-0.26367 c -0.007,-0.49154 -0.14486,-0.88379 -0.41504,-1.17676 -0.26693,-0.29297 -0.62175,-0.43945 -1.06445,-0.43946 -0.5013,1e-5 -0.90332,0.14161 -1.20605,0.42481 -0.29949,0.28321 -0.47201,0.68197 -0.51758,1.19629 l 3.20312,-0.005"
style="font-size:10px"
id="path3114" />
<path
d="m 189.96654,459.54483 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51758 -0.10092,-0.90495 -0.30273,-1.16211 -0.20183,-0.25716 -0.50457,-0.38574 -0.90821,-0.38574 -0.48503,0 -0.86751,0.15462 -1.14746,0.46386 -0.27995,0.30925 -0.41992,0.7308 -0.41992,1.26465 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19531 1.42578,0.58593 0.32226,0.38738 0.48339,0.95867 0.4834,1.71387"
style="font-size:10px"
id="path3116" />
<path
d="m 192.65697,455.82413 0,1.55273 1.85058,0 0,0.69824 -1.85058,0 0,2.96875 c 0,0.44597 0.0602,0.73243 0.18066,0.85938 0.1237,0.12695 0.37272,0.19043 0.74707,0.19043 l 0.92285,0 0,0.75195 -0.92285,0 c -0.69336,0 -1.17188,-0.12858 -1.43555,-0.38574 -0.26367,-0.26042 -0.3955,-0.73242 -0.3955,-1.41602 l 0,-2.96875 -0.65918,0 0,-0.69824 0.65918,0 0,-1.55273 0.90332,0"
style="font-size:10px"
id="path3118" />
<path
d="m 201.36302,460.09659 c -0.72591,0 -1.22884,0.083 -1.50879,0.24902 -0.27995,0.16602 -0.41992,0.44922 -0.41992,0.84961 0,0.31901 0.10417,0.57292 0.3125,0.76172 0.21159,0.18555 0.49805,0.27832 0.85938,0.27832 0.49804,0 0.8968,-0.17578 1.19628,-0.52734 0.30274,-0.35482 0.4541,-0.8252 0.45411,-1.41114 l 0,-0.20019 -0.89356,0 m 1.79199,-0.3711 0,3.12012 -0.89843,0 0,-0.83008 c -0.20509,0.33204 -0.46062,0.5778 -0.76661,0.73731 -0.30599,0.15625 -0.68034,0.23437 -1.12304,0.23437 -0.5599,0 -1.00586,-0.15625 -1.33789,-0.46875 -0.32878,-0.31575 -0.49317,-0.7373 -0.49317,-1.26465 0,-0.61523 0.20508,-1.07909 0.61524,-1.3916 0.41341,-0.31249 1.02864,-0.46874 1.8457,-0.46875 l 1.25977,0 0,-0.0879 c -1e-5,-0.4134 -0.13673,-0.73242 -0.41016,-0.95703 -0.27019,-0.22786 -0.65104,-0.34179 -1.14258,-0.3418 -0.3125,1e-5 -0.61686,0.0374 -0.91308,0.11231 -0.29623,0.0749 -0.58106,0.18718 -0.8545,0.33691 l 0,-0.83007 c 0.32878,-0.12695 0.64779,-0.22135 0.95704,-0.28321 0.30924,-0.0651 0.61034,-0.0976 0.90332,-0.0976 0.79101,0 1.38183,0.20508 1.77246,0.61523 0.39062,0.41016 0.58593,1.03191 0.58593,1.86523"
style="font-size:10px"
id="path3120" />
<path
d="m 208.17943,458.21671 c -0.10092,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49804 -0.27019,0.32878 -0.40528,0.80242 -0.40528,1.4209 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33203 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15788,0.0179 0.24903,0.0342 l 0.005,0.92286"
style="font-size:10px"
id="path3122" />
<path
d="m 213.59447,459.88663 0,0.43945 -4.13086,0 c 0.0391,0.61849 0.22461,1.0905 0.55664,1.41602 0.33528,0.32226 0.80078,0.4834 1.39648,0.48339 0.34505,1e-5 0.67871,-0.0423 1.00098,-0.12695 0.32552,-0.0846 0.64778,-0.21159 0.9668,-0.38086 l 0,0.84961 c -0.32227,0.13672 -0.65268,0.24089 -0.99121,0.3125 -0.33855,0.0716 -0.68197,0.10742 -1.03028,0.10742 -0.8724,0 -1.56413,-0.2539 -2.07519,-0.76172 -0.50782,-0.50781 -0.76172,-1.19466 -0.76172,-2.06054 0,-0.89518 0.24088,-1.60482 0.72265,-2.12891 0.48503,-0.52734 1.1377,-0.79101 1.95801,-0.79101 0.73567,0 1.31673,0.23763 1.74317,0.71289 0.42968,0.47201 0.64452,1.11491 0.64453,1.92871 m -0.89844,-0.26367 c -0.007,-0.49154 -0.14486,-0.88379 -0.41504,-1.17676 -0.26693,-0.29297 -0.62175,-0.43945 -1.06445,-0.43946 -0.50131,1e-5 -0.90333,0.14161 -1.20606,0.42481 -0.29948,0.28321 -0.472,0.68197 -0.51758,1.19629 l 3.20313,-0.005"
style="font-size:10px"
id="path3124" />
<path
d="m 217.55443,460.09659 c -0.72592,0 -1.22885,0.083 -1.50879,0.24902 -0.27995,0.16602 -0.41992,0.44922 -0.41992,0.84961 0,0.31901 0.10416,0.57292 0.3125,0.76172 0.21158,0.18555 0.49804,0.27832 0.85937,0.27832 0.49805,0 0.89681,-0.17578 1.19629,-0.52734 0.30273,-0.35482 0.4541,-0.8252 0.4541,-1.41114 l 0,-0.20019 -0.89355,0 m 1.79199,-0.3711 0,3.12012 -0.89844,0 0,-0.83008 c -0.20508,0.33204 -0.46061,0.5778 -0.7666,0.73731 -0.30599,0.15625 -0.68034,0.23437 -1.12305,0.23437 -0.55989,0 -1.00586,-0.15625 -1.33789,-0.46875 -0.32877,-0.31575 -0.49316,-0.7373 -0.49316,-1.26465 0,-0.61523 0.20508,-1.07909 0.61523,-1.3916 0.41341,-0.31249 1.02865,-0.46874 1.84571,-0.46875 l 1.25976,0 0,-0.0879 c 0,-0.4134 -0.13672,-0.73242 -0.41015,-0.95703 -0.27019,-0.22786 -0.65105,-0.34179 -1.14258,-0.3418 -0.3125,1e-5 -0.61687,0.0374 -0.91309,0.11231 -0.29622,0.0749 -0.58105,0.18718 -0.85449,0.33691 l 0,-0.83007 c 0.32877,-0.12695 0.64779,-0.22135 0.95703,-0.28321 0.30924,-0.0651 0.61035,-0.0976 0.90332,-0.0976 0.79101,0 1.38183,0.20508 1.77246,0.61523 0.39062,0.41016 0.58594,1.03191 0.58594,1.86523"
style="font-size:10px"
id="path3126" />
<path
d="m 226.50462,458.00674 c -0.48177,1e-5 -0.86263,0.18881 -1.14257,0.56641 -0.27995,0.37435 -0.41993,0.88868 -0.41993,1.54297 0,0.6543 0.13835,1.17025 0.41504,1.54785 0.27995,0.37435 0.66243,0.56153 1.14746,0.56152 0.47852,1e-5 0.85775,-0.1888 1.1377,-0.5664 0.27994,-0.3776 0.41992,-0.89193 0.41992,-1.54297 0,-0.64778 -0.13998,-1.16048 -0.41992,-1.53809 -0.27995,-0.38085 -0.65918,-0.57128 -1.1377,-0.57129 m 0,-0.76171 c 0.78125,0 1.39486,0.25391 1.84082,0.76171 0.44596,0.50782 0.66894,1.21095 0.66895,2.10938 -1e-5,0.89518 -0.22299,1.59831 -0.66895,2.10937 -0.44596,0.50782 -1.05957,0.76172 -1.84082,0.76172 -0.7845,0 -1.39974,-0.2539 -1.8457,-0.76172 -0.44271,-0.51106 -0.66406,-1.21419 -0.66406,-2.10937 0,-0.89843 0.22135,-1.60156 0.66406,-2.10938 0.44596,-0.5078 1.0612,-0.76171 1.8457,-0.76171"
style="font-size:10px"
id="path3128" />
<path
d="m 233.66771,458.21671 c -0.10092,-0.0586 -0.21159,-0.10091 -0.33203,-0.12696 -0.11719,-0.0293 -0.2474,-0.0439 -0.39063,-0.0439 -0.50781,0 -0.89844,0.16602 -1.17187,0.49804 -0.27019,0.32878 -0.40528,0.80242 -0.40528,1.4209 l 0,2.88086 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.1888,-0.33203 0.43457,-0.57779 0.73731,-0.7373 0.30273,-0.16276 0.67057,-0.24414 1.10351,-0.24414 0.0618,0 0.13021,0.005 0.20508,0.0146 0.0749,0.007 0.15788,0.0179 0.24903,0.0342 l 0.005,0.92286"
style="font-size:10px"
id="path3130" />
<path
d="m 234.61986,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
style="font-size:10px"
id="path3132" />
<path
d="m 240.99193,460.04776 c -1e-5,-0.65104 -0.1351,-1.15559 -0.40528,-1.51367 -0.26693,-0.35807 -0.6429,-0.53711 -1.12793,-0.53711 -0.48177,0 -0.85774,0.17904 -1.12792,0.53711 -0.26693,0.35808 -0.4004,0.86263 -0.4004,1.51367 0,0.64779 0.13347,1.15072 0.4004,1.50879 0.27018,0.35807 0.64615,0.53711 1.12792,0.53711 0.48503,0 0.861,-0.17904 1.12793,-0.53711 0.27018,-0.35807 0.40527,-0.861 0.40528,-1.50879 m 0.89844,2.11914 c -1e-5,0.93099 -0.20672,1.62272 -0.62012,2.0752 -0.41342,0.45572 -1.04655,0.68359 -1.89942,0.68359 -0.31575,0 -0.6136,-0.0244 -0.89355,-0.0732 -0.27995,-0.0456 -0.55176,-0.11719 -0.81543,-0.21485 l 0,-0.87402 c 0.26367,0.14323 0.52409,0.24902 0.78125,0.31738 0.25716,0.0684 0.5192,0.10254 0.78613,0.10254 0.58919,0 1.03027,-0.15462 1.32324,-0.46386 0.29297,-0.306 0.43945,-0.76986 0.43946,-1.39161 l 0,-0.44433 c -0.18555,0.32226 -0.42318,0.56315 -0.71289,0.72265 -0.28972,0.15951 -0.6364,0.23926 -1.04004,0.23926 -0.67058,0 -1.21094,-0.25553 -1.6211,-0.7666 -0.41015,-0.51107 -0.61523,-1.18815 -0.61523,-2.03125 0,-0.84635 0.20508,-1.52506 0.61523,-2.03613 0.41016,-0.51107 0.95052,-0.7666 1.6211,-0.7666 0.40364,0 0.75032,0.0797 1.04004,0.23925 0.28971,0.15951 0.52734,0.4004 0.71289,0.72266 l 0,-0.83008 0.89844,0 0,4.79004"
style="font-size:10px"
id="path3134" />
<path
d="m 243.74095,457.37686 0.89844,0 0,5.46875 -0.89844,0 0,-5.46875 m 0,-2.1289 0.89844,0 0,1.13769 -0.89844,0 0,-1.13769"
style="font-size:10px"
id="path3136" />
<path
d="m 251.06029,459.54483 0,3.30078 -0.89844,0 0,-3.27148 c 0,-0.51758 -0.10092,-0.90495 -0.30273,-1.16211 -0.20183,-0.25716 -0.50457,-0.38574 -0.90821,-0.38574 -0.48503,0 -0.86751,0.15462 -1.14746,0.46386 -0.27995,0.30925 -0.41992,0.7308 -0.41992,1.26465 l 0,3.09082 -0.90332,0 0,-5.46875 0.90332,0 0,0.84961 c 0.21484,-0.32877 0.46712,-0.57454 0.75684,-0.7373 0.29296,-0.16276 0.62988,-0.24414 1.01074,-0.24414 0.62825,0 1.10351,0.19531 1.42578,0.58593 0.32226,0.38738 0.48339,0.95867 0.4834,1.71387"
style="font-size:10px"
id="path3138" />
</g>
<g <g
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
id="text3017"> id="text3017">
@ -868,5 +800,78 @@
style="font-size:5px" style="font-size:5px"
id="path3161" /> id="path3161" />
</g> </g>
<g
aria-label="Content area origin"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
id="text4089">
<path
d="m 172.21587,456.09125 v 1.04004 q -0.49805,-0.46387 -1.06446,-0.69336 -0.56152,-0.22949 -1.19629,-0.22949 -1.25,0 -1.91406,0.7666 -0.66406,0.76172 -0.66406,2.20703 0,1.44043 0.66406,2.20703 0.66406,0.76172 1.91406,0.76172 0.63477,0 1.19629,-0.22949 0.56641,-0.2295 1.06446,-0.69336 v 1.03027 q -0.51758,0.35156 -1.09864,0.52734 -0.57617,0.17578 -1.2207,0.17578 -1.65527,0 -2.60742,-1.01074 -0.95215,-1.01562 -0.95215,-2.76855 0,-1.75781 0.95215,-2.76856 0.95215,-1.01562 2.60742,-1.01562 0.6543,0 1.23047,0.17578 0.58105,0.1709 1.08887,0.51758 z"
style="font-size:10px"
id="path4091" />
<path
d="m 175.82915,457.9809 q -0.72266,0 -1.14258,0.5664 -0.41992,0.56153 -0.41992,1.54297 0,0.98145 0.41504,1.54785 0.41992,0.56153 1.14746,0.56153 0.71777,0 1.13769,-0.56641 0.41992,-0.56641 0.41992,-1.54297 0,-0.97168 -0.41992,-1.53808 -0.41992,-0.57129 -1.13769,-0.57129 z m 0,-0.76172 q 1.17187,0 1.84082,0.76172 0.66894,0.76171 0.66894,2.10937 0,1.34277 -0.66894,2.10938 -0.66895,0.76171 -1.84082,0.76171 -1.17676,0 -1.84571,-0.76171 -0.66406,-0.76661 -0.66406,-2.10938 0,-1.34766 0.66406,-2.10937 0.66895,-0.76172 1.84571,-0.76172 z"
style="font-size:10px"
id="path4093" />
<path
d="m 184.36919,459.51898 v 3.30078 h -0.89844 v -3.27148 q 0,-0.77637 -0.30274,-1.16211 -0.30273,-0.38574 -0.9082,-0.38574 -0.72754,0 -1.14746,0.46386 -0.41992,0.46387 -0.41992,1.26465 v 3.09082 h -0.90332 v -5.46875 h 0.90332 v 0.84961 q 0.32226,-0.49316 0.75683,-0.7373 0.43946,-0.24414 1.01075,-0.24414 0.94238,0 1.42578,0.58593 0.4834,0.58106 0.4834,1.71387 z"
style="font-size:10px"
id="path4095" />
<path
d="m 187.05962,455.79828 v 1.55273 h 1.85058 v 0.69825 h -1.85058 v 2.96875 q 0,0.66894 0.18066,0.85937 0.18555,0.19043 0.74707,0.19043 h 0.92285 v 0.75195 h -0.92285 q -1.04004,0 -1.43555,-0.38574 -0.3955,-0.39062 -0.3955,-1.41601 v -2.96875 h -0.65918 v -0.69825 h 0.65918 v -1.55273 z"
style="font-size:10px"
id="path4097" />
<path
d="m 194.77446,459.86078 v 0.43945 h -4.13086 q 0.0586,0.92774 0.55664,1.41602 0.50293,0.4834 1.39649,0.4834 0.51757,0 1.00097,-0.12696 0.48828,-0.12695 0.9668,-0.38086 v 0.84961 q -0.4834,0.20508 -0.99121,0.3125 -0.50781,0.10742 -1.03028,0.10742 -1.30859,0 -2.07519,-0.76171 -0.76172,-0.76172 -0.76172,-2.06055 0,-1.34277 0.72266,-2.12891 0.72754,-0.79101 1.958,-0.79101 1.10352,0 1.74317,0.71289 0.64453,0.70801 0.64453,1.92871 z m -0.89844,-0.26367 q -0.01,-0.73731 -0.41504,-1.17676 -0.40039,-0.43945 -1.06445,-0.43945 -0.75195,0 -1.20605,0.4248 -0.44922,0.42481 -0.51758,1.19629 z"
style="font-size:10px"
id="path4099" />
<path
d="m 200.79497,459.51898 v 3.30078 h -0.89844 v -3.27148 q 0,-0.77637 -0.30273,-1.16211 -0.30274,-0.38574 -0.90821,-0.38574 -0.72754,0 -1.14746,0.46386 -0.41992,0.46387 -0.41992,1.26465 v 3.09082 h -0.90332 v -5.46875 h 0.90332 v 0.84961 q 0.32227,-0.49316 0.75684,-0.7373 0.43945,-0.24414 1.01074,-0.24414 0.94238,0 1.42578,0.58593 0.4834,0.58106 0.4834,1.71387 z"
style="font-size:10px"
id="path4101" />
<path
d="m 203.4854,455.79828 v 1.55273 h 1.85058 v 0.69825 h -1.85058 v 2.96875 q 0,0.66894 0.18066,0.85937 0.18555,0.19043 0.74707,0.19043 h 0.92285 v 0.75195 h -0.92285 q -1.04004,0 -1.43555,-0.38574 -0.3955,-0.39062 -0.3955,-1.41601 v -2.96875 h -0.65918 v -0.69825 h 0.65918 v -1.55273 z"
style="font-size:10px"
id="path4103" />
<path
d="m 212.19145,460.07074 q -1.08887,0 -1.50879,0.24902 -0.41992,0.24903 -0.41992,0.84961 0,0.47852 0.3125,0.76172 0.31738,0.27832 0.85938,0.27832 0.74707,0 1.19629,-0.52734 0.4541,-0.53223 0.4541,-1.41113 v -0.2002 z m 1.79199,-0.37109 v 3.12011 h -0.89843 v -0.83007 q -0.30762,0.49804 -0.7666,0.7373 -0.45899,0.23437 -1.12305,0.23437 -0.83985,0 -1.33789,-0.46875 -0.49317,-0.47363 -0.49317,-1.26464 0,-0.92286 0.61524,-1.39161 0.62012,-0.46875 1.8457,-0.46875 h 1.25977 v -0.0879 q 0,-0.62011 -0.41016,-0.95703 -0.40527,-0.34179 -1.14258,-0.34179 -0.46875,0 -0.91308,0.1123 -0.44434,0.11231 -0.8545,0.33691 v -0.83007 q 0.49317,-0.19043 0.95704,-0.28321 0.46386,-0.0976 0.90332,-0.0976 1.18652,0 1.77246,0.61523 0.58593,0.61524 0.58593,1.86524 z"
style="font-size:10px"
id="path4105" />
<path
d="m 219.00786,458.19086 q -0.15137,-0.0879 -0.33203,-0.12696 -0.17578,-0.0439 -0.39063,-0.0439 -0.76172,0 -1.17187,0.49805 -0.40528,0.49316 -0.40528,1.42089 v 2.88086 h -0.90332 v -5.46875 h 0.90332 v 0.84961 q 0.28321,-0.49804 0.73731,-0.7373 0.4541,-0.24414 1.10351,-0.24414 0.0928,0 0.20508,0.0147 0.11231,0.01 0.24903,0.0342 z"
style="font-size:10px"
id="path4107" />
<path
d="m 224.4229,459.86078 v 0.43945 h -4.13086 q 0.0586,0.92774 0.55664,1.41602 0.50293,0.4834 1.39648,0.4834 0.51758,0 1.00098,-0.12696 0.48828,-0.12695 0.9668,-0.38086 v 0.84961 q -0.4834,0.20508 -0.99121,0.3125 -0.50782,0.10742 -1.03028,0.10742 -1.30859,0 -2.07519,-0.76171 -0.76172,-0.76172 -0.76172,-2.06055 0,-1.34277 0.72265,-2.12891 0.72754,-0.79101 1.95801,-0.79101 1.10352,0 1.74317,0.71289 0.64453,0.70801 0.64453,1.92871 z m -0.89844,-0.26367 q -0.01,-0.73731 -0.41504,-1.17676 -0.40039,-0.43945 -1.06445,-0.43945 -0.75196,0 -1.20606,0.4248 -0.44922,0.42481 -0.51758,1.19629 z"
style="font-size:10px"
id="path4109" />
<path
d="m 228.38286,460.07074 q -1.08887,0 -1.50879,0.24902 -0.41992,0.24903 -0.41992,0.84961 0,0.47852 0.3125,0.76172 0.31738,0.27832 0.85937,0.27832 0.74707,0 1.19629,-0.52734 0.4541,-0.53223 0.4541,-1.41113 v -0.2002 z m 1.79199,-0.37109 v 3.12011 h -0.89844 v -0.83007 q -0.30761,0.49804 -0.7666,0.7373 -0.45898,0.23437 -1.12305,0.23437 -0.83984,0 -1.33789,-0.46875 -0.49316,-0.47363 -0.49316,-1.26464 0,-0.92286 0.61523,-1.39161 0.62012,-0.46875 1.84571,-0.46875 h 1.25976 v -0.0879 q 0,-0.62011 -0.41015,-0.95703 -0.40528,-0.34179 -1.14258,-0.34179 -0.46875,0 -0.91309,0.1123 -0.44433,0.11231 -0.85449,0.33691 v -0.83007 q 0.49316,-0.19043 0.95703,-0.28321 0.46387,-0.0976 0.90332,-0.0976 1.18653,0 1.77246,0.61523 0.58594,0.61524 0.58594,1.86524 z"
style="font-size:10px"
id="path4111" />
<path
d="m 237.33305,457.9809 q -0.72265,0 -1.14257,0.5664 -0.41993,0.56153 -0.41993,1.54297 0,0.98145 0.41504,1.54785 0.41992,0.56153 1.14746,0.56153 0.71778,0 1.1377,-0.56641 0.41992,-0.56641 0.41992,-1.54297 0,-0.97168 -0.41992,-1.53808 -0.41992,-0.57129 -1.1377,-0.57129 z m 0,-0.76172 q 1.17188,0 1.84082,0.76172 0.66895,0.76171 0.66895,2.10937 0,1.34277 -0.66895,2.10938 -0.66894,0.76171 -1.84082,0.76171 -1.17675,0 -1.8457,-0.76171 -0.66406,-0.76661 -0.66406,-2.10938 0,-1.34766 0.66406,-2.10937 0.66895,-0.76172 1.8457,-0.76172 z"
style="font-size:10px"
id="path4113" />
<path
d="m 244.49614,458.19086 q -0.15137,-0.0879 -0.33203,-0.12696 -0.17578,-0.0439 -0.39063,-0.0439 -0.76172,0 -1.17187,0.49805 -0.40528,0.49316 -0.40528,1.42089 v 2.88086 h -0.90332 v -5.46875 h 0.90332 v 0.84961 q 0.28321,-0.49804 0.73731,-0.7373 0.4541,-0.24414 1.10352,-0.24414 0.0928,0 0.20507,0.0147 0.11231,0.01 0.24903,0.0342 z"
style="font-size:10px"
id="path4115" />
<path
d="m 245.44829,457.35101 h 0.89844 v 5.46875 h -0.89844 z m 0,-2.1289 h 0.89844 v 1.13769 h -0.89844 z"
style="font-size:10px"
id="path4117" />
<path
d="m 251.82036,460.02191 q 0,-0.97656 -0.40528,-1.51367 -0.40039,-0.53711 -1.12792,-0.53711 -0.72266,0 -1.12793,0.53711 -0.4004,0.53711 -0.4004,1.51367 0,0.97168 0.4004,1.50879 0.40527,0.53711 1.12793,0.53711 0.72753,0 1.12792,-0.53711 0.40528,-0.53711 0.40528,-1.50879 z m 0.89844,2.11914 q 0,1.39649 -0.62012,2.0752 -0.62012,0.68359 -1.89942,0.68359 -0.47363,0 -0.89355,-0.0732 -0.41992,-0.0684 -0.81543,-0.21484 v -0.87403 q 0.39551,0.21485 0.78125,0.31738 0.38574,0.10254 0.78613,0.10254 0.88379,0 1.32325,-0.46386 0.43945,-0.45899 0.43945,-1.3916 v -0.44434 q -0.27832,0.4834 -0.71289,0.72266 -0.43457,0.23925 -1.04004,0.23925 -1.00586,0 -1.6211,-0.7666 -0.61523,-0.7666 -0.61523,-2.03125 0,-1.26953 0.61523,-2.03613 0.61524,-0.7666 1.6211,-0.7666 0.60547,0 1.04004,0.23926 0.43457,0.23925 0.71289,0.72265 v -0.83008 h 0.89844 z"
style="font-size:10px"
id="path4119" />
<path
d="m 254.56938,457.35101 h 0.89844 v 5.46875 h -0.89844 z m 0,-2.1289 h 0.89844 v 1.13769 h -0.89844 z"
style="font-size:10px"
id="path4121" />
<path
d="m 261.88872,459.51898 v 3.30078 h -0.89844 v -3.27148 q 0,-0.77637 -0.30273,-1.16211 -0.30274,-0.38574 -0.90821,-0.38574 -0.72754,0 -1.14746,0.46386 -0.41992,0.46387 -0.41992,1.26465 v 3.09082 h -0.90332 v -5.46875 h 0.90332 v 0.84961 q 0.32227,-0.49316 0.75684,-0.7373 0.43945,-0.24414 1.01074,-0.24414 0.94238,0 1.42578,0.58593 0.4834,0.58106 0.4834,1.71387 z"
style="font-size:10px"
id="path4123" />
</g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -14,10 +14,6 @@ To develop for Vulkan you should download the [LunarG Vulkan
SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link
libraries, they also provide the validation layers necessary for development. libraries, they also provide the validation layers necessary for development.
The GLFW library does not need the Vulkan SDK to enable support for Vulkan.
However, any Vulkan-specific test and example programs are built only if the
CMake files find a Vulkan SDK.
For details on a specific function in this category, see the @ref vulkan. There For details on a specific function in this category, see the @ref vulkan. There
are also guides for the other areas of the GLFW API. are also guides for the other areas of the GLFW API.
@ -37,20 +33,14 @@ not need to be linked against the loader. However, it also means that if you
are using the static library form of the Vulkan loader GLFW will either fail to are using the static library form of the Vulkan loader GLFW will either fail to
find it or (worse) use the wrong one. find it or (worse) use the wrong one.
The @ref GLFW_VULKAN_STATIC CMake option makes GLFW link directly against the The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader
static library form. Not linking against the Vulkan loader will then be directly instead of dynamically loading it at runtime. Not linking against the
a compile-time error. Vulkan loader will then be a compile-time error.
@macos Because the Vulkan loader and ICD are not installed globally on macOS, @macos Because the Vulkan loader and ICD are not installed globally on macOS,
you need to set up the application bundle according to the LunarG SDK you need to set up the application bundle according to the LunarG SDK
documentation. To help the GLFW CMake files find the SDK, you can set the documentation. This is explained in more detail in the
`VULKAN_SDK` environment variable to the `macOS` subdirectory of the SDK. [SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
@code{.sh}
env VULKAN_SDK=/example/path/to/vulkansdk/macOS cmake .
@endcode
This is explained in more detail in the LunarG Vulkan SDK release notes.
@section vulkan_include Including the Vulkan and GLFW header files @section vulkan_include Including the Vulkan and GLFW header files

View File

@ -68,9 +68,9 @@ set for the chosen monitor as long as the window has input focus. For more
information about retrieving video modes, see @ref monitor_modes. information about retrieving video modes, see @ref monitor_modes.
Video mode field | Corresponds to Video mode field | Corresponds to
----------------------- | ------------------------ ---------------- | --------------
GLFWvidmode.width | `width` parameter GLFWvidmode.width | `width` parameter of @ref glfwCreateWindow
GLFWvidmode.height | `height` parameter GLFWvidmode.height | `height` parameter of @ref glfwCreateWindow
GLFWvidmode.redBits | @ref GLFW_RED_BITS hint GLFWvidmode.redBits | @ref GLFW_RED_BITS hint
GLFWvidmode.greenBits | @ref GLFW_GREEN_BITS hint GLFWvidmode.greenBits | @ref GLFW_GREEN_BITS hint
GLFWvidmode.blueBits | @ref GLFW_BLUE_BITS hint GLFWvidmode.blueBits | @ref GLFW_BLUE_BITS hint
@ -483,8 +483,8 @@ should also declare this in its `Info.plist` by setting the
@subsubsection window_hints_x11 X11 specific window hints @subsubsection window_hints_x11 X11 specific window hints
@anchor GLFW_X11_CLASS_NAME @anchor GLFW_X11_CLASS_NAME_hint
@anchor GLFW_X11_INSTANCE_NAME @anchor GLFW_X11_INSTANCE_NAME_hint
__GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired __GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired
ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property.
These are set with @ref glfwWindowHintString. These are set with @ref glfwWindowHintString.
@ -599,7 +599,7 @@ void window_close_callback(GLFWwindow* window)
The size of a window can be changed with @ref glfwSetWindowSize. For windowed The size of a window can be changed with @ref glfwSetWindowSize. For windowed
mode windows, this sets the size, in mode windows, this sets the size, in
[screen coordinates](@ref coordinate_systems) of the _client area_ or _content [screen coordinates](@ref coordinate_systems) of the _content area_ or _content
area_ of the window. The window system may impose limits on window size. area_ of the window. The window system may impose limits on window size.
@code @code
@ -619,7 +619,7 @@ glfwSetWindowSizeCallback(window, window_size_callback);
@endcode @endcode
The callback function receives the new size, in screen coordinates, of the The callback function receives the new size, in screen coordinates, of the
client area of the window when the window is resized. content area of the window when the window is resized.
@code @code
void window_size_callback(GLFWwindow* window, int width, int height) void window_size_callback(GLFWwindow* window, int width, int height)
@ -640,9 +640,9 @@ calls. The window size is in screen coordinates, not pixels. Use the
[framebuffer size](@ref window_fbsize), which is in pixels, for pixel-based [framebuffer size](@ref window_fbsize), which is in pixels, for pixel-based
calls. calls.
The above functions work with the size of the client area, but decorated windows The above functions work with the size of the content area, but decorated
typically have title bars and window frames around this rectangle. You can windows typically have title bars and window frames around this rectangle. You
retrieve the extents of these with @ref glfwGetWindowFrameSize. can retrieve the extents of these with @ref glfwGetWindowFrameSize.
@code @code
int left, top, right, bottom; int left, top, right, bottom;
@ -650,7 +650,7 @@ glfwGetWindowFrameSize(window, &left, &top, &right, &bottom);
@endcode @endcode
The returned values are the distances, in screen coordinates, from the edges of The returned values are the distances, in screen coordinates, from the edges of
the client area to the corresponding edges of the full window. As they are the content area to the corresponding edges of the full window. As they are
distances and not coordinates, they are always zero or positive. distances and not coordinates, they are always zero or positive.
@ -702,10 +702,12 @@ float xscale, yscale;
glfwGetWindowContentScale(window, &xscale, &yscale); glfwGetWindowContentScale(window, &xscale, &yscale);
@endcode @endcode
The content scale of a window is the ratio between the current DPI and the The content scale is the ratio between the current DPI and the platform's
platform's default DPI. If you scale all pixel dimensions by this scale then default DPI. This is especially important for text and any UI elements. If the
your content should appear at an appropriate size. This is especially important pixel dimensions of your UI scaled by this look appropriate on your machine then
for text and any UI elements. it should appear at a reasonable size on other machines regardless of their DPI
and scaling settings. This relies on the system DPI and scaling settings being
somewhat correct.
On systems where each monitors can have its own content scale, the window On systems where each monitors can have its own content scale, the window
content scale will depend on which monitor the system considers the window to be content scale will depend on which monitor the system considers the window to be
@ -737,10 +739,10 @@ GLFW_SCALE_TO_MONITOR window hint.
@subsection window_sizelimits Window size limits @subsection window_sizelimits Window size limits
The minimum and maximum size of the client area of a windowed mode window can be The minimum and maximum size of the content area of a windowed mode window can
enforced with @ref glfwSetWindowSizeLimits. The user may resize the window to be enforced with @ref glfwSetWindowSizeLimits. The user may resize the window
any size and aspect ratio within the specified limits, unless the aspect ratio to any size and aspect ratio within the specified limits, unless the aspect
is also set. ratio is also set.
@code @code
glfwSetWindowSizeLimits(window, 200, 200, 400, 400); glfwSetWindowSizeLimits(window, 200, 200, 400, 400);
@ -755,7 +757,7 @@ glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE);
To disable size limits for a window, set them all to `GLFW_DONT_CARE`. To disable size limits for a window, set them all to `GLFW_DONT_CARE`.
The aspect ratio of the client area of a windowed mode window can be enforced The aspect ratio of the content area of a windowed mode window can be enforced
with @ref glfwSetWindowAspectRatio. The user may resize the window freely with @ref glfwSetWindowAspectRatio. The user may resize the window freely
unless size limits are also set, but the size will be constrained to maintain unless size limits are also set, but the size will be constrained to maintain
the aspect ratio. the aspect ratio.
@ -785,7 +787,7 @@ are undefined if they conflict.
The position of a windowed-mode window can be changed with @ref 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 glfwSetWindowPos. This moves the window so that the upper-left corner of its
client area has the specified [screen coordinates](@ref coordinate_systems). content area has the specified [screen coordinates](@ref coordinate_systems).
The window system may put limitations on window placement. The window system may put limitations on window placement.
@code @code
@ -800,7 +802,7 @@ glfwSetWindowPosCallback(window, window_pos_callback);
@endcode @endcode
The callback function receives the new position, in screen coordinates, of the The callback function receives the new position, in screen coordinates, of the
upper-left corner of the client area when the window is moved. upper-left corner of the content area when the window is moved.
@code @code
void window_pos_callback(GLFWwindow* window, int xpos, int ypos) void window_pos_callback(GLFWwindow* window, int xpos, int ypos)
@ -809,7 +811,7 @@ void window_pos_callback(GLFWwindow* window, int xpos, int ypos)
@endcode @endcode
There is also @ref glfwGetWindowPos for directly retrieving the current position There is also @ref glfwGetWindowPos for directly retrieving the current position
of the client area of the window. of the content area of the window.
@code @code
int xpos, ypos; int xpos, ypos;
@ -928,7 +930,7 @@ When a full screen window is restored, the desired video mode is restored to its
monitor as well. monitor as well.
If you wish to be notified when a window is iconified or restored, whether by If you wish to be notified when a window is iconified or restored, whether by
the user, system or your own code, set a iconify callback. the user, system or your own code, set an iconify callback.
@code @code
glfwSetWindowIconifyCallback(window, window_iconify_callback); glfwSetWindowIconifyCallback(window, window_iconify_callback);
@ -1249,8 +1251,8 @@ __GLFW_MAXIMIZED__ indicates whether the specified window is maximized. See
@anchor GLFW_HOVERED_attrib @anchor GLFW_HOVERED_attrib
__GLFW_HOVERED__ indicates whether the cursor is currently directly over the __GLFW_HOVERED__ indicates whether the cursor is currently directly over the
client area of the window, with no other windows between. See @ref cursor_enter content area of the window, with no other windows between. See @ref
for details. cursor_enter for details.
@anchor GLFW_VISIBLE_attrib @anchor GLFW_VISIBLE_attrib
__GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref __GLFW_VISIBLE__ indicates whether the specified window is visible. See @ref
@ -1330,6 +1332,21 @@ unknown or the context is an OpenGL ES context. Note that the returned profile
may not match the profile bits of the context flags, as GLFW will try other 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. means of detecting the profile when no bits are set.
@anchor GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib
__GLFW_CONTEXT_RELEASE_BEHAVIOR__ indicates the release used by the context.
Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`,
`GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the
behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context
creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`,
the pipeline will be flushed whenever the context is released from being the
current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will
not be flushed on release.
@anchor GLFW_CONTEXT_NO_ERROR_attrib
__GLFW_CONTEXT_NO_ERROR__ indicates whether errors are generated by the context.
Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, situations that
would have generated errors instead cause undefined behavior.
@anchor GLFW_CONTEXT_ROBUSTNESS_attrib @anchor GLFW_CONTEXT_ROBUSTNESS_attrib
__GLFW_CONTEXT_ROBUSTNESS__ indicates the robustness strategy used by the __GLFW_CONTEXT_ROBUSTNESS__ indicates the robustness strategy used by the
context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or `GLFW_NO_RESET_NOTIFICATION` context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or `GLFW_NO_RESET_NOTIFICATION`

View File

@ -23,29 +23,29 @@ elseif (APPLE)
MACOSX_PACKAGE_LOCATION "Resources") MACOSX_PACKAGE_LOCATION "Resources")
endif() endif()
set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h" set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
"${GLFW_SOURCE_DIR}/deps/glad.c") "${GLFW_SOURCE_DIR}/deps/glad_gl.c")
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
"${GLFW_SOURCE_DIR}/deps/getopt.c") "${GLFW_SOURCE_DIR}/deps/getopt.c")
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
"${GLFW_SOURCE_DIR}/deps/tinycthread.c") "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD}) add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL})
add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD}) add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL})
add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD}) add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL})
add_executable(offscreen offscreen.c ${ICON} ${GLAD}) add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD}) add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL})
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD}) add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL})
add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD}) add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL})
add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD}) add_executable(triangle-opengl WIN32 MACOSX_BUNDLE triangle-opengl.c ${ICON} ${GLAD_GL})
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD}) add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}") target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}")
if (RT_LIBRARY) if (RT_LIBRARY)
target_link_libraries(particles "${RT_LIBRARY}") target_link_libraries(particles "${RT_LIBRARY}")
endif() endif()
set(WINDOWS_BINARIES boing gears heightmap particles sharing simple splitview wave) set(WINDOWS_BINARIES boing gears heightmap particles sharing splitview triangle-opengl wave)
set(CONSOLE_BINARIES offscreen) set(CONSOLE_BINARIES offscreen)
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
@ -63,14 +63,14 @@ if (APPLE)
set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap") set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles") set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
set_target_properties(simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple") set_target_properties(triangle-opengl PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "OpenGL Triangle")
set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView") set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave") set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
set_target_properties(${WINDOWS_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} PROPERTIES
RESOURCE glfw.icns RESOURCE glfw.icns
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL} MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
MACOSX_BUNDLE_ICON_FILE glfw.icns MACOSX_BUNDLE_ICON_FILE glfw.icns
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
endif() endif()

View File

@ -36,7 +36,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <linmath.h> #include <linmath.h>
@ -165,7 +166,7 @@ void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n )
v2 = c.y - a.y; v2 = c.y - a.y;
v3 = c.z - a.z; v3 = c.z - a.z;
n->x = u2 * v3 - v2 * v3; n->x = u2 * v3 - v2 * u3;
n->y = u3 * v1 - v3 * u1; n->y = u3 * v1 - v3 * u1;
n->z = u1 * v2 - v1 * u2; n->z = u1 * v2 - v1 * u2;
} }
@ -302,7 +303,7 @@ void cursor_position_callback( GLFWwindow* window, double x, double y )
* The Boing ball is sphere in which each facet is a rectangle. * The Boing ball is sphere in which each facet is a rectangle.
* Facet colors alternate between red and white. * Facet colors alternate between red and white.
* The ball is built by stacking latitudinal circles. Each circle is composed * The ball is built by stacking latitudinal circles. Each circle is composed
* of a widely-separated set of points, so that each facet is noticably large. * of a widely-separated set of points, so that each facet is noticeably large.
*****************************************************************************/ *****************************************************************************/
void DrawBoingBall( void ) void DrawBoingBall( void )
{ {
@ -446,7 +447,7 @@ void DrawBoingBallBand( GLfloat long_lo,
static int colorToggle = 0; static int colorToggle = 0;
/* /*
* Iterate thru the points of a latitude circle. * Iterate through the points of a latitude circle.
* A latitude circle is a 2D set of X,Z points. * A latitude circle is a 2D set of X,Z points.
*/ */
for ( lat_deg = 0; for ( lat_deg = 0;
@ -642,7 +643,7 @@ int main( void )
glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetCursorPosCallback(window, cursor_position_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
glfwSwapInterval( 1 ); glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

View File

@ -31,7 +31,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
/** /**
@ -327,7 +328,7 @@ int main(int argc, char *argv[])
glfwSetKeyCallback(window, key); glfwSetKeyCallback(window, key);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
glfwSwapInterval( 1 ); glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

View File

@ -29,7 +29,8 @@
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
/* Map height updates */ /* Map height updates */
@ -432,7 +433,7 @@ int main(int argc, char** argv)
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
/* Prepare opengl resources for rendering */ /* Prepare opengl resources for rendering */
shader_program = make_shader_program(vertex_shader_text, fragment_shader_text); shader_program = make_shader_program(vertex_shader_text, fragment_shader_text);

View File

@ -23,7 +23,8 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#if USE_NATIVE_OSMESA #if USE_NATIVE_OSMESA
@ -104,7 +105,7 @@ int main(void)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
// NOTE: OpenGL error checks have been omitted for brevity // NOTE: OpenGL error checks have been omitted for brevity

View File

@ -39,7 +39,8 @@
#include <getopt.h> #include <getopt.h>
#include <linmath.h> #include <linmath.h>
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
// Define tokens for GL_EXT_separate_specular_color if not already defined // Define tokens for GL_EXT_separate_specular_color if not already defined
@ -994,7 +995,7 @@ int main(int argc, char** argv)
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, resize_callback); glfwSetFramebufferSizeCallback(window, resize_callback);

View File

@ -23,7 +23,8 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -103,7 +104,7 @@ int main(int argc, char** argv)
// The contexts are created with the same APIs so the function // The contexts are created with the same APIs so the function
// pointers should be re-usable between them // pointers should be re-usable between them
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
// Create the OpenGL objects inside the first context, created above // Create the OpenGL objects inside the first context, created above
// All objects will be shared with the second context, created below // All objects will be shared with the second context, created below

View File

@ -10,7 +10,8 @@
// because I am not a friend of orthogonal projections) // because I am not a friend of orthogonal projections)
//======================================================================== //========================================================================
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#if defined(_MSC_VER) #if defined(_MSC_VER)
@ -513,7 +514,7 @@ int main(void)
// Enable vsync // Enable vsync
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3) if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3)

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// Simple GLFW example // OpenGL triangle example
// Copyright (c) Camilla Löwy <elmindreda@glfw.org> // Copyright (c) Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
@ -24,31 +24,35 @@
//======================================================================== //========================================================================
//! [code] //! [code]
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include "linmath.h" #include "linmath.h"
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h>
#include <stdio.h> #include <stdio.h>
static const struct typedef struct Vertex
{ {
float x, y; vec2 pos;
float r, g, b; vec3 col;
} vertices[3] = } Vertex;
static const Vertex vertices[3] =
{ {
{ -0.6f, -0.4f, 1.f, 0.f, 0.f }, { { -0.6f, -0.4f }, { 1.f, 0.f, 0.f } },
{ 0.6f, -0.4f, 0.f, 1.f, 0.f }, { { 0.6f, -0.4f }, { 0.f, 1.f, 0.f } },
{ 0.f, 0.6f, 0.f, 0.f, 1.f } { { 0.f, 0.6f }, { 0.f, 0.f, 1.f } }
}; };
static const char* vertex_shader_text = static const char* vertex_shader_text =
"#version 110\n" "#version 330\n"
"uniform mat4 MVP;\n" "uniform mat4 MVP;\n"
"attribute vec3 vCol;\n" "in vec3 vCol;\n"
"attribute vec2 vPos;\n" "in vec2 vPos;\n"
"varying vec3 color;\n" "out vec3 color;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n" " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
@ -56,11 +60,12 @@ static const char* vertex_shader_text =
"}\n"; "}\n";
static const char* fragment_shader_text = static const char* fragment_shader_text =
"#version 110\n" "#version 330\n"
"varying vec3 color;\n" "in vec3 color;\n"
"out vec4 fragment;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" gl_FragColor = vec4(color, 1.0);\n" " fragment = vec4(color, 1.0);\n"
"}\n"; "}\n";
static void error_callback(int error, const char* description) static void error_callback(int error, const char* description)
@ -76,19 +81,16 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
int main(void) int main(void)
{ {
GLFWwindow* window;
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
GLint mvp_location, vpos_location, vcol_location;
glfwSetErrorCallback(error_callback); glfwSetErrorCallback(error_callback);
if (!glfwInit()) if (!glfwInit())
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); GLFWwindow* window = glfwCreateWindow(640, 480, "OpenGL Triangle", NULL, NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();
@ -98,58 +100,61 @@ int main(void)
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
// NOTE: OpenGL error checks have been omitted for brevity // NOTE: OpenGL error checks have been omitted for brevity
GLuint vertex_buffer;
glGenBuffers(1, &vertex_buffer); glGenBuffers(1, &vertex_buffer);
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
vertex_shader = glCreateShader(GL_VERTEX_SHADER); const GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL); glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);
glCompileShader(vertex_shader); glCompileShader(vertex_shader);
fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); const GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL); glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);
glCompileShader(fragment_shader); glCompileShader(fragment_shader);
program = glCreateProgram(); const GLuint program = glCreateProgram();
glAttachShader(program, vertex_shader); glAttachShader(program, vertex_shader);
glAttachShader(program, fragment_shader); glAttachShader(program, fragment_shader);
glLinkProgram(program); glLinkProgram(program);
mvp_location = glGetUniformLocation(program, "MVP"); const GLint mvp_location = glGetUniformLocation(program, "MVP");
vpos_location = glGetAttribLocation(program, "vPos"); const GLint vpos_location = glGetAttribLocation(program, "vPos");
vcol_location = glGetAttribLocation(program, "vCol"); const GLint vcol_location = glGetAttribLocation(program, "vCol");
GLuint vertex_array;
glGenVertexArrays(1, &vertex_array);
glBindVertexArray(vertex_array);
glEnableVertexAttribArray(vpos_location); glEnableVertexAttribArray(vpos_location);
glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE, glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
sizeof(vertices[0]), (void*) 0); sizeof(Vertex), (void*) offsetof(Vertex, pos));
glEnableVertexAttribArray(vcol_location); glEnableVertexAttribArray(vcol_location);
glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE, glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
sizeof(vertices[0]), (void*) (sizeof(float) * 2)); sizeof(Vertex), (void*) offsetof(Vertex, col));
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
{ {
float ratio;
int width, height; int width, height;
mat4x4 m, p, mvp;
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);
ratio = width / (float) height; const float ratio = width / (float) height;
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
mat4x4 m, p, mvp;
mat4x4_identity(m); mat4x4_identity(m);
mat4x4_rotate_Z(m, m, (float) glfwGetTime()); mat4x4_rotate_Z(m, m, (float) glfwGetTime());
mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f); mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
mat4x4_mul(mvp, p, m); mat4x4_mul(mvp, p, m);
glUseProgram(program); glUseProgram(program);
glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) &mvp);
glBindVertexArray(vertex_array);
glDrawArrays(GL_TRIANGLES, 0, 3); glDrawArrays(GL_TRIANGLES, 0, 3);
glfwSwapBuffers(window); glfwSwapBuffers(window);

View File

@ -17,7 +17,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <glad/glad.h> #include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <linmath.h> #include <linmath.h>
@ -412,7 +413,7 @@ int main(int argc, char* argv[])
glfwSetScrollCallback(window, scroll_callback); glfwSetScrollCallback(window, scroll_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
/************************************************************************* /*************************************************************************
* GLFW 3.3 - www.glfw.org * GLFW 3.4 - www.glfw.org
* A library for OpenGL, window and input * A library for OpenGL, window and input
*------------------------------------------------------------------------ *------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard * Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> * Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
* *
* This software is provided 'as-is', without any express or implied * This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages * warranty. In no event will the authors be held liable for any damages

View File

@ -79,7 +79,10 @@ endif()
# Make GCC and Clang warn about declarations that VS 2010 and 2012 won't accept # Make GCC and Clang warn about declarations that VS 2010 and 2012 won't accept
# for all source files that VS will build # for all source files that VS will build
if (${CMAKE_C_COMPILER_ID} STREQUAL GNU OR ${CMAKE_C_COMPILER_ID} STREQUAL Clang) if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
if (WIN32) if (WIN32)
set(windows_SOURCES ${glfw_SOURCES}) set(windows_SOURCES ${glfw_SOURCES})
else() else()
@ -92,7 +95,7 @@ endif()
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
set_target_properties(glfw PROPERTIES set_target_properties(glfw PROPERTIES
OUTPUT_NAME ${GLFW_LIB_NAME} OUTPUT_NAME ${GLFW_LIB_NAME}
VERSION ${GLFW_VERSION} VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
SOVERSION ${GLFW_VERSION_MAJOR} SOVERSION ${GLFW_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON POSITION_INDEPENDENT_CODE ON
FOLDER "GLFW3") FOLDER "GLFW3")
@ -100,7 +103,7 @@ set_target_properties(glfw PROPERTIES
target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H) target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
target_include_directories(glfw PUBLIC target_include_directories(glfw PUBLIC
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>" "$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>") "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_include_directories(glfw PRIVATE target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src" "${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src" "${GLFW_BINARY_DIR}/src"
@ -115,13 +118,14 @@ target_compile_definitions(glfw PRIVATE
# Enable a reasonable set of warnings (no, -Wextra is not reasonable) # Enable a reasonable set of warnings (no, -Wextra is not reasonable)
target_compile_options(glfw PRIVATE target_compile_options(glfw PRIVATE
"$<$<C_COMPILER_ID:AppleClang>:-Wall>"
"$<$<C_COMPILER_ID:Clang>:-Wall>" "$<$<C_COMPILER_ID:Clang>:-Wall>"
"$<$<C_COMPILER_ID:GNU>:-Wall>") "$<$<C_COMPILER_ID:GNU>:-Wall>")
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (WIN32) if (WIN32)
if (MINGW) if (MINGW)
# Remove the lib prefix on the DLL (but not the import library # Remove the lib prefix on the DLL (but not the import library)
set_target_properties(glfw PROPERTIES PREFIX "") set_target_properties(glfw PROPERTIES PREFIX "")
# Add a suffix to the import library to avoid naming conflicts # Add a suffix to the import library to avoid naming conflicts
@ -130,18 +134,21 @@ if (BUILD_SHARED_LIBS)
# Add a suffix to the import library to avoid naming conflicts # Add a suffix to the import library to avoid naming conflicts
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib") set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
endif() endif()
target_compile_definitions(glfw INTERFACE GLFW_DLL)
elseif (APPLE) elseif (APPLE)
# Add -fno-common to work around a bug in Apple's GCC # Add -fno-common to work around a bug in Apple's GCC
target_compile_options(glfw PRIVATE "-fno-common") target_compile_options(glfw PRIVATE "-fno-common")
set_target_properties(glfw PROPERTIES set_target_properties(glfw PROPERTIES
INSTALL_NAME_DIR "lib${LIB_SUFFIX}") INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
elseif (UNIX) endif()
if (UNIX)
# Hide symbols not explicitly tagged for export from the shared library # Hide symbols not explicitly tagged for export from the shared library
target_compile_options(glfw PRIVATE "-fvisibility=hidden") target_compile_options(glfw PRIVATE "-fvisibility=hidden")
endif() endif()
target_compile_definitions(glfw INTERFACE GLFW_DLL)
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES}) target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
else() else()
target_link_libraries(glfw INTERFACE ${glfw_LIBRARIES}) target_link_libraries(glfw INTERFACE ${glfw_LIBRARIES})
@ -155,7 +162,7 @@ if (GLFW_INSTALL)
install(TARGETS glfw install(TARGETS glfw
EXPORT glfwTargets EXPORT glfwTargets
RUNTIME DESTINATION "bin" RUNTIME DESTINATION "bin"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "lib${LIB_SUFFIX}") LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif() endif()

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 macOS - www.glfw.org // GLFW 3.4 macOS - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -23,10 +23,14 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
#include <sys/param.h> // For MAXPATHLEN #include <sys/param.h> // For MAXPATHLEN
// Needed for _NSGetProgname
#include <crt_externs.h>
// Change to our application bundle's resources directory, if present // Change to our application bundle's resources directory, if present
// //
@ -64,6 +68,111 @@ static void changeToResourcesDirectory(void)
chdir(resourcesPath); chdir(resourcesPath);
} }
// Set up the menu bar (manually)
// 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. Add a nib to save us this horror.
//
static void createMenuBar(void)
{
size_t i;
NSString* appName = nil;
NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
NSString* nameKeys[] =
{
@"CFBundleDisplayName",
@"CFBundleName",
@"CFBundleExecutable",
};
// Try to figure out what the calling application is called
for (i = 0; i < sizeof(nameKeys) / sizeof(nameKeys[0]); i++)
{
id name = bundleInfo[nameKeys[i]];
if (name &&
[name isKindOfClass:[NSString class]] &&
![name isEqualToString:@""])
{
appName = name;
break;
}
}
if (!appName)
{
char** progname = _NSGetProgname();
if (progname && *progname)
appName = @(*progname);
else
appName = @"GLFW Application";
}
NSMenu* bar = [[NSMenu alloc] init];
[NSApp setMainMenu:bar];
NSMenuItem* appMenuItem =
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
NSMenu* appMenu = [[NSMenu alloc] init];
[appMenuItem setSubmenu:appMenu];
[appMenu addItemWithTitle:[NSString stringWithFormat:@"About %@", appName]
action:@selector(orderFrontStandardAboutPanel:)
keyEquivalent:@""];
[appMenu addItem:[NSMenuItem separatorItem]];
NSMenu* servicesMenu = [[NSMenu alloc] init];
[NSApp setServicesMenu:servicesMenu];
[[appMenu addItemWithTitle:@"Services"
action:NULL
keyEquivalent:@""] setSubmenu:servicesMenu];
[servicesMenu release];
[appMenu addItem:[NSMenuItem separatorItem]];
[appMenu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", appName]
action:@selector(hide:)
keyEquivalent:@"h"];
[[appMenu addItemWithTitle:@"Hide Others"
action:@selector(hideOtherApplications:)
keyEquivalent:@"h"]
setKeyEquivalentModifierMask:NSEventModifierFlagOption | NSEventModifierFlagCommand];
[appMenu addItemWithTitle:@"Show All"
action:@selector(unhideAllApplications:)
keyEquivalent:@""];
[appMenu addItem:[NSMenuItem separatorItem]];
[appMenu addItemWithTitle:[NSString stringWithFormat:@"Quit %@", appName]
action:@selector(terminate:)
keyEquivalent:@"q"];
NSMenuItem* windowMenuItem =
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
[bar release];
NSMenu* windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
[NSApp setWindowsMenu:windowMenu];
[windowMenuItem setSubmenu:windowMenu];
[windowMenu addItemWithTitle:@"Minimize"
action:@selector(performMiniaturize:)
keyEquivalent:@"m"];
[windowMenu addItemWithTitle:@"Zoom"
action:@selector(performZoom:)
keyEquivalent:@""];
[windowMenu addItem:[NSMenuItem separatorItem]];
[windowMenu addItemWithTitle:@"Bring All to Front"
action:@selector(arrangeInFront:)
keyEquivalent:@""];
// TODO: Make this appear at the bottom of the menu (for consistency)
[windowMenu addItem:[NSMenuItem separatorItem]];
[[windowMenu addItemWithTitle:@"Enter Full Screen"
action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
// to get the application menu working properly.
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
[NSApp performSelector:setAppleMenuSelector withObject:appMenu];
}
// Create key code translation tables // Create key code translation tables
// //
static void createKeyTables(void) static void createKeyTables(void)
@ -271,18 +380,89 @@ static GLFWbool initializeTIS(void)
return updateUnicodeDataNS(); return updateUnicodeDataNS();
} }
@interface GLFWLayoutListener : NSObject @interface GLFWHelper : NSObject
@end @end
@implementation GLFWLayoutListener @implementation GLFWHelper
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object - (void)selectedKeyboardInputSourceChanged:(NSObject* )object
{ {
updateUnicodeDataNS(); updateUnicodeDataNS();
} }
- (void)doNothing:(id)object
{
}
@end // GLFWHelper
@interface GLFWApplicationDelegate : NSObject <NSApplicationDelegate>
@end @end
@implementation GLFWApplicationDelegate
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
_GLFWwindow* window;
for (window = _glfw.windowListHead; window; window = window->next)
_glfwInputWindowCloseRequest(window);
return NSTerminateCancel;
}
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
{
_GLFWwindow* window;
for (window = _glfw.windowListHead; window; window = window->next)
{
if (window->context.client != GLFW_NO_API)
[window->context.nsgl.object update];
}
_glfwPollMonitorsNS();
}
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
if (_glfw.hints.init.ns.menubar)
{
// In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
// Menu bar setup must go between sharedApplication above and
// finishLaunching below, in order to properly emulate the behavior
// of NSApplicationMain
if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"])
{
[[NSBundle mainBundle] loadNibNamed:@"MainMenu"
owner:NSApp
topLevelObjects:&_glfw.ns.nibObjects];
}
else
createMenuBar();
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
[NSApp stop:nil];
_glfwPlatformPostEmptyEvent();
}
- (void)applicationDidHide:(NSNotification *)notification
{
int i;
for (i = 0; i < _glfw.monitorCount; i++)
_glfwRestoreVideoModeNS(_glfw.monitors[i]);
}
@end // GLFWApplicationDelegate
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW platform API ////// ////// GLFW platform API //////
@ -290,14 +470,50 @@ static GLFWbool initializeTIS(void)
int _glfwPlatformInit(void) int _glfwPlatformInit(void)
{ {
_glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init]; @autoreleasepool {
_glfw.ns.helper = [[GLFWHelper alloc] init];
[NSThread detachNewThreadSelector:@selector(doNothing:)
toTarget:_glfw.ns.helper
withObject:nil];
if (NSApp)
_glfw.ns.finishedLaunching = GLFW_TRUE;
[NSApplication sharedApplication];
_glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init];
if (_glfw.ns.delegate == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to create application delegate");
return GLFW_FALSE;
}
[NSApp setDelegate:_glfw.ns.delegate];
NSEvent* (^block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
{
if ([event modifierFlags] & NSEventModifierFlagCommand)
[[NSApp keyWindow] sendEvent:event];
return event;
};
_glfw.ns.keyUpMonitor =
[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp
handler:block];
if (_glfw.hints.init.ns.chdir) if (_glfw.hints.init.ns.chdir)
changeToResourcesDirectory(); changeToResourcesDirectory();
_glfw.ns.listener = [[GLFWLayoutListener alloc] init]; // Press and Hold prevents some keys from emitting repeated characters
NSDictionary* defaults = @{@"ApplePressAndHoldEnabled":@NO};
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver:_glfw.ns.listener addObserver:_glfw.ns.helper
selector:@selector(selectedKeyboardInputSourceChanged:) selector:@selector(selectedKeyboardInputSourceChanged:)
name:NSTextInputContextKeyboardSelectionDidChangeNotification name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil]; object:nil];
@ -318,10 +534,14 @@ int _glfwPlatformInit(void)
_glfwPollMonitorsNS(); _glfwPollMonitorsNS();
return GLFW_TRUE; return GLFW_TRUE;
} // autoreleasepool
} }
void _glfwPlatformTerminate(void) void _glfwPlatformTerminate(void)
{ {
@autoreleasepool {
if (_glfw.ns.inputSource) if (_glfw.ns.inputSource)
{ {
CFRelease(_glfw.ns.inputSource); CFRelease(_glfw.ns.inputSource);
@ -342,30 +562,32 @@ void _glfwPlatformTerminate(void)
_glfw.ns.delegate = nil; _glfw.ns.delegate = nil;
} }
if (_glfw.ns.listener) if (_glfw.ns.helper)
{ {
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver:_glfw.ns.listener removeObserver:_glfw.ns.helper
name:NSTextInputContextKeyboardSelectionDidChangeNotification name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil]; object:nil];
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
removeObserver:_glfw.ns.listener]; removeObserver:_glfw.ns.helper];
[_glfw.ns.listener release]; [_glfw.ns.helper release];
_glfw.ns.listener = nil; _glfw.ns.helper = nil;
} }
if (_glfw.ns.keyUpMonitor)
[NSEvent removeMonitor:_glfw.ns.keyUpMonitor];
free(_glfw.ns.clipboardString); free(_glfw.ns.clipboardString);
_glfwTerminateNSGL(); _glfwTerminateNSGL();
_glfwTerminateJoysticksNS(); _glfwTerminateJoysticksNS();
[_glfw.ns.autoreleasePool release]; } // autoreleasepool
_glfw.ns.autoreleasePool = nil;
} }
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
return _GLFW_VERSION_NUMBER " Cocoa NSGL" return _GLFW_VERSION_NUMBER " Cocoa NSGL EGL OSMesa"
#if defined(_GLFW_BUILD_DLL) #if defined(_GLFW_BUILD_DLL)
" dynamic" " dynamic"
#endif #endif

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 Cocoa - www.glfw.org // GLFW 3.4 Cocoa - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 Cocoa - www.glfw.org // GLFW 3.4 Cocoa - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net> // Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -220,9 +222,31 @@ static void matchCallback(void* context,
case kHIDUsage_GD_Hatswitch: case kHIDUsage_GD_Hatswitch:
target = hats; target = hats;
break; break;
case kHIDUsage_GD_DPadUp:
case kHIDUsage_GD_DPadRight:
case kHIDUsage_GD_DPadDown:
case kHIDUsage_GD_DPadLeft:
case kHIDUsage_GD_SystemMainMenu:
case kHIDUsage_GD_Select:
case kHIDUsage_GD_Start:
target = buttons;
break;
} }
} }
else if (page == kHIDPage_Button) else if (page == kHIDPage_Simulation)
{
switch (usage)
{
case kHIDUsage_Sim_Accelerator:
case kHIDUsage_Sim_Brake:
case kHIDUsage_Sim_Throttle:
case kHIDUsage_Sim_Rudder:
case kHIDUsage_Sim_Steering:
target = axes;
break;
}
}
else if (page == kHIDPage_Button || page == kHIDPage_Consumer)
target = buttons; target = buttons;
if (target) if (target)
@ -397,12 +421,12 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
if (raw > axis->maximum) if (raw > axis->maximum)
axis->maximum = raw; axis->maximum = raw;
const long delta = axis->maximum - axis->minimum; const long size = axis->maximum - axis->minimum;
if (delta == 0) if (size == 0)
_glfwInputJoystickAxis(js, (int) i, 0.f); _glfwInputJoystickAxis(js, (int) i, 0.f);
else else
{ {
const float value = (2.f * (raw - axis->minimum) / delta) - 1.f; const float value = (2.f * (raw - axis->minimum) / size) - 1.f;
_glfwInputJoystickAxis(js, (int) i, value); _glfwInputJoystickAxis(js, (int) i, value);
} }
} }
@ -417,7 +441,8 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
_GLFWjoyelementNS* button = (_GLFWjoyelementNS*) _GLFWjoyelementNS* button = (_GLFWjoyelementNS*)
CFArrayGetValueAtIndex(js->ns.buttons, i); CFArrayGetValueAtIndex(js->ns.buttons, i);
const char value = getElementValue(js, button) - button->minimum; const char value = getElementValue(js, button) - button->minimum;
_glfwInputJoystickButton(js, (int) i, value); const int state = (value > 0) ? GLFW_PRESS : GLFW_RELEASE;
_glfwInputJoystickButton(js, (int) i, state);
} }
for (i = 0; i < CFArrayGetCount(js->ns.hats); i++) for (i = 0; i < CFArrayGetCount(js->ns.hats); i++)
@ -454,7 +479,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
(strncmp(guid + 20, "000000000000", 12) == 0)) (strncmp(guid + 20, "000000000000", 12) == 0))
{ {
char original[33]; char original[33];
strcpy(original, guid); strncpy(original, guid, sizeof(original) - 1);
sprintf(guid, "03000000%.4s0000%.4s000000000000", sprintf(guid, "03000000%.4s0000%.4s000000000000",
original, original + 16); original, original + 16);
} }

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 macOS - www.glfw.org // GLFW 3.4 macOS - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,15 +24,16 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <math.h>
#include <IOKit/graphics/IOGraphicsLib.h> #include <IOKit/graphics/IOGraphicsLib.h>
#include <CoreVideo/CVBase.h>
#include <CoreVideo/CVDisplayLink.h>
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
@ -148,7 +149,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
GLFWvidmode result; GLFWvidmode result;
result.width = (int) CGDisplayModeGetWidth(mode); result.width = (int) CGDisplayModeGetWidth(mode);
result.height = (int) CGDisplayModeGetHeight(mode); result.height = (int) CGDisplayModeGetHeight(mode);
result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode); result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode));
if (result.refreshRate == 0) if (result.refreshRate == 0)
{ {
@ -212,6 +213,31 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
} }
} }
// Finds and caches the NSScreen corresponding to the specified monitor
//
static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
{
if (monitor->ns.screen)
return GLFW_TRUE;
for (NSScreen* screen in [NSScreen screens])
{
NSNumber* displayID = [screen deviceDescription][@"NSScreenNumber"];
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
if (monitor->ns.unitNumber == CGDisplayUnitNumber([displayID unsignedIntValue]))
{
monitor->ns.screen = screen;
return GLFW_TRUE;
}
}
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find a screen for monitor");
return GLFW_FALSE;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW internal API ////// ////// GLFW internal API //////
@ -221,18 +247,16 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
// //
void _glfwPollMonitorsNS(void) void _glfwPollMonitorsNS(void)
{ {
uint32_t i, j, displayCount, disconnectedCount; uint32_t displayCount;
CGDirectDisplayID* displays;
_GLFWmonitor** disconnected = NULL;
CGGetOnlineDisplayList(0, NULL, &displayCount); CGGetOnlineDisplayList(0, NULL, &displayCount);
displays = calloc(displayCount, sizeof(CGDirectDisplayID)); CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID));
CGGetOnlineDisplayList(displayCount, displays, &displayCount); CGGetOnlineDisplayList(displayCount, displays, &displayCount);
for (i = 0; i < _glfw.monitorCount; i++) for (uint32_t i = 0; i < _glfw.monitorCount; i++)
_glfw.monitors[i]->ns.screen = nil; _glfw.monitors[i]->ns.screen = nil;
disconnectedCount = _glfw.monitorCount; _GLFWmonitor** disconnected = NULL;
uint32_t disconnectedCount = _glfw.monitorCount;
if (disconnectedCount) if (disconnectedCount)
{ {
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*)); disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
@ -241,19 +265,17 @@ void _glfwPollMonitorsNS(void)
_glfw.monitorCount * sizeof(_GLFWmonitor*)); _glfw.monitorCount * sizeof(_GLFWmonitor*));
} }
for (i = 0; i < displayCount; i++) for (uint32_t i = 0; i < displayCount; i++)
{ {
_GLFWmonitor* monitor;
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
if (CGDisplayIsAsleep(displays[i])) if (CGDisplayIsAsleep(displays[i]))
continue; continue;
for (j = 0; j < disconnectedCount; j++) // HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
for (uint32_t j = 0; j < disconnectedCount; j++)
{ {
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber) if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
{ {
disconnected[j] = NULL; disconnected[j] = NULL;
@ -266,7 +288,7 @@ void _glfwPollMonitorsNS(void)
if (!name) if (!name)
name = _glfw_strdup("Unknown"); name = _glfw_strdup("Unknown");
monitor = _glfwAllocMonitor(name, size.width, size.height); _GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
monitor->ns.displayID = displays[i]; monitor->ns.displayID = displays[i];
monitor->ns.unitNumber = unitNumber; monitor->ns.unitNumber = unitNumber;
@ -275,7 +297,7 @@ void _glfwPollMonitorsNS(void)
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
} }
for (i = 0; i < disconnectedCount; i++) for (uint32_t i = 0; i < disconnectedCount; i++)
{ {
if (disconnected[i]) if (disconnected[i])
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0); _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
@ -289,24 +311,21 @@ void _glfwPollMonitorsNS(void)
// //
void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired) void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired)
{ {
CFArrayRef modes;
CFIndex count, i;
CVDisplayLinkRef link;
CGDisplayModeRef native = NULL;
GLFWvidmode current; GLFWvidmode current;
const GLFWvidmode* best;
best = _glfwChooseVideoMode(monitor, desired);
_glfwPlatformGetVideoMode(monitor, &current); _glfwPlatformGetVideoMode(monitor, &current);
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
if (_glfwCompareVideoModes(&current, best) == 0) if (_glfwCompareVideoModes(&current, best) == 0)
return; return;
CVDisplayLinkRef link;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link); CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL); CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
count = CFArrayGetCount(modes); const CFIndex count = CFArrayGetCount(modes);
CGDisplayModeRef native = NULL;
for (i = 0; i < count; i++) for (CFIndex i = 0; i < count; i++)
{ {
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
if (!modeIsGood(dm)) if (!modeIsGood(dm))
@ -361,46 +380,25 @@ void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
{ {
@autoreleasepool {
const CGRect bounds = CGDisplayBounds(monitor->ns.displayID); const CGRect bounds = CGDisplayBounds(monitor->ns.displayID);
if (xpos) if (xpos)
*xpos = (int) bounds.origin.x; *xpos = (int) bounds.origin.x;
if (ypos) if (ypos)
*ypos = (int) bounds.origin.y; *ypos = (int) bounds.origin.y;
} // autoreleasepool
} }
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
float* xscale, float* yscale) float* xscale, float* yscale)
{ {
if (!monitor->ns.screen) @autoreleasepool {
{
NSUInteger i;
NSArray* screens = [NSScreen screens];
for (i = 0; i < [screens count]; i++) if (!refreshMonitorScreen(monitor))
{ return;
NSScreen* screen = [screens objectAtIndex:i];
NSNumber* displayID =
[[screen deviceDescription] objectForKey:@"NSScreenNumber"];
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
if (monitor->ns.unitNumber ==
CGDisplayUnitNumber([displayID unsignedIntValue]))
{
monitor->ns.screen = screen;
break;
}
}
if (i == [screens count])
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to find a screen for monitor");
return;
}
}
const NSRect points = [monitor->ns.screen frame]; const NSRect points = [monitor->ns.screen frame];
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points]; const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
@ -409,30 +407,54 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
*xscale = (float) (pixels.size.width / points.size.width); *xscale = (float) (pixels.size.width / points.size.width);
if (yscale) if (yscale)
*yscale = (float) (pixels.size.height / points.size.height); *yscale = (float) (pixels.size.height / points.size.height);
} // autoreleasepool
}
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
int* xpos, int* ypos,
int* width, int* height)
{
@autoreleasepool {
if (!refreshMonitorScreen(monitor))
return;
const NSRect frameRect = [monitor->ns.screen visibleFrame];
if (xpos)
*xpos = frameRect.origin.x;
if (ypos)
*ypos = _glfwTransformYNS(frameRect.origin.y + frameRect.size.height - 1);
if (width)
*width = frameRect.size.width;
if (height)
*height = frameRect.size.height;
} // autoreleasepool
} }
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
{ {
CFArrayRef modes; @autoreleasepool {
CFIndex found, i, j;
GLFWvidmode* result;
CVDisplayLinkRef link;
*count = 0; *count = 0;
CVDisplayLinkRef link;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link); CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL); CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
found = CFArrayGetCount(modes); const CFIndex found = CFArrayGetCount(modes);
result = calloc(found, sizeof(GLFWvidmode)); GLFWvidmode* result = calloc(found, sizeof(GLFWvidmode));
for (i = 0; i < found; i++) for (CFIndex i = 0; i < found; i++)
{ {
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
if (!modeIsGood(dm)) if (!modeIsGood(dm))
continue; continue;
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link); const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
CFIndex j;
for (j = 0; j < *count; j++) for (j = 0; j < *count; j++)
{ {
@ -451,25 +473,31 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
CFRelease(modes); CFRelease(modes);
CVDisplayLinkRelease(link); CVDisplayLinkRelease(link);
return result; return result;
} // autoreleasepool
} }
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode) void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
{ {
CGDisplayModeRef displayMode; @autoreleasepool {
CVDisplayLinkRef link;
CVDisplayLinkRef link;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link); CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID); CGDisplayModeRef native = CGDisplayCopyDisplayMode(monitor->ns.displayID);
*mode = vidmodeFromCGDisplayMode(displayMode, link); *mode = vidmodeFromCGDisplayMode(native, link);
CGDisplayModeRelease(displayMode); CGDisplayModeRelease(native);
CVDisplayLinkRelease(link); CVDisplayLinkRelease(link);
} // autoreleasepool
} }
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{ {
uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID); @autoreleasepool {
uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue)); CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
CGGetDisplayTransferByTable(monitor->ns.displayID, CGGetDisplayTransferByTable(monitor->ns.displayID,
@ -481,7 +509,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
_glfwAllocGammaArrays(ramp, size); _glfwAllocGammaArrays(ramp, size);
for (i = 0; i < size; i++) for (uint32_t i = 0; i < size; i++)
{ {
ramp->red[i] = (unsigned short) (values[i] * 65535); ramp->red[i] = (unsigned short) (values[i] * 65535);
ramp->green[i] = (unsigned short) (values[i + size] * 65535); ramp->green[i] = (unsigned short) (values[i + size] * 65535);
@ -489,14 +517,18 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
} }
free(values); free(values);
return GLFW_TRUE;
} // autoreleasepool
} }
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{ {
int i; @autoreleasepool {
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue)); CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
for (i = 0; i < ramp->size; i++) for (int i = 0; i < ramp->size; i++)
{ {
values[i] = ramp->red[i] / 65535.f; values[i] = ramp->red[i] / 65535.f;
values[i + ramp->size] = ramp->green[i] / 65535.f; values[i + ramp->size] = ramp->green[i] / 65535.f;
@ -510,6 +542,8 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
values + ramp->size * 2); values + ramp->size * 2);
free(values); free(values);
} // autoreleasepool
} }

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 macOS - www.glfw.org // GLFW 3.4 macOS - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -28,12 +28,37 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <CoreVideo/CVBase.h>
#include <CoreVideo/CVDisplayLink.h>
// NOTE: All of NSGL was deprecated in the 10.14 SDK
// This disables the pointless warnings for every symbol we use
#define GL_SILENCE_DEPRECATION
#if defined(__OBJC__) #if defined(__OBJC__)
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#else #else
typedef void* id; typedef void* id;
#endif #endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
#define NSEventMaskAny NSAnyEventMask
#define NSEventMaskKeyUp NSKeyUpMask
#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
#define NSEventModifierFlagCommand NSCommandKeyMask
#define NSEventModifierFlagControl NSControlKeyMask
#define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask
#define NSEventModifierFlagOption NSAlternateKeyMask
#define NSEventModifierFlagShift NSShiftKeyMask
#define NSEventTypeApplicationDefined NSApplicationDefined
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
#define NSWindowStyleMaskClosable NSClosableWindowMask
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
#define NSWindowStyleMaskResizable NSResizableWindowMask
#define NSWindowStyleMaskTitled NSTitledWindowMask
#endif
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
typedef struct VkMacOSSurfaceCreateInfoMVK typedef struct VkMacOSSurfaceCreateInfoMVK
@ -85,6 +110,7 @@ typedef struct _GLFWwindowNS
id layer; id layer;
GLFWbool maximized; GLFWbool maximized;
GLFWbool retina;
// Cached window properties to filter out duplicate events // Cached window properties to filter out duplicate events
int width, height; int width, height;
@ -104,12 +130,14 @@ typedef struct _GLFWlibraryNS
{ {
CGEventSourceRef eventSource; CGEventSourceRef eventSource;
id delegate; id delegate;
id autoreleasePool; GLFWbool finishedLaunching;
GLFWbool cursorHidden; GLFWbool cursorHidden;
TISInputSourceRef inputSource; TISInputSourceRef inputSource;
IOHIDManagerRef hidManager; IOHIDManagerRef hidManager;
id unicodeData; id unicodeData;
id listener; id helper;
id keyUpMonitor;
id nibObjects;
char keyName[64]; char keyName[64];
short int keycodes[256]; short int keycodes[256];
@ -165,3 +193,5 @@ void _glfwPollMonitorsNS(void);
void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor); void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor);
float _glfwTransformYNS(float y);

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.3 macOS - www.glfw.org // GLFW 3.4 macOS - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
// //
@ -23,6 +23,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -358,7 +360,7 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
window->context.source = ctxconfig->source; window->context.source = ctxconfig->source;
window->context.client = GLFW_OPENGL_API; window->context.client = GLFW_OPENGL_API;
previous = _glfwPlatformGetTls(&_glfw.contextSlot);; previous = _glfwPlatformGetTls(&_glfw.contextSlot);
glfwMakeContextCurrent((GLFWwindow*) window); glfwMakeContextCurrent((GLFWwindow*) window);
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC) window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 EGL - www.glfw.org // GLFW 3.4 EGL - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -446,7 +448,7 @@ void _glfwTerminateEGL(void)
#define setAttrib(a, v) \ #define setAttrib(a, v) \
{ \ { \
assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
attribs[index++] = a; \ attribs[index++] = a; \
attribs[index++] = v; \ attribs[index++] = v; \
} }

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 EGL - www.glfw.org // GLFW 3.4 EGL - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -47,26 +47,26 @@ typedef struct wl_egl_window* EGLNativeWindowType;
#error "No supported EGL platform selected" #error "No supported EGL platform selected"
#endif #endif
#define EGL_SUCCESS 0x3000 #define EGL_SUCCESS 0x3000
#define EGL_NOT_INITIALIZED 0x3001 #define EGL_NOT_INITIALIZED 0x3001
#define EGL_BAD_ACCESS 0x3002 #define EGL_BAD_ACCESS 0x3002
#define EGL_BAD_ALLOC 0x3003 #define EGL_BAD_ALLOC 0x3003
#define EGL_BAD_ATTRIBUTE 0x3004 #define EGL_BAD_ATTRIBUTE 0x3004
#define EGL_BAD_CONFIG 0x3005 #define EGL_BAD_CONFIG 0x3005
#define EGL_BAD_CONTEXT 0x3006 #define EGL_BAD_CONTEXT 0x3006
#define EGL_BAD_CURRENT_SURFACE 0x3007 #define EGL_BAD_CURRENT_SURFACE 0x3007
#define EGL_BAD_DISPLAY 0x3008 #define EGL_BAD_DISPLAY 0x3008
#define EGL_BAD_MATCH 0x3009 #define EGL_BAD_MATCH 0x3009
#define EGL_BAD_NATIVE_PIXMAP 0x300a #define EGL_BAD_NATIVE_PIXMAP 0x300a
#define EGL_BAD_NATIVE_WINDOW 0x300b #define EGL_BAD_NATIVE_WINDOW 0x300b
#define EGL_BAD_PARAMETER 0x300c #define EGL_BAD_PARAMETER 0x300c
#define EGL_BAD_SURFACE 0x300d #define EGL_BAD_SURFACE 0x300d
#define EGL_CONTEXT_LOST 0x300e #define EGL_CONTEXT_LOST 0x300e
#define EGL_COLOR_BUFFER_TYPE 0x303f #define EGL_COLOR_BUFFER_TYPE 0x303f
#define EGL_RGB_BUFFER 0x308e #define EGL_RGB_BUFFER 0x308e
#define EGL_SURFACE_TYPE 0x3033 #define EGL_SURFACE_TYPE 0x3033
#define EGL_WINDOW_BIT 0x0004 #define EGL_WINDOW_BIT 0x0004
#define EGL_RENDERABLE_TYPE 0x3040 #define EGL_RENDERABLE_TYPE 0x3040
#define EGL_OPENGL_ES_BIT 0x0001 #define EGL_OPENGL_ES_BIT 0x0001
#define EGL_OPENGL_ES2_BIT 0x0004 #define EGL_OPENGL_ES2_BIT 0x0004
#define EGL_OPENGL_BIT 0x0008 #define EGL_OPENGL_BIT 0x0008
@ -76,7 +76,7 @@ typedef struct wl_egl_window* EGLNativeWindowType;
#define EGL_RED_SIZE 0x3024 #define EGL_RED_SIZE 0x3024
#define EGL_DEPTH_SIZE 0x3025 #define EGL_DEPTH_SIZE 0x3025
#define EGL_STENCIL_SIZE 0x3026 #define EGL_STENCIL_SIZE 0x3026
#define EGL_SAMPLES 0x3031 #define EGL_SAMPLES 0x3031
#define EGL_OPENGL_ES_API 0x30a0 #define EGL_OPENGL_ES_API 0x30a0
#define EGL_OPENGL_API 0x30a2 #define EGL_OPENGL_API 0x30a2
#define EGL_NONE 0x3038 #define EGL_NONE 0x3038

View File

@ -1,11 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
includedir=${prefix}/include includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
libdir=${exec_prefix}/lib@LIB_SUFFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
Name: GLFW Name: GLFW
Description: A multi-platform library for OpenGL, window and input Description: A multi-platform library for OpenGL, window and input
Version: @GLFW_VERSION_FULL@ Version: @GLFW_VERSION@
URL: https://www.glfw.org/ URL: https://www.glfw.org/
Requires.private: @GLFW_PKG_DEPS@ Requires.private: @GLFW_PKG_DEPS@
Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs: -L${libdir} -l@GLFW_LIB_NAME@

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2010-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2010-2016 Camilla Löwy <elmindreda@glfw.org>
// //

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 GLX - www.glfw.org // GLFW 3.4 GLX - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -226,8 +228,6 @@ static GLFWglproc getProcAddressGLX(const char* procname)
return _glfw_dlsym(_glfw.glx.handle, procname); return _glfw_dlsym(_glfw.glx.handle, procname);
} }
// Destroy the OpenGL context
//
static void destroyContextGLX(_GLFWwindow* window) static void destroyContextGLX(_GLFWwindow* window)
{ {
if (window->context.glx.window) if (window->context.glx.window)
@ -435,7 +435,7 @@ void _glfwTerminateGLX(void)
#define setAttrib(a, v) \ #define setAttrib(a, v) \
{ \ { \
assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
attribs[index++] = a; \ attribs[index++] = a; \
attribs[index++] = v; \ attribs[index++] = v; \
} }

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 GLX - www.glfw.org // GLFW 3.4 GLX - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -29,11 +29,11 @@
#define GLX_RGBA_BIT 0x00000001 #define GLX_RGBA_BIT 0x00000001
#define GLX_WINDOW_BIT 0x00000001 #define GLX_WINDOW_BIT 0x00000001
#define GLX_DRAWABLE_TYPE 0x8010 #define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011 #define GLX_RENDER_TYPE 0x8011
#define GLX_RGBA_TYPE 0x8014 #define GLX_RGBA_TYPE 0x8014
#define GLX_DOUBLEBUFFER 5 #define GLX_DOUBLEBUFFER 5
#define GLX_STEREO 6 #define GLX_STEREO 6
#define GLX_AUX_BUFFERS 7 #define GLX_AUX_BUFFERS 7
#define GLX_RED_SIZE 8 #define GLX_RED_SIZE 8
#define GLX_GREEN_SIZE 9 #define GLX_GREEN_SIZE 9
#define GLX_BLUE_SIZE 10 #define GLX_BLUE_SIZE 10
@ -42,7 +42,7 @@
#define GLX_STENCIL_SIZE 13 #define GLX_STENCIL_SIZE 13
#define GLX_ACCUM_RED_SIZE 14 #define GLX_ACCUM_RED_SIZE 14
#define GLX_ACCUM_GREEN_SIZE 15 #define GLX_ACCUM_GREEN_SIZE 15
#define GLX_ACCUM_BLUE_SIZE 16 #define GLX_ACCUM_BLUE_SIZE 16
#define GLX_ACCUM_ALPHA_SIZE 17 #define GLX_ACCUM_ALPHA_SIZE 17
#define GLX_SAMPLES 0x186a1 #define GLX_SAMPLES 0x186a1
#define GLX_VISUAL_ID 0x800b #define GLX_VISUAL_ID 0x800b

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
#include "mappings.h" #include "mappings.h"
@ -119,6 +121,30 @@ char* _glfw_strdup(const char* source)
return result; return result;
} }
float _glfw_fminf(float a, float b)
{
if (a != a)
return b;
else if (b != b)
return a;
else if (a < b)
return a;
else
return b;
}
float _glfw_fmaxf(float a, float b)
{
if (a != a)
return b;
else if (b != b)
return a;
else if (a > b)
return a;
else
return b;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW event API ////// ////// GLFW event API //////

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -333,7 +335,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
} }
// Notifies shared code of a cursor motion event // Notifies shared code of a cursor motion event
// The position is specified in client-area relative screen coordinates // The position is specified in content area relative screen coordinates
// //
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos) void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
{ {
@ -430,13 +432,13 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js->present = GLFW_TRUE; js->present = GLFW_TRUE;
js->name = _glfw_strdup(name); js->name = _glfw_strdup(name);
js->axes = calloc(axisCount, sizeof(float)); js->axes = calloc(axisCount, sizeof(float));
js->buttons = calloc(buttonCount + hatCount * 4, 1); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = calloc(hatCount, 1); js->hats = calloc(hatCount, 1);
js->axisCount = axisCount; js->axisCount = axisCount;
js->buttonCount = buttonCount; js->buttonCount = buttonCount;
js->hatCount = hatCount; js->hatCount = hatCount;
strcpy(js->guid, guid); strncpy(js->guid, guid, sizeof(js->guid) - 1);
js->mapping = findValidMapping(js); js->mapping = findValidMapping(js);
return js; return js;
@ -453,6 +455,16 @@ void _glfwFreeJoystick(_GLFWjoystick* js)
memset(js, 0, sizeof(_GLFWjoystick)); memset(js, 0, sizeof(_GLFWjoystick));
} }
// Center the cursor in the content area of the specified window
//
void _glfwCenterCursorInContentArea(_GLFWwindow* window)
{
int width, height;
_glfwPlatformGetWindowSize(window, &width, &height);
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW public API ////// ////// GLFW public API //////
@ -475,6 +487,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
return window->stickyMouseButtons; return window->stickyMouseButtons;
case GLFW_LOCK_KEY_MODS: case GLFW_LOCK_KEY_MODS:
return window->lockKeyMods; return window->lockKeyMods;
case GLFW_RAW_MOUSE_MOTION:
return window->rawMouseMotion;
} }
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode); _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
@ -551,11 +565,35 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
window->stickyMouseButtons = value; window->stickyMouseButtons = value;
} }
else if (mode == GLFW_LOCK_KEY_MODS) else if (mode == GLFW_LOCK_KEY_MODS)
{
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE; window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
}
else if (mode == GLFW_RAW_MOUSE_MOTION)
{
if (!_glfwPlatformRawMouseMotionSupported())
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Raw mouse motion is not supported on this system");
return;
}
value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->rawMouseMotion == value)
return;
window->rawMouseMotion = value;
_glfwPlatformSetRawMouseMotion(window, value);
}
else else
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode); _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
} }
GLFWAPI int glfwRawMouseMotionSupported(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
return _glfwPlatformRawMouseMotionSupported();
}
GLFWAPI const char* glfwGetKeyName(int key, int scancode) GLFWAPI const char* glfwGetKeyName(int key, int scancode)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1222,8 +1260,18 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
if (e->type == _GLFW_JOYSTICK_AXIS) if (e->type == _GLFW_JOYSTICK_AXIS)
{ {
const float value = js->axes[e->index] * e->axisScale + e->axisOffset; const float value = js->axes[e->index] * e->axisScale + e->axisOffset;
if (value > 0.f) // HACK: This should be baked into the value transform
state->buttons[i] = GLFW_PRESS; // TODO: Bake into transform when implementing output modifiers
if (e->axisOffset < 0 || (e->axisOffset == 0 && e->axisScale > 0))
{
if (value >= 0.f)
state->buttons[i] = GLFW_PRESS;
}
else
{
if (value <= 0.f)
state->buttons[i] = GLFW_PRESS;
}
} }
else if (e->type == _GLFW_JOYSTICK_HATBIT) else if (e->type == _GLFW_JOYSTICK_HATBIT)
{ {
@ -1242,7 +1290,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
if (e->type == _GLFW_JOYSTICK_AXIS) if (e->type == _GLFW_JOYSTICK_AXIS)
{ {
const float value = js->axes[e->index] * e->axisScale + e->axisOffset; const float value = js->axes[e->index] * e->axisScale + e->axisOffset;
state->axes[i] = fminf(fmaxf(value, -1.f), 1.f); state->axes[i] = _glfw_fminf(_glfw_fmaxf(value, -1.f), 1.f);
} }
else if (e->type == _GLFW_JOYSTICK_HATBIT) else if (e->type == _GLFW_JOYSTICK_HATBIT)
{ {
@ -1250,9 +1298,11 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
const unsigned int bit = e->index & 0xf; const unsigned int bit = e->index & 0xf;
if (js->hats[hat] & bit) if (js->hats[hat] & bit)
state->axes[i] = 1.f; state->axes[i] = 1.f;
else
state->axes[i] = -1.f;
} }
else if (e->type == _GLFW_JOYSTICK_BUTTON) else if (e->type == _GLFW_JOYSTICK_BUTTON)
state->axes[i] = (float) js->buttons[e->index]; state->axes[i] = js->buttons[e->index] * 2.f - 1.f;
} }
return GLFW_TRUE; return GLFW_TRUE;
@ -1304,4 +1354,3 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void)
_GLFW_REQUIRE_INIT_OR_RETURN(0); _GLFW_REQUIRE_INIT_OR_RETURN(0);
return _glfwPlatformGetTimerFrequency(); return _glfwPlatformGetTimerFrequency();
} }

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -84,8 +84,8 @@ typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*);
typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*); typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
#define GL_VERSION 0x1f02 #define GL_VERSION 0x1f02
#define GL_NONE 0 #define GL_NONE 0
#define GL_COLOR_BUFFER_BIT 0x00004000 #define GL_COLOR_BUFFER_BIT 0x00004000
#define GL_UNSIGNED_BYTE 0x1401 #define GL_UNSIGNED_BYTE 0x1401
#define GL_EXTENSIONS 0x1f03 #define GL_EXTENSIONS 0x1f03
#define GL_NUM_EXTENSIONS 0x821d #define GL_NUM_EXTENSIONS 0x821d
@ -102,7 +102,7 @@ typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc #define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
typedef int GLint; typedef int GLint;
typedef unsigned int GLuint; typedef unsigned int GLuint;
typedef unsigned int GLenum; typedef unsigned int GLenum;
typedef unsigned int GLbitfield; typedef unsigned int GLbitfield;
@ -390,6 +390,7 @@ struct _GLFWwindow
char keys[GLFW_KEY_LAST + 1]; char keys[GLFW_KEY_LAST + 1];
// Virtual cursor position when cursor is disabled // Virtual cursor position when cursor is disabled
double virtualCursorPosX, virtualCursorPosY; double virtualCursorPosX, virtualCursorPosY;
GLFWbool rawMouseMotion;
_GLFWcontext context; _GLFWcontext context;
@ -596,6 +597,8 @@ const char* _glfwPlatformGetVersionString(void);
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos); void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos); void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode); void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled);
GLFWbool _glfwPlatformRawMouseMotionSupported(void);
int _glfwPlatformCreateCursor(_GLFWcursor* cursor, int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image, int xhot, int yhot); const GLFWimage* image, int xhot, int yhot);
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape); int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape);
@ -609,9 +612,10 @@ void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos); void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
float* xscale, float* yscale); float* xscale, float* yscale);
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height);
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count); GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count);
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode); void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp); GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void _glfwPlatformSetClipboardString(const char* string); void _glfwPlatformSetClipboardString(const char* string);
@ -760,10 +764,13 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
int buttonCount, int buttonCount,
int hatCount); int hatCount);
void _glfwFreeJoystick(_GLFWjoystick* js); void _glfwFreeJoystick(_GLFWjoystick* js);
void _glfwCenterCursorInContentArea(_GLFWwindow* window);
GLFWbool _glfwInitVulkan(int mode); GLFWbool _glfwInitVulkan(int mode);
void _glfwTerminateVulkan(void); void _glfwTerminateVulkan(void);
const char* _glfwGetVulkanResultString(VkResult result); const char* _glfwGetVulkanResultString(VkResult result);
char* _glfw_strdup(const char* source); char* _glfw_strdup(const char* source);
float _glfw_fminf(float a, float b);
float _glfw_fmaxf(float a, float b);

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 Linux - www.glfw.org // GLFW 3.4 Linux - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -104,9 +106,7 @@ static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
// //
static void pollAbsState(_GLFWjoystick* js) static void pollAbsState(_GLFWjoystick* js)
{ {
int code; for (int code = 0; code < ABS_CNT; code++)
for (code = 0; code < ABS_CNT; code++)
{ {
if (js->linjs.absMap[code] < 0) if (js->linjs.absMap[code] < 0)
continue; continue;
@ -126,18 +126,7 @@ static void pollAbsState(_GLFWjoystick* js)
// //
static GLFWbool openJoystickDevice(const char* path) static GLFWbool openJoystickDevice(const char* path)
{ {
int jid, code; for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
char name[256] = "";
char guid[33] = "";
char evBits[(EV_CNT + 7) / 8] = {0};
char keyBits[(KEY_CNT + 7) / 8] = {0};
char absBits[(ABS_CNT + 7) / 8] = {0};
int axisCount = 0, buttonCount = 0, hatCount = 0;
struct input_id id;
_GLFWjoystickLinux linjs = {0};
_GLFWjoystick* js = NULL;
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
if (!_glfw.joysticks[jid].present) if (!_glfw.joysticks[jid].present)
continue; continue;
@ -145,10 +134,16 @@ static GLFWbool openJoystickDevice(const char* path)
return GLFW_FALSE; return GLFW_FALSE;
} }
_GLFWjoystickLinux linjs = {0};
linjs.fd = open(path, O_RDONLY | O_NONBLOCK); linjs.fd = open(path, O_RDONLY | O_NONBLOCK);
if (linjs.fd == -1) if (linjs.fd == -1)
return GLFW_FALSE; return GLFW_FALSE;
char evBits[(EV_CNT + 7) / 8] = {0};
char keyBits[(KEY_CNT + 7) / 8] = {0};
char absBits[(ABS_CNT + 7) / 8] = {0};
struct input_id id;
if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 || if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 || ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 || ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 ||
@ -168,9 +163,13 @@ static GLFWbool openJoystickDevice(const char* path)
return GLFW_FALSE; return GLFW_FALSE;
} }
char name[256] = "";
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0) if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
strncpy(name, "Unknown", sizeof(name)); strncpy(name, "Unknown", sizeof(name));
char guid[33] = "";
// Generate a joystick GUID that matches the SDL 2.0.5+ one // Generate a joystick GUID that matches the SDL 2.0.5+ one
if (id.vendor && id.product && id.version) if (id.vendor && id.product && id.version)
{ {
@ -189,7 +188,9 @@ static GLFWbool openJoystickDevice(const char* path)
name[8], name[9], name[10]); name[8], name[9], name[10]);
} }
for (code = BTN_MISC; code < KEY_CNT; code++) int axisCount = 0, buttonCount = 0, hatCount = 0;
for (int code = BTN_MISC; code < KEY_CNT; code++)
{ {
if (!isBitSet(code, keyBits)) if (!isBitSet(code, keyBits))
continue; continue;
@ -198,7 +199,7 @@ static GLFWbool openJoystickDevice(const char* path)
buttonCount++; buttonCount++;
} }
for (code = 0; code < ABS_CNT; code++) for (int code = 0; code < ABS_CNT; code++)
{ {
linjs.absMap[code] = -1; linjs.absMap[code] = -1;
if (!isBitSet(code, absBits)) if (!isBitSet(code, absBits))
@ -221,7 +222,8 @@ static GLFWbool openJoystickDevice(const char* path)
} }
} }
js = _glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount); _GLFWjoystick* js =
_glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
if (!js) if (!js)
{ {
close(linjs.fd); close(linjs.fd);
@ -266,8 +268,6 @@ static int compareJoysticks(const void* fp, const void* sp)
// //
GLFWbool _glfwInitJoysticksLinux(void) GLFWbool _glfwInitJoysticksLinux(void)
{ {
DIR* dir;
int count = 0;
const char* dirname = "/dev/input"; const char* dirname = "/dev/input";
_glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); _glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
@ -289,7 +289,9 @@ GLFWbool _glfwInitJoysticksLinux(void)
return GLFW_FALSE; return GLFW_FALSE;
} }
dir = opendir(dirname); int count = 0;
DIR* dir = opendir(dirname);
if (dir) if (dir)
{ {
struct dirent* entry; struct dirent* entry;
@ -344,12 +346,11 @@ void _glfwTerminateJoysticksLinux(void)
void _glfwDetectJoystickConnectionLinux(void) void _glfwDetectJoystickConnectionLinux(void)
{ {
ssize_t offset = 0;
char buffer[16384];
if (_glfw.linjs.inotify <= 0) if (_glfw.linjs.inotify <= 0)
return; return;
ssize_t offset = 0;
char buffer[16384];
const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer)); const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer));
while (size > offset) while (size > offset)
@ -369,9 +370,7 @@ void _glfwDetectJoystickConnectionLinux(void)
openJoystickDevice(path); openJoystickDevice(path);
else if (e->mask & IN_DELETE) else if (e->mask & IN_DELETE)
{ {
int jid; for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
{ {

View File

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

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -100,7 +102,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
{ {
memmove(_glfw.monitors + 1, memmove(_glfw.monitors + 1,
_glfw.monitors, _glfw.monitors,
(_glfw.monitorCount - 1) * sizeof(_GLFWmonitor*)); ((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
_glfw.monitors[0] = monitor; _glfw.monitors[0] = monitor;
} }
else else
@ -130,7 +132,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
_glfw.monitorCount--; _glfw.monitorCount--;
memmove(_glfw.monitors + i, memmove(_glfw.monitors + i,
_glfw.monitors + i + 1, _glfw.monitors + i + 1,
(_glfw.monitorCount - i) * sizeof(_GLFWmonitor*)); ((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
break; break;
} }
} }
@ -330,6 +332,27 @@ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
_glfwPlatformGetMonitorPos(monitor, xpos, ypos); _glfwPlatformGetMonitorPos(monitor, xpos, ypos);
} }
GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* handle,
int* xpos, int* ypos,
int* width, int* height)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
if (width)
*width = 0;
if (height)
*height = 0;
_GLFW_REQUIRE_INIT();
_glfwPlatformGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM) GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
{ {
_GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
@ -427,12 +450,12 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
{ {
int i; unsigned int i;
unsigned short values[256]; unsigned short* values;
GLFWgammaramp ramp; GLFWgammaramp ramp;
const GLFWgammaramp* original;
assert(handle != NULL); assert(handle != NULL);
assert(gamma == gamma); assert(gamma > 0.f);
assert(gamma >= 0.f);
assert(gamma <= FLT_MAX); assert(gamma <= FLT_MAX);
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -443,18 +466,22 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
return; return;
} }
for (i = 0; i < 256; i++) original = glfwGetGammaRamp(handle);
if (!original)
return;
values = calloc(original->size, sizeof(unsigned short));
for (i = 0; i < original->size; i++)
{ {
float value; float value;
// Calculate intensity // Calculate intensity
value = i / 255.f; value = i / (float) (original->size - 1);
// Apply gamma curve // Apply gamma curve
value = powf(value, 1.f / gamma) * 65535.f + 0.5f; value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
// Clamp to value range // Clamp to value range
if (value > 65535.f) value = _glfw_fminf(value, 65535.f);
value = 65535.f;
values[i] = (unsigned short) value; values[i] = (unsigned short) value;
} }
@ -462,9 +489,10 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
ramp.red = values; ramp.red = values;
ramp.green = values; ramp.green = values;
ramp.blue = values; ramp.blue = values;
ramp.size = 256; ramp.size = original->size;
glfwSetGammaRamp(handle, &ramp); glfwSetGammaRamp(handle, &ramp);
free(values);
} }
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
@ -475,7 +503,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_glfwFreeGammaArrays(&monitor->currentRamp); _glfwFreeGammaArrays(&monitor->currentRamp);
_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp); if (!_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp))
return NULL;
return &monitor->currentRamp; return &monitor->currentRamp;
} }
@ -501,7 +530,10 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
if (!monitor->originalRamp.size) if (!monitor->originalRamp.size)
_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp); {
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))
return;
}
_glfwPlatformSetGammaRamp(monitor, ramp); _glfwPlatformSetGammaRamp(monitor, ramp);
} }

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 macOS - www.glfw.org // GLFW 3.4 macOS - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,16 +24,27 @@
// //
//======================================================================== //========================================================================
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
#endif
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl
#include <stdatomic.h>
// NSGL-specific per-context data // NSGL-specific per-context data
// //
typedef struct _GLFWcontextNSGL typedef struct _GLFWcontextNSGL
{ {
id pixelFormat; id pixelFormat;
id object; id object;
CVDisplayLinkRef displayLink;
atomic_int swapInterval;
int swapIntervalsPassed;
id swapIntervalCond;
} _GLFWcontextNSGL; } _GLFWcontextNSGL;
@ -53,4 +64,5 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig, const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig); const _GLFWfbconfig* fbconfig);
void _glfwDestroyContextNSGL(_GLFWwindow* window); void _glfwDestroyContextNSGL(_GLFWwindow* window);
void _glfwUpdateDisplayLinkDisplayNSGL(_GLFWwindow* window);

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 macOS - www.glfw.org // GLFW 3.4 macOS - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -23,37 +23,80 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 // Display link callback for manual swap interval implementation
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval // This is based on a similar workaround added to SDL2
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity //
#endif static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink,
const CVTimeStamp* now,
const CVTimeStamp* outputTime,
CVOptionFlags flagsIn,
CVOptionFlags* flagsOut,
void* userInfo)
{
_GLFWwindow* window = (_GLFWwindow *) userInfo;
const int interval = atomic_load(&window->context.nsgl.swapInterval);
if (interval > 0)
{
[window->context.nsgl.swapIntervalCond lock];
window->context.nsgl.swapIntervalsPassed++;
[window->context.nsgl.swapIntervalCond signal];
[window->context.nsgl.swapIntervalCond unlock];
}
return kCVReturnSuccess;
}
static void makeContextCurrentNSGL(_GLFWwindow* window) static void makeContextCurrentNSGL(_GLFWwindow* window)
{ {
@autoreleasepool {
if (window) if (window)
[window->context.nsgl.object makeCurrentContext]; [window->context.nsgl.object makeCurrentContext];
else else
[NSOpenGLContext clearCurrentContext]; [NSOpenGLContext clearCurrentContext];
_glfwPlatformSetTls(&_glfw.contextSlot, window); _glfwPlatformSetTls(&_glfw.contextSlot, window);
} // autoreleasepool
} }
static void swapBuffersNSGL(_GLFWwindow* window) static void swapBuffersNSGL(_GLFWwindow* window)
{ {
@autoreleasepool {
const int interval = atomic_load(&window->context.nsgl.swapInterval);
if (interval > 0)
{
[window->context.nsgl.swapIntervalCond lock];
do
{
[window->context.nsgl.swapIntervalCond wait];
} while (window->context.nsgl.swapIntervalsPassed % interval != 0);
window->context.nsgl.swapIntervalsPassed = 0;
[window->context.nsgl.swapIntervalCond unlock];
}
// ARP appears to be unnecessary, but this is future-proof // ARP appears to be unnecessary, but this is future-proof
[window->context.nsgl.object flushBuffer]; [window->context.nsgl.object flushBuffer];
} // autoreleasepool
} }
static void swapIntervalNSGL(int interval) static void swapIntervalNSGL(int interval)
{ {
@autoreleasepool {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
atomic_store(&window->context.nsgl.swapInterval, interval);
GLint sync = interval; [window->context.nsgl.swapIntervalCond lock];
[window->context.nsgl.object setValues:&sync window->context.nsgl.swapIntervalsPassed = 0;
forParameter:NSOpenGLContextParameterSwapInterval]; [window->context.nsgl.swapIntervalCond unlock];
} // autoreleasepool
} }
static int extensionSupportedNSGL(const char* extension) static int extensionSupportedNSGL(const char* extension)
@ -76,15 +119,28 @@ static GLFWglproc getProcAddressNSGL(const char* procname)
return symbol; return symbol;
} }
// Destroy the OpenGL context
//
static void destroyContextNSGL(_GLFWwindow* window) static void destroyContextNSGL(_GLFWwindow* window)
{ {
@autoreleasepool {
if (window->context.nsgl.displayLink)
{
if (CVDisplayLinkIsRunning(window->context.nsgl.displayLink))
CVDisplayLinkStop(window->context.nsgl.displayLink);
CVDisplayLinkRelease(window->context.nsgl.displayLink);
}
[window->context.nsgl.swapIntervalCond release];
window->context.nsgl.swapIntervalCond = nil;
[window->context.nsgl.pixelFormat release]; [window->context.nsgl.pixelFormat release];
window->context.nsgl.pixelFormat = nil; window->context.nsgl.pixelFormat = nil;
[window->context.nsgl.object release]; [window->context.nsgl.object release];
window->context.nsgl.object = nil; window->context.nsgl.object = nil;
} // autoreleasepool
} }
@ -138,13 +194,6 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
"NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above"); "NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!ctxconfig->forward || ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above");
return GLFW_FALSE;
}
} }
// Context robustness modes (GL_KHR_robustness) are not yet supported by // Context robustness modes (GL_KHR_robustness) are not yet supported by
@ -179,9 +228,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
// Info.plist for unbundled applications // Info.plist for unbundled applications
// HACK: This assumes that NSOpenGLPixelFormat will remain // HACK: This assumes that NSOpenGLPixelFormat will remain
// a straightforward wrapper of its CGL counterpart // a straightforward wrapper of its CGL counterpart
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
addAttrib(kCGLPFASupportsAutomaticGraphicsSwitching); addAttrib(kCGLPFASupportsAutomaticGraphicsSwitching);
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
@ -307,8 +354,17 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
forParameter:NSOpenGLContextParameterSurfaceOpacity]; forParameter:NSOpenGLContextParameterSurfaceOpacity];
} }
if (window->ns.retina)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
GLint interval = 0;
[window->context.nsgl.object setValues:&interval
forParameter:NSOpenGLContextParameterSwapInterval];
[window->context.nsgl.object setView:window->ns.view]; [window->context.nsgl.object setView:window->ns.view];
window->context.nsgl.swapIntervalCond = [NSCondition new];
window->context.makeCurrent = makeContextCurrentNSGL; window->context.makeCurrent = makeContextCurrentNSGL;
window->context.swapBuffers = swapBuffersNSGL; window->context.swapBuffers = swapBuffersNSGL;
window->context.swapInterval = swapIntervalNSGL; window->context.swapInterval = swapIntervalNSGL;
@ -316,9 +372,26 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
window->context.getProcAddress = getProcAddressNSGL; window->context.getProcAddress = getProcAddressNSGL;
window->context.destroy = destroyContextNSGL; window->context.destroy = destroyContextNSGL;
CVDisplayLinkCreateWithActiveCGDisplays(&window->context.nsgl.displayLink);
CVDisplayLinkSetOutputCallback(window->context.nsgl.displayLink,
&displayLinkCallback,
window);
CVDisplayLinkStart(window->context.nsgl.displayLink);
_glfwUpdateDisplayLinkDisplayNSGL(window);
return GLFW_TRUE; return GLFW_TRUE;
} }
void _glfwUpdateDisplayLinkDisplayNSGL(_GLFWwindow* window)
{
CGDirectDisplayID displayID =
[[[window->ns.object screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue];
if (!displayID)
return;
CVDisplayLinkSetCurrentCGDisplay(window->context.nsgl.displayLink, displayID);
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW native API ////// ////// GLFW native API //////

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc. // Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -23,6 +23,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc. // Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -49,6 +51,12 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
*yscale = 1.f; *yscale = 1.f;
} }
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
int* xpos, int* ypos,
int* width, int* height)
{
}
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
{ {
return NULL; return NULL;
@ -58,8 +66,9 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
{ {
} }
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{ {
return GLFW_FALSE;
} }
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc. // Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc. // Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -196,6 +198,15 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
{ {
} }
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
{
}
GLFWbool _glfwPlatformRawMouseMotionSupported(void)
{
return GLFW_FALSE;
}
void _glfwPlatformShowWindow(_GLFWwindow* window) void _glfwPlatformShowWindow(_GLFWwindow* window)
{ {
} }

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 OSMesa - www.glfw.org // GLFW 3.4 OSMesa - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc. // Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -47,7 +49,7 @@ static void makeContextCurrentOSMesa(_GLFWwindow* window)
free(window->context.osmesa.buffer); free(window->context.osmesa.buffer);
// Allocate the new buffer (width * height * 8-bit RGBA) // Allocate the new buffer (width * height * 8-bit RGBA)
window->context.osmesa.buffer = calloc(4, width * height); window->context.osmesa.buffer = calloc(4, (size_t) width * height);
window->context.osmesa.width = width; window->context.osmesa.width = width;
window->context.osmesa.height = height; window->context.osmesa.height = height;
} }
@ -188,7 +190,7 @@ void _glfwTerminateOSMesa(void)
#define setAttrib(a, v) \ #define setAttrib(a, v) \
{ \ { \
assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
attribs[index++] = a; \ attribs[index++] = a; \
attribs[index++] = v; \ attribs[index++] = v; \
} }
@ -240,7 +242,7 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
if (ctxconfig->forward) if (ctxconfig->forward)
{ {
_glfwInputError(GLFW_VERSION_UNAVAILABLE, _glfwInputError(GLFW_VERSION_UNAVAILABLE,
"OSMesa: Foward-compatible contexts not supported"); "OSMesa: Forward-compatible contexts not supported");
return GLFW_FALSE; return GLFW_FALSE;
} }

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 OSMesa - www.glfw.org // GLFW 3.4 OSMesa - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc. // Copyright (c) 2016 Google Inc.
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 POSIX - www.glfw.org // GLFW 3.4 POSIX - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 POSIX - www.glfw.org // GLFW 3.4 POSIX - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 POSIX - www.glfw.org // GLFW 3.4 POSIX - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 POSIX - www.glfw.org // GLFW 3.4 POSIX - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 - www.glfw.org // GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 WGL - www.glfw.org // GLFW 3.4 WGL - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -31,27 +33,34 @@
#include <malloc.h> #include <malloc.h>
#include <assert.h> #include <assert.h>
// Return the value corresponding to the specified attribute
// Returns the specified attribute of the specified pixel format
// //
static int getPixelFormatAttrib(_GLFWwindow* window, int pixelFormat, int attrib) static int findPixelFormatAttribValue(const int* attribs,
int attribCount,
const int* values,
int attrib)
{ {
int value = 0; int i;
assert(_glfw.wgl.ARB_pixel_format); for (i = 0; i < attribCount; i++)
if (!_glfw.wgl.GetPixelFormatAttribivARB(window->context.wgl.dc,
pixelFormat,
0, 1, &attrib, &value))
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, if (attribs[i] == attrib)
"WGL: Failed to retrieve pixel format attribute"); return values[i];
return 0;
} }
return value; _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"WGL: Unknown pixel format attribute requested");
return 0;
} }
#define addAttrib(a) \
{ \
assert((size_t) attribCount < sizeof(attribs) / sizeof(attribs[0])); \
attribs[attribCount++] = a; \
}
#define findAttribValue(a) \
findPixelFormatAttribValue(attribs, attribCount, values, a)
// Return a list of available and usable framebuffer configs // Return a list of available and usable framebuffer configs
// //
static int choosePixelFormat(_GLFWwindow* window, static int choosePixelFormat(_GLFWwindow* window,
@ -60,13 +69,58 @@ static int choosePixelFormat(_GLFWwindow* window,
{ {
_GLFWfbconfig* usableConfigs; _GLFWfbconfig* usableConfigs;
const _GLFWfbconfig* closest; const _GLFWfbconfig* closest;
int i, pixelFormat, nativeCount, usableCount; int i, pixelFormat, nativeCount, usableCount = 0, attribCount = 0;
int attribs[40];
int values[sizeof(attribs) / sizeof(attribs[0])];
if (_glfw.wgl.ARB_pixel_format) if (_glfw.wgl.ARB_pixel_format)
{ {
nativeCount = getPixelFormatAttrib(window, const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
1,
WGL_NUMBER_PIXEL_FORMATS_ARB); if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
1, 0, 1, &attrib, &nativeCount))
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"WGL: Failed to retrieve pixel format attribute");
return 0;
}
addAttrib(WGL_SUPPORT_OPENGL_ARB);
addAttrib(WGL_DRAW_TO_WINDOW_ARB);
addAttrib(WGL_PIXEL_TYPE_ARB);
addAttrib(WGL_ACCELERATION_ARB);
addAttrib(WGL_RED_BITS_ARB);
addAttrib(WGL_RED_SHIFT_ARB);
addAttrib(WGL_GREEN_BITS_ARB);
addAttrib(WGL_GREEN_SHIFT_ARB);
addAttrib(WGL_BLUE_BITS_ARB);
addAttrib(WGL_BLUE_SHIFT_ARB);
addAttrib(WGL_ALPHA_BITS_ARB);
addAttrib(WGL_ALPHA_SHIFT_ARB);
addAttrib(WGL_DEPTH_BITS_ARB);
addAttrib(WGL_STENCIL_BITS_ARB);
addAttrib(WGL_ACCUM_BITS_ARB);
addAttrib(WGL_ACCUM_RED_BITS_ARB);
addAttrib(WGL_ACCUM_GREEN_BITS_ARB);
addAttrib(WGL_ACCUM_BLUE_BITS_ARB);
addAttrib(WGL_ACCUM_ALPHA_BITS_ARB);
addAttrib(WGL_AUX_BUFFERS_ARB);
addAttrib(WGL_STEREO_ARB);
addAttrib(WGL_DOUBLE_BUFFER_ARB);
if (_glfw.wgl.ARB_multisample)
addAttrib(WGL_SAMPLES_ARB);
if (ctxconfig->client == GLFW_OPENGL_API)
{
if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
addAttrib(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
}
else
{
if (_glfw.wgl.EXT_colorspace)
addAttrib(WGL_COLORSPACE_EXT);
}
} }
else else
{ {
@ -77,64 +131,69 @@ static int choosePixelFormat(_GLFWwindow* window,
} }
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig)); usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
usableCount = 0;
for (i = 0; i < nativeCount; i++) for (i = 0; i < nativeCount; i++)
{ {
const int n = i + 1;
_GLFWfbconfig* u = usableConfigs + usableCount; _GLFWfbconfig* u = usableConfigs + usableCount;
pixelFormat = i + 1;
if (_glfw.wgl.ARB_pixel_format) if (_glfw.wgl.ARB_pixel_format)
{ {
// Get pixel format attributes through "modern" extension // Get pixel format attributes through "modern" extension
if (!getPixelFormatAttrib(window, n, WGL_SUPPORT_OPENGL_ARB) || if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
!getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB)) pixelFormat, 0,
attribCount,
attribs, values))
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"WGL: Failed to retrieve pixel format attributes");
free(usableConfigs);
return 0;
}
if (!findAttribValue(WGL_SUPPORT_OPENGL_ARB) ||
!findAttribValue(WGL_DRAW_TO_WINDOW_ARB))
{ {
continue; continue;
} }
if (getPixelFormatAttrib(window, n, WGL_PIXEL_TYPE_ARB) != if (findAttribValue(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB)
WGL_TYPE_RGBA_ARB)
{
continue; continue;
}
if (getPixelFormatAttrib(window, n, WGL_ACCELERATION_ARB) == if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
WGL_NO_ACCELERATION_ARB)
{
continue; continue;
}
u->redBits = getPixelFormatAttrib(window, n, WGL_RED_BITS_ARB); u->redBits = findAttribValue(WGL_RED_BITS_ARB);
u->greenBits = getPixelFormatAttrib(window, n, WGL_GREEN_BITS_ARB); u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
u->blueBits = getPixelFormatAttrib(window, n, WGL_BLUE_BITS_ARB); u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
u->alphaBits = getPixelFormatAttrib(window, n, WGL_ALPHA_BITS_ARB); u->alphaBits = findAttribValue(WGL_ALPHA_BITS_ARB);
u->depthBits = getPixelFormatAttrib(window, n, WGL_DEPTH_BITS_ARB); u->depthBits = findAttribValue(WGL_DEPTH_BITS_ARB);
u->stencilBits = getPixelFormatAttrib(window, n, WGL_STENCIL_BITS_ARB); u->stencilBits = findAttribValue(WGL_STENCIL_BITS_ARB);
u->accumRedBits = getPixelFormatAttrib(window, n, WGL_ACCUM_RED_BITS_ARB); u->accumRedBits = findAttribValue(WGL_ACCUM_RED_BITS_ARB);
u->accumGreenBits = getPixelFormatAttrib(window, n, WGL_ACCUM_GREEN_BITS_ARB); u->accumGreenBits = findAttribValue(WGL_ACCUM_GREEN_BITS_ARB);
u->accumBlueBits = getPixelFormatAttrib(window, n, WGL_ACCUM_BLUE_BITS_ARB); u->accumBlueBits = findAttribValue(WGL_ACCUM_BLUE_BITS_ARB);
u->accumAlphaBits = getPixelFormatAttrib(window, n, WGL_ACCUM_ALPHA_BITS_ARB); u->accumAlphaBits = findAttribValue(WGL_ACCUM_ALPHA_BITS_ARB);
u->auxBuffers = getPixelFormatAttrib(window, n, WGL_AUX_BUFFERS_ARB); u->auxBuffers = findAttribValue(WGL_AUX_BUFFERS_ARB);
if (getPixelFormatAttrib(window, n, WGL_STEREO_ARB)) if (findAttribValue(WGL_STEREO_ARB))
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (getPixelFormatAttrib(window, n, WGL_DOUBLE_BUFFER_ARB)) if (findAttribValue(WGL_DOUBLE_BUFFER_ARB))
u->doublebuffer = GLFW_TRUE; u->doublebuffer = GLFW_TRUE;
if (_glfw.wgl.ARB_multisample) if (_glfw.wgl.ARB_multisample)
u->samples = getPixelFormatAttrib(window, n, WGL_SAMPLES_ARB); u->samples = findAttribValue(WGL_SAMPLES_ARB);
if (ctxconfig->client == GLFW_OPENGL_API) if (ctxconfig->client == GLFW_OPENGL_API)
{ {
if (_glfw.wgl.ARB_framebuffer_sRGB || if (_glfw.wgl.ARB_framebuffer_sRGB ||
_glfw.wgl.EXT_framebuffer_sRGB) _glfw.wgl.EXT_framebuffer_sRGB)
{ {
if (getPixelFormatAttrib(window, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB)) if (findAttribValue(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB))
u->sRGB = GLFW_TRUE; u->sRGB = GLFW_TRUE;
} }
} }
@ -142,11 +201,8 @@ static int choosePixelFormat(_GLFWwindow* window,
{ {
if (_glfw.wgl.EXT_colorspace) if (_glfw.wgl.EXT_colorspace)
{ {
if (getPixelFormatAttrib(window, n, WGL_COLORSPACE_EXT) == if (findAttribValue(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
WGL_COLORSPACE_SRGB_EXT)
{
u->sRGB = GLFW_TRUE; u->sRGB = GLFW_TRUE;
}
} }
} }
} }
@ -157,11 +213,15 @@ static int choosePixelFormat(_GLFWwindow* window,
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
if (!DescribePixelFormat(window->context.wgl.dc, if (!DescribePixelFormat(window->context.wgl.dc,
n, pixelFormat,
sizeof(PIXELFORMATDESCRIPTOR), sizeof(PIXELFORMATDESCRIPTOR),
&pfd)) &pfd))
{ {
continue; _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"WGL: Failed to describe pixel format");
free(usableConfigs);
return 0;
} }
if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) || if (!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
@ -200,7 +260,7 @@ static int choosePixelFormat(_GLFWwindow* window,
u->doublebuffer = GLFW_TRUE; u->doublebuffer = GLFW_TRUE;
} }
u->handle = n; u->handle = pixelFormat;
usableCount++; usableCount++;
} }
@ -229,6 +289,9 @@ static int choosePixelFormat(_GLFWwindow* window,
return pixelFormat; return pixelFormat;
} }
#undef addAttrib
#undef findAttribValue
static void makeContextCurrentWGL(_GLFWwindow* window) static void makeContextCurrentWGL(_GLFWwindow* window)
{ {
if (window) if (window)
@ -260,10 +323,12 @@ static void swapBuffersWGL(_GLFWwindow* window)
{ {
if (IsWindowsVistaOrGreater()) if (IsWindowsVistaOrGreater())
{ {
BOOL enabled; // DWM Composition is always enabled on Win8+
BOOL enabled = IsWindows8OrGreater();
// HACK: Use DwmFlush when desktop composition is enabled // HACK: Use DwmFlush when desktop composition is enabled
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) if (enabled ||
(SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled))
{ {
int count = abs(window->context.wgl.interval); int count = abs(window->context.wgl.interval);
while (count--) while (count--)
@ -285,17 +350,19 @@ static void swapIntervalWGL(int interval)
{ {
if (IsWindowsVistaOrGreater()) if (IsWindowsVistaOrGreater())
{ {
BOOL enabled; // DWM Composition is always enabled on Win8+
BOOL enabled = IsWindows8OrGreater();
// HACK: Disable WGL swap interval when desktop composition is enabled to // HACK: Disable WGL swap interval when desktop composition is enabled to
// avoid interfering with DWM vsync // avoid interfering with DWM vsync
if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) if (enabled ||
(SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled))
interval = 0; interval = 0;
} }
} }
if (_glfw.wgl.EXT_swap_control) if (_glfw.wgl.EXT_swap_control)
_glfw.wgl.SwapIntervalEXT(interval); wglSwapIntervalEXT(interval);
} }
static int extensionSupportedWGL(const char* extension) static int extensionSupportedWGL(const char* extension)
@ -303,9 +370,9 @@ static int extensionSupportedWGL(const char* extension)
const char* extensions = NULL; const char* extensions = NULL;
if (_glfw.wgl.GetExtensionsStringARB) if (_glfw.wgl.GetExtensionsStringARB)
extensions = _glfw.wgl.GetExtensionsStringARB(wglGetCurrentDC()); extensions = wglGetExtensionsStringARB(wglGetCurrentDC());
else if (_glfw.wgl.GetExtensionsStringEXT) else if (_glfw.wgl.GetExtensionsStringEXT)
extensions = _glfw.wgl.GetExtensionsStringEXT(); extensions = wglGetExtensionsStringEXT();
if (!extensions) if (!extensions)
return GLFW_FALSE; return GLFW_FALSE;
@ -322,8 +389,6 @@ static GLFWglproc getProcAddressWGL(const char* procname)
return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname); return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname);
} }
// Destroy the OpenGL context
//
static void destroyContextWGL(_GLFWwindow* window) static void destroyContextWGL(_GLFWwindow* window)
{ {
if (window->context.wgl.handle) if (window->context.wgl.handle)
@ -377,7 +442,7 @@ GLFWbool _glfwInitWGL(void)
// NOTE: This code will accept the Microsoft GDI ICD; accelerated context // NOTE: This code will accept the Microsoft GDI ICD; accelerated context
// creation failure occurs during manual pixel format enumeration // creation failure occurs during manual pixel format enumeration
dc = GetDC(_glfw.win32.helperWindowHandle);; dc = GetDC(_glfw.win32.helperWindowHandle);
ZeroMemory(&pfd, sizeof(pfd)); ZeroMemory(&pfd, sizeof(pfd));
pfd.nSize = sizeof(pfd); pfd.nSize = sizeof(pfd);
@ -468,7 +533,7 @@ void _glfwTerminateWGL(void)
#define setAttrib(a, v) \ #define setAttrib(a, v) \
{ \ { \
assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
attribs[index++] = a; \ attribs[index++] = a; \
attribs[index++] = v; \ attribs[index++] = v; \
} }
@ -628,8 +693,7 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
setAttrib(0, 0); setAttrib(0, 0);
window->context.wgl.handle = window->context.wgl.handle =
_glfw.wgl.CreateContextAttribsARB(window->context.wgl.dc, wglCreateContextAttribsARB(window->context.wgl.dc, share, attribs);
share, attribs);
if (!window->context.wgl.handle) if (!window->context.wgl.handle)
{ {
const DWORD error = GetLastError(); const DWORD error = GetLastError();

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 WGL - www.glfw.org // GLFW 3.4 WGL - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -76,12 +76,19 @@
#define ERROR_INVALID_PROFILE_ARB 0x2096 #define ERROR_INVALID_PROFILE_ARB 0x2096
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
// WGL extension pointer typedefs
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int); typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*); typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC); typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*); typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
#define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
#define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
#define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
#define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
#define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
// opengl32.dll function pointer typedefs
typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC); typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC); typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR); typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
@ -89,8 +96,6 @@ typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void); typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC); typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC); typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
// opengl32.dll function pointer typedefs
#define wglCreateContext _glfw.wgl.CreateContext #define wglCreateContext _glfw.wgl.CreateContext
#define wglDeleteContext _glfw.wgl.DeleteContext #define wglDeleteContext _glfw.wgl.DeleteContext
#define wglGetProcAddress _glfw.wgl.GetProcAddress #define wglGetProcAddress _glfw.wgl.GetProcAddress

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 Win32 - www.glfw.org // GLFW 3.4 Win32 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -329,27 +331,30 @@ static void createKeyTables(void)
// Creates a dummy window for behind-the-scenes work // Creates a dummy window for behind-the-scenes work
// //
static HWND createHelperWindow(void) static GLFWbool createHelperWindow(void)
{ {
MSG msg; MSG msg;
HWND window = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW,
_GLFW_WNDCLASSNAME, _glfw.win32.helperWindowHandle =
L"GLFW message window", CreateWindowExW(WS_EX_OVERLAPPEDWINDOW,
WS_CLIPSIBLINGS | WS_CLIPCHILDREN, _GLFW_WNDCLASSNAME,
0, 0, 1, 1, L"GLFW message window",
NULL, NULL, WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
GetModuleHandleW(NULL), 0, 0, 1, 1,
NULL); NULL, NULL,
if (!window) GetModuleHandleW(NULL),
NULL);
if (!_glfw.win32.helperWindowHandle)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"Win32: Failed to create helper window"); "Win32: Failed to create helper window");
return NULL; return GLFW_FALSE;
} }
// HACK: The command to the first ShowWindow call is ignored if the parent // HACK: The command to the first ShowWindow call is ignored if the parent
// process passed along a STARTUPINFO, so clear that with a no-op call // process passed along a STARTUPINFO, so clear that with a no-op call
ShowWindow(window, SW_HIDE); ShowWindow(_glfw.win32.helperWindowHandle, SW_HIDE);
// Register for HID device notifications // Register for HID device notifications
{ {
@ -360,7 +365,7 @@ static HWND createHelperWindow(void)
dbi.dbcc_classguid = GUID_DEVINTERFACE_HID; dbi.dbcc_classguid = GUID_DEVINTERFACE_HID;
_glfw.win32.deviceNotificationHandle = _glfw.win32.deviceNotificationHandle =
RegisterDeviceNotificationW(window, RegisterDeviceNotificationW(_glfw.win32.helperWindowHandle,
(DEV_BROADCAST_HDR*) &dbi, (DEV_BROADCAST_HDR*) &dbi,
DEVICE_NOTIFY_WINDOW_HANDLE); DEVICE_NOTIFY_WINDOW_HANDLE);
} }
@ -371,7 +376,7 @@ static HWND createHelperWindow(void)
DispatchMessageW(&msg); DispatchMessageW(&msg);
} }
return window; return GLFW_TRUE;
} }
@ -449,7 +454,7 @@ void _glfwInputErrorWin32(int error, const char* description)
GetLastError() & 0xffff, GetLastError() & 0xffff,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer, buffer,
sizeof(buffer), sizeof(buffer) / sizeof(WCHAR),
NULL); NULL);
WideCharToMultiByte(CP_UTF8, 0, buffer, -1, message, sizeof(message), NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, buffer, -1, message, sizeof(message), NULL, NULL);
@ -571,8 +576,7 @@ int _glfwPlatformInit(void)
if (!_glfwRegisterWindowClassWin32()) if (!_glfwRegisterWindowClassWin32())
return GLFW_FALSE; return GLFW_FALSE;
_glfw.win32.helperWindowHandle = createHelperWindow(); if (!createHelperWindow())
if (!_glfw.win32.helperWindowHandle)
return GLFW_FALSE; return GLFW_FALSE;
_glfwInitTimerWin32(); _glfwInitTimerWin32();
@ -610,7 +614,7 @@ void _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
return _GLFW_VERSION_NUMBER " Win32 WGL EGL" return _GLFW_VERSION_NUMBER " Win32 WGL EGL OSMesa"
#if defined(__MINGW32__) #if defined(__MINGW32__)
" MinGW" " MinGW"
#elif defined(_MSC_VER) #elif defined(_MSC_VER)

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 Win32 - www.glfw.org // GLFW 3.4 Win32 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -260,6 +262,8 @@ static void closeJoystick(_GLFWjoystick* js)
IDirectInputDevice8_Release(js->win32.device); IDirectInputDevice8_Release(js->win32.device);
} }
free(js->win32.objects);
_glfwFreeJoystick(js); _glfwFreeJoystick(js);
_glfwInputJoystick(js, GLFW_DISCONNECTED); _glfwInputJoystick(js, GLFW_DISCONNECTED);
} }
@ -412,7 +416,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.device = device; data.device = device;
data.objects = calloc(dc.dwAxes + dc.dwButtons + dc.dwPOVs, data.objects = calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
sizeof(_GLFWjoyobjectWin32)); sizeof(_GLFWjoyobjectWin32));
if (FAILED(IDirectInputDevice8_EnumObjects(device, if (FAILED(IDirectInputDevice8_EnumObjects(device,
@ -743,7 +747,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
if (strcmp(guid + 20, "504944564944") == 0) if (strcmp(guid + 20, "504944564944") == 0)
{ {
char original[33]; char original[33];
strcpy(original, guid); strncpy(original, guid, sizeof(original) - 1);
sprintf(guid, "03000000%.4s0000%.4s000000000000", sprintf(guid, "03000000%.4s0000%.4s000000000000",
original, original + 4); original, original + 4);
} }

View File

@ -1,7 +1,7 @@
//======================================================================== //========================================================================
// GLFW 3.3 Win32 - www.glfw.org // GLFW 3.4 Win32 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 Win32 - www.glfw.org // GLFW 3.4 Win32 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -361,6 +363,23 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
_glfwGetMonitorContentScaleWin32(monitor->win32.handle, xscale, yscale); _glfwGetMonitorContentScaleWin32(monitor->win32.handle, xscale, yscale);
} }
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
int* xpos, int* ypos,
int* width, int* height)
{
MONITORINFO mi = { sizeof(mi) };
GetMonitorInfo(monitor->win32.handle, &mi);
if (xpos)
*xpos = mi.rcWork.left;
if (ypos)
*ypos = mi.rcWork.top;
if (width)
*width = mi.rcWork.right - mi.rcWork.left;
if (height)
*height = mi.rcWork.bottom - mi.rcWork.top;
}
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
{ {
int modeIndex = 0, size = 0; int modeIndex = 0, size = 0;
@ -455,7 +474,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
&mode->blueBits); &mode->blueBits);
} }
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{ {
HDC dc; HDC dc;
WORD values[768]; WORD values[768];
@ -469,6 +488,8 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short)); memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short)); memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short)); memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
return GLFW_TRUE;
} }
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 Win32 - www.glfw.org // GLFW 3.4 Win32 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -61,6 +61,9 @@
// GLFW uses DirectInput8 interfaces // GLFW uses DirectInput8 interfaces
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
// GLFW uses OEM cursor resources
#define OEMRESOURCE
#include <wctype.h> #include <wctype.h>
#include <windows.h> #include <windows.h>
#include <dinput.h> #include <dinput.h>
@ -98,12 +101,18 @@
#ifndef _WIN32_WINNT_WINBLUE #ifndef _WIN32_WINNT_WINBLUE
#define _WIN32_WINNT_WINBLUE 0x0602 #define _WIN32_WINNT_WINBLUE 0x0602
#endif #endif
#ifndef _WIN32_WINNT_WIN8
#define _WIN32_WINNT_WIN8 0x0602
#endif
#ifndef WM_GETDPISCALEDSIZE #ifndef WM_GETDPISCALEDSIZE
#define WM_GETDPISCALEDSIZE 0x02e4 #define WM_GETDPISCALEDSIZE 0x02e4
#endif #endif
#ifndef USER_DEFAULT_SCREEN_DPI #ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96 #define USER_DEFAULT_SCREEN_DPI 96
#endif #endif
#ifndef OCR_HAND
#define OCR_HAND 32649
#endif
#if WINVER < 0x0601 #if WINVER < 0x0601
typedef struct typedef struct
@ -203,7 +212,7 @@ typedef enum
// HACK: Define macros that some dinput.h variants don't // HACK: Define macros that some dinput.h variants don't
#ifndef DIDFT_OPTIONAL #ifndef DIDFT_OPTIONAL
#define DIDFT_OPTIONAL 0x80000000 #define DIDFT_OPTIONAL 0x80000000
#endif #endif
// winmm.dll function pointer typedefs // winmm.dll function pointer typedefs

View File

@ -1,8 +1,8 @@
//======================================================================== //========================================================================
// GLFW 3.3 Win32 - www.glfw.org // GLFW 3.4 Win32 - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org> // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages // warranty. In no event will the authors be held liable for any damages
@ -24,6 +24,8 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

Some files were not shown because too many files have changed in this diff Show More