mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 07:05:49 +00:00
Compare commits
240 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eab31f228f | |||
| d937b74b8f | |||
| 0e8dace18c | |||
| b17bed28c8 | |||
| 4eea3175f1 | |||
| cf458fa7a2 | |||
| 8ac7cab100 | |||
| 0108a6bdeb | |||
| 402189ba14 | |||
| 61ccb034d0 | |||
| 50c694fab4 | |||
| a18b187494 | |||
| 5668eb0732 | |||
| 56e600d7a1 | |||
| 2ae46fa90a | |||
| 0c0bb28d39 | |||
| ed98e06651 | |||
| 06289110e7 | |||
| 8443848637 | |||
| 823cc38ac1 | |||
| 5ef4f77fb5 | |||
| e0ee90d50c | |||
| 171538d01c | |||
| c21745c886 | |||
| 2db0401a57 | |||
| 9979da59e3 | |||
| 8b1b322771 | |||
| 0ccbddf767 | |||
| 23021422f3 | |||
| bb3f29d8bc | |||
| 87e6417353 | |||
| 95c7029e19 | |||
| 45368f410a | |||
| a79b93f5bc | |||
| 4fe88a52fa | |||
| a5b6a306ae | |||
| 109e3d13ed | |||
| 7af99bce88 | |||
| d82095d7ea | |||
| 76afd41727 | |||
| bc625b21b3 | |||
| adbd52ba27 | |||
| b9d4875f3e | |||
| a79c844c4d | |||
| b13c84f854 | |||
| b410cff68c | |||
| 4013f733fe | |||
| cc4c7167fd | |||
| 6c12ffc902 | |||
| a83d257ac6 | |||
| ec5cb9c6f7 | |||
| e7c7ebf665 | |||
| cc7f0bd532 | |||
| 97ae40496d | |||
| e4a87b8a1c | |||
| f18aef4aec | |||
| 1cbd06c8a2 | |||
| 785e68bb0d | |||
| 86e50b1044 | |||
| eabbb20d17 | |||
| 0153dab346 | |||
| 1a4ffa497a | |||
| 58045a5c07 | |||
| 7d1ae7aea7 | |||
| 174c72f2c0 | |||
| b9fb45f408 | |||
| 9c4b925a96 | |||
| 394c44ccf9 | |||
| baf100f78c | |||
| 5be45d214b | |||
| e309a784d1 | |||
| 99f40ede1b | |||
| db8e6bed7a | |||
| 6172e2cfcc | |||
| bc8ff545ca | |||
| e576bdc894 | |||
| d78510457c | |||
| dbdf01d4a0 | |||
| 7ef7beb9fb | |||
| 16e63adc40 | |||
| e85455719d | |||
| 23ff318f59 | |||
| 0041699048 | |||
| a5df39e14f | |||
| 4175c9edea | |||
| 1695fd08f0 | |||
| 2c920fbb8b | |||
| 7dd8770e6f | |||
| 9c15e2ff86 | |||
| 7775c87cd6 | |||
| 1047d5646d | |||
| fa765ee719 | |||
| 50850602b2 | |||
| 553cc8ac96 | |||
| f2a04a56a4 | |||
| a8ff81fd8a | |||
| aab08712dd | |||
| 99784fb8f0 | |||
| 0e7c6e1d82 | |||
| 4e3c990656 | |||
| e9694cca47 | |||
| 9e0c07b7ba | |||
| 209de7b56d | |||
| 16a8fafab2 | |||
| 6e68d89e0f | |||
| 9c5d9f8614 | |||
| 161065ac19 | |||
| 2053767709 | |||
| 55530dbd14 | |||
| 12f0d8d4ca | |||
| 34f1c298b6 | |||
| 8194f1e2ae | |||
| a7af3b2c8f | |||
| 6d9d85670f | |||
| 521fa7d005 | |||
| 5759d0fdf2 | |||
| 07db5daa61 | |||
| 201d0a78b1 | |||
| 1f6696d433 | |||
| 59422ec980 | |||
| fd3813f0d9 | |||
| 25eb8dc277 | |||
| ebe38eedd8 | |||
| 96c5aea3ba | |||
| cca61d752d | |||
| 6af51e049f | |||
| 3af1c411ca | |||
| d3f22b8a04 | |||
| fd4ea8bc25 | |||
| d3f3e2d6c5 | |||
| 546c794321 | |||
| d69796d9e0 | |||
| 4ff8095dee | |||
| 3415f3ccde | |||
| 6770ae0556 | |||
| bb5581690d | |||
| 57b8be1c24 | |||
| c93b120252 | |||
| 5cf8587269 | |||
| b998d4fe01 | |||
| d0a0e37b2b | |||
| 3f74712540 | |||
| 124bc392ab | |||
| 8c1588b14e | |||
| 58aef89521 | |||
| f54b4e174d | |||
| 83f57ff0ce | |||
| 71c07feffd | |||
| 9c20737b60 | |||
| 951f02acf3 | |||
| 735bc2d815 | |||
| a024e61bf8 | |||
| 082fc019c7 | |||
| ffb699fb06 | |||
| d318de7c00 | |||
| 68bd6687d6 | |||
| a3ca7ad93a | |||
| 261f290abf | |||
| 63a191eb8d | |||
| a6a5fa937c | |||
| 670070e61a | |||
| 3cfc400cf9 | |||
| 6e85924bd3 | |||
| f7282e86c0 | |||
| 9d0e102135 | |||
| 5b8ff4a2fc | |||
| c99b7fe7da | |||
| bd2d571c31 | |||
| bea59f64b2 | |||
| 00d004a528 | |||
| 53cf4a3b4d | |||
| 7e8c7843c5 | |||
| 5655e26315 | |||
| 0463e196b4 | |||
| b12c973922 | |||
| f1397843ee | |||
| 6632cc7c1d | |||
| 45653c5549 | |||
| f67c7b49ab | |||
| 50b2961d34 | |||
| d10eff4531 | |||
| e67ee935a2 | |||
| 41a1374744 | |||
| c8b01f61d6 | |||
| 3b4eb2f0a0 | |||
| d20aa0428a | |||
| 1c80e99008 | |||
| 0e12fb869c | |||
| a55c3f48eb | |||
| 4b7ae4918b | |||
| 763ec6cbcb | |||
| dcb4d8ee32 | |||
| 58c69a9ac4 | |||
| 7a03ca8dbc | |||
| d7512f529c | |||
| 209a470a5f | |||
| 1947557eb1 | |||
| 621753e8a8 | |||
| fca5a4687c | |||
| 5f37d36d4a | |||
| 2656bf8f9f | |||
| 194e22dbbe | |||
| 4883073b91 | |||
| a17dad4f44 | |||
| 2ce9e8e6b2 | |||
| b6b57b5249 | |||
| 659157928e | |||
| 933005a022 | |||
| 3be3f58a92 | |||
| e11a5e3973 | |||
| 96259004be | |||
| 5c54987285 | |||
| c10bf9ba9c | |||
| 5ae2e376a2 | |||
| f5f55e3ff8 | |||
| 10017b27bb | |||
| 1de60a4ff7 | |||
| 01ccc56423 | |||
| 305c66db31 | |||
| 22e1aa6cfc | |||
| 1c79d8a8e4 | |||
| d5cd6ec8eb | |||
| eba8168a03 | |||
| a7ff236b32 | |||
| d31322cdcd | |||
| 61f7de5a25 | |||
| e4d9e03efc | |||
| bff77eeed1 | |||
| e93bade240 | |||
| f1c88b41f2 | |||
| 77e4c61190 | |||
| 3a5fcfba06 | |||
| c9bd191edb | |||
| 77572bdf6e | |||
| ccb810bed9 | |||
| fdaebdd169 | |||
| 74d355fae4 | |||
| 2cc2e8acd7 | |||
| dbef5ea46b | |||
| c38f33adda |
+2
-1
@@ -21,7 +21,7 @@ cmake_uninstall.cmake
|
||||
docs/Doxyfile
|
||||
docs/html
|
||||
docs/warnings.txt
|
||||
src/config.h
|
||||
src/glfw_config.h
|
||||
src/glfw3.pc
|
||||
src/glfwConfig.cmake
|
||||
src/glfwConfigVersion.cmake
|
||||
@@ -38,6 +38,7 @@ src/libglfw3.a
|
||||
src/glfw3.lib
|
||||
src/glfw3.dll
|
||||
src/glfw3dll.lib
|
||||
src/glfw3dll.a
|
||||
examples/*.app
|
||||
examples/*.exe
|
||||
examples/boing
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
This directory contains a collection of toolchain definitions for
|
||||
cross-compiling for Windows using MinGW on various other systems.
|
||||
|
||||
To use these files you add a special parameter when configuring the source tree:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
|
||||
|
||||
The exact file to use depends on the prefix used by the MinGW binaries on your
|
||||
system. You can usually see this in the /usr directory, i.e. the Ubuntu
|
||||
MinGW-w64 packages have /usr/x86_64-w64-mingw32 for the 64-bit compilers, so the
|
||||
correct invocation would be:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
|
||||
|
||||
For more details see this article:
|
||||
|
||||
http://www.paraview.org/Wiki/CMake_Cross_Compiling
|
||||
|
||||
+129
-123
@@ -4,31 +4,40 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(GLFW_VERSION_MAJOR "3")
|
||||
set(GLFW_VERSION_MINOR "0")
|
||||
set(GLFW_VERSION_PATCH "0")
|
||||
set(GLFW_VERSION_PATCH "4")
|
||||
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")
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
|
||||
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||
option(GLFW_INSTALL "Generate installation target" ON)
|
||||
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
||||
if (GLFW_DOCUMENT_INTERNALS)
|
||||
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||
|
||||
if (WIN32)
|
||||
option(GLFW_USE_DWM_SWAP_INTERVAL "Set swap interval even when DWM compositing is enabled" OFF)
|
||||
option(GLFW_USE_OPTIMUS_HPG "Force use of high-performance GPU on Optimus systems" OFF)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||
option(GLFW_USE_CHDIR "Make glfwInit chdir to Contents/Resources" ON)
|
||||
option(GLFW_USE_MENUBAR "Populate the menu bar on first window creation" ON)
|
||||
else()
|
||||
option(GLFW_USE_EGL "Use EGL for context creation" OFF)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_BUILD_DLL 1)
|
||||
endif()
|
||||
|
||||
if (GLFW_USE_EGL)
|
||||
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
|
||||
"The client library to use; one of opengl, glesv1 or glesv2")
|
||||
@@ -65,23 +74,47 @@ endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Enable all warnings on GCC, regardless of OS
|
||||
#--------------------------------------------------------------------
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
add_definitions(-Wall)
|
||||
if (GLFW_BUILD_DOCS)
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
|
||||
if (GLFW_DOCUMENT_INTERNALS)
|
||||
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Export shared library / dynamic library / DLL build option
|
||||
# Set compiler specific flags
|
||||
#--------------------------------------------------------------------
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_BUILD_DLL 1)
|
||||
if (UNIX)
|
||||
if (UNIX)
|
||||
add_definitions(-Wall)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-fvisibility=hidden)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||
foreach (flag CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
|
||||
if (${flag} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||
endif()
|
||||
if (${flag} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Detect and select backend APIs
|
||||
#--------------------------------------------------------------------
|
||||
@@ -120,33 +153,26 @@ endif()
|
||||
# Use Win32 for window creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_WIN32)
|
||||
|
||||
if (MSVC)
|
||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||
|
||||
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||
foreach (flag CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||
|
||||
if (${flag} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||
endif()
|
||||
if (${flag} MATCHES "/MDd")
|
||||
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(_GLFW_NO_DLOAD_WINMM ${BUILD_SHARED_LIBS})
|
||||
|
||||
# The DLL links against winmm; the static library loads it
|
||||
# That way, both code paths receive testing
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_NO_DLOAD_WINMM 1)
|
||||
list(APPEND glfw_LIBRARIES winmm)
|
||||
endif()
|
||||
|
||||
if (GLFW_USE_DWM_SWAP_INTERVAL)
|
||||
set(_GLFW_USE_DWM_SWAP_INTERVAL 1)
|
||||
endif()
|
||||
if (GLFW_USE_OPTIMUS_HPG)
|
||||
set(_GLFW_USE_OPTIMUS_HPG 1)
|
||||
endif()
|
||||
|
||||
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
||||
# the inclusion of stddef.h (by glfw3.h), which is itself included before
|
||||
# win32_platform.h. We define them here until a saner solution can be found
|
||||
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
||||
add_definitions(-DUNICODE)
|
||||
add_definitions(-DWINVER=0x0501)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@@ -188,7 +214,13 @@ if (_GLFW_X11)
|
||||
endif()
|
||||
|
||||
list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH})
|
||||
list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
|
||||
|
||||
if (X11_Xinput_LIB)
|
||||
list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
|
||||
else()
|
||||
# Backwards compatibility (bug in CMake 2.8.7)
|
||||
list(APPEND glfw_LIBRARIES Xi)
|
||||
endif()
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi")
|
||||
|
||||
# Check for Xf86VidMode (fallback gamma control)
|
||||
@@ -199,11 +231,10 @@ if (_GLFW_X11)
|
||||
list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH})
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm")
|
||||
|
||||
# NOTE: This is a workaround for CMake bug 0006976 (missing
|
||||
# X11_xf86vmode_LIB variable)
|
||||
if (X11_xf86vmode_LIB)
|
||||
list(APPEND glfw_LIBRARIES ${X11_xf86vmode_LIB})
|
||||
if (X11_Xxf86vm_LIB)
|
||||
list(APPEND glfw_LIBRARIES ${X11_Xxf86vm_LIB})
|
||||
else()
|
||||
# Backwards compatibility (see CMake bug 0006976)
|
||||
list(APPEND glfw_LIBRARIES Xxf86vm)
|
||||
endif()
|
||||
|
||||
@@ -243,16 +274,9 @@ if (_GLFW_GLX)
|
||||
include(CheckFunctionExists)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||
endif()
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||
endif()
|
||||
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
|
||||
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||
|
||||
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
|
||||
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
|
||||
@@ -261,23 +285,15 @@ if (_GLFW_GLX)
|
||||
|
||||
# Check for dlopen support as a fallback
|
||||
|
||||
find_library(DL_LIBRARY dl)
|
||||
mark_as_advanced(DL_LIBRARY)
|
||||
if (DL_LIBRARY)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY})
|
||||
else()
|
||||
set(CMAKE_REQUIRED_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
check_function_exists(dlopen _GLFW_HAS_DLOPEN)
|
||||
|
||||
if (NOT _GLFW_HAS_DLOPEN)
|
||||
message(FATAL_ERROR "No entry point retrieval mechanism found")
|
||||
endif()
|
||||
|
||||
if (DL_LIBRARY)
|
||||
list(APPEND glfw_LIBRARIES ${DL_LIBRARY})
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -ldl")
|
||||
if (CMAKE_DL_LIBS)
|
||||
list(APPEND glfw_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -l${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -291,8 +307,6 @@ if (_GLFW_EGL)
|
||||
list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${EGL_LIBRARY})
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${EGL_LIBRARY})
|
||||
|
||||
if (UNIX)
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl")
|
||||
endif()
|
||||
@@ -318,8 +332,6 @@ endif()
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
|
||||
option(GLFW_BUILD_UNIVERSAL "Build GLFW as a Universal Binary" OFF)
|
||||
|
||||
if (GLFW_USE_MENUBAR)
|
||||
set(_GLFW_USE_MENUBAR 1)
|
||||
endif()
|
||||
@@ -328,7 +340,6 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
set(_GLFW_USE_CHDIR 1)
|
||||
endif()
|
||||
|
||||
# Universal build
|
||||
if (GLFW_BUILD_UNIVERSAL)
|
||||
message(STATUS "Building GLFW as Universal Binaries")
|
||||
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
||||
@@ -340,13 +351,15 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
find_library(COCOA_FRAMEWORK Cocoa)
|
||||
find_library(IOKIT_FRAMEWORK IOKit)
|
||||
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
|
||||
find_library(CORE_VIDEO_FRAMEWORK CoreVideo)
|
||||
list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK}
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${IOKIT_FRAMEWORK}
|
||||
${CORE_FOUNDATION_FRAMEWORK})
|
||||
${CORE_FOUNDATION_FRAMEWORK}
|
||||
${CORE_VIDEO_FRAMEWORK})
|
||||
|
||||
set(GLFW_PKG_DEPS "")
|
||||
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation")
|
||||
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@@ -364,6 +377,26 @@ else()
|
||||
set(GLFW_LIB_NAME glfw3)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Create generated files
|
||||
#--------------------------------------------------------------------
|
||||
configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in
|
||||
${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY)
|
||||
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfw_config.h.in
|
||||
${GLFW_BINARY_DIR}/src/glfw_config.h @ONLY)
|
||||
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in
|
||||
${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY)
|
||||
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in
|
||||
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake @ONLY)
|
||||
|
||||
if (UNIX)
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfw3.pc.in
|
||||
${GLFW_BINARY_DIR}/src/glfw3.pc @ONLY)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Add subdirectories
|
||||
#--------------------------------------------------------------------
|
||||
@@ -377,63 +410,36 @@ if (GLFW_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
if (DOXYGEN_FOUND)
|
||||
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Create generated files
|
||||
# Install files other than the library
|
||||
# The library is installed by src/CMakeLists.txt
|
||||
#--------------------------------------------------------------------
|
||||
configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in
|
||||
${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY)
|
||||
if (GLFW_INSTALL)
|
||||
install(DIRECTORY include/GLFW DESTINATION include
|
||||
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
||||
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/config.h.in
|
||||
${GLFW_BINARY_DIR}/src/config.h @ONLY)
|
||||
install(FILES ${GLFW_BINARY_DIR}/src/glfwConfig.cmake
|
||||
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake
|
||||
DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Install the public headers
|
||||
# The src directory's CMakeLists.txt file installs the library
|
||||
#--------------------------------------------------------------------
|
||||
install(DIRECTORY include/GLFW DESTINATION include
|
||||
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
||||
if (UNIX)
|
||||
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||
install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc
|
||||
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Create and install glfwConfig.cmake and glfwConfigVersion files
|
||||
#--------------------------------------------------------------------
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in
|
||||
${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY)
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in
|
||||
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake @ONLY)
|
||||
# Only generate this target if no higher-level project already has
|
||||
if (NOT TARGET uninstall)
|
||||
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||
|
||||
install(FILES ${GLFW_BINARY_DIR}/src/glfwConfig.cmake
|
||||
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake
|
||||
DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||
|
||||
if (UNIX)
|
||||
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Create and install pkg-config file on supported platforms
|
||||
#--------------------------------------------------------------------
|
||||
if (UNIX)
|
||||
configure_file(${GLFW_SOURCE_DIR}/src/glfw3.pc.in
|
||||
${GLFW_BINARY_DIR}/src/glfw3.pc @ONLY)
|
||||
|
||||
install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc
|
||||
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Uninstall operation
|
||||
# Don't generate this target if a higher-level project already has
|
||||
#--------------------------------------------------------------------
|
||||
if (NOT TARGET uninstall)
|
||||
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
${CMAKE_COMMAND} -P
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
add_custom_target(uninstall
|
||||
${CMAKE_COMMAND} -P
|
||||
${GLFW_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# GLFW 3.0
|
||||
# GLFW
|
||||
|
||||
## Introduction
|
||||
|
||||
@@ -6,279 +6,82 @@ GLFW is a free, Open Source, portable library for OpenGL and OpenGL ES
|
||||
application development. It provides a simple, platform-independent API for
|
||||
creating windows and contexts, reading input, handling events, etc.
|
||||
|
||||
Version 3.0 brings a new API with many new features such as multiple windows
|
||||
and contexts, multi-monitor support, EGL and OpenGL ES support, clipboard text
|
||||
support, an error description callback, gamma ramp control, layout-independent
|
||||
keyboard input and UTF-8 for all strings.
|
||||
|
||||
GLFW is now hosted on [GitHub](https://github.com/glfw/glfw).
|
||||
Version 3.0.4 adds better support for custom build environments and fixes for
|
||||
a large number of bugs that together affect all supported platforms. As this is
|
||||
a patch release, there are no API changes.
|
||||
|
||||
If you are new to GLFW, you may find the
|
||||
[introductory tutorial](http://www.glfw.org/docs/3.0/quick.html) for GLFW
|
||||
3 useful. If
|
||||
you have used GLFW 2 in the past, there is a
|
||||
[transition guide](http://www.glfw.org/docs/3.0/moving.html) for moving to the
|
||||
GLFW 3 API.
|
||||
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
|
||||
3 useful. If you have used GLFW 2 in the past, there is a
|
||||
[transition guide](http://www.glfw.org/docs/latest/moving.html) for moving to
|
||||
the GLFW 3 API.
|
||||
|
||||
|
||||
## Compiling GLFW
|
||||
|
||||
To compile GLFW and the accompanying example programs, you will need the
|
||||
[CMake](http://www.cmake.org/) build system.
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
#### X11 dependencies
|
||||
|
||||
To compile GLFW for X11 and GLX, you need to have the X and OpenGL header
|
||||
packages installed. For example, on Ubuntu and other distributions based on
|
||||
Debian GNU/Linux, you need to install the `xorg-dev` and `libglu1-mesa-dev`
|
||||
packages. Note that using header files from Mesa *will not* tie your binary to
|
||||
the Mesa implementation of OpenGL.
|
||||
|
||||
|
||||
### CMake options
|
||||
|
||||
There are a number of CMake build options for GLFW, although not all are
|
||||
available on all supported platforms. Some of these are de facto standards
|
||||
among CMake users and so have no `GLFW_` prefix.
|
||||
|
||||
|
||||
#### Shared options
|
||||
|
||||
`BUILD_SHARED_LIBS` determines whether GLFW is built as a static
|
||||
library or as a DLL / shared library / dynamic library.
|
||||
|
||||
`LIB_SUFFIX` affects where the GLFW shared /dynamic library is
|
||||
installed. If it is empty, it is installed to `$PREFIX/lib`. If it is set to
|
||||
`64`, it is installed to `$PREFIX/lib64`.
|
||||
|
||||
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
|
||||
along with the library.
|
||||
|
||||
`GLFW_BUILD_TESTS` determines whether the GLFW test programs are
|
||||
built along with the library.
|
||||
|
||||
|
||||
#### Mac OS X specific options
|
||||
|
||||
`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current
|
||||
directory of bundled applications to the `Contents/Resources` directory.
|
||||
|
||||
`GLFW_USE_MENUBAR` determines whether the first call to
|
||||
`glfwCreateWindow` sets up a minimal menu bar.
|
||||
|
||||
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
|
||||
|
||||
|
||||
#### Windows specific options
|
||||
|
||||
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version of the
|
||||
Visual C++ runtime library.
|
||||
|
||||
|
||||
#### EGL specific options
|
||||
|
||||
`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific
|
||||
context creation API. Note that EGL is not yet provided on all supported
|
||||
platforms.
|
||||
|
||||
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
|
||||
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
|
||||
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
|
||||
selected library and its header files must be present on the system for this to
|
||||
work.
|
||||
|
||||
|
||||
## Installing GLFW
|
||||
|
||||
A rudimentary installation target is provided for all supported platforms via
|
||||
CMake.
|
||||
See the [Compiling GLFW](http://www.glfw.org/docs/latest/compile.html) guide in
|
||||
the GLFW documentation.
|
||||
|
||||
|
||||
## Using GLFW
|
||||
|
||||
See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/).
|
||||
See the
|
||||
[Building programs that use GLFW](http://www.glfw.org/docs/latest/build.html)
|
||||
guide in the GLFW documentation.
|
||||
|
||||
|
||||
## Changes for version 3.0
|
||||
## Changelog
|
||||
|
||||
- Added `GLFWmonitor` and updated monitor-related functions to take a monitor
|
||||
handle
|
||||
- Added `glfwGetMonitors` and `glfwGetPrimaryMonitor` for enumerating available
|
||||
monitors
|
||||
- Added `glfwGetMonitorPos`, `glfwGetMonitorPhysicalSize` and
|
||||
`glfwGetMonitorName` for retrieving monitor properties
|
||||
- Added `glfwSetMonitorCallback` and `GLFWmonitorfun` for notification of
|
||||
changes in the set of available monitors
|
||||
- Added `GLFWwindow` and updated window-related functions and callbacks to take
|
||||
a window handle
|
||||
- Added `glfwSetWindowShouldClose` and `glfwWindowShouldClose` for setting and
|
||||
retrieving the window close flag
|
||||
- Added `glfwGetWindowPos` for retrieving the position of a window
|
||||
- Added `glfwDefaultWindowHints` for resetting all window hints to their
|
||||
default values
|
||||
- Added `glfwMakeContextCurrent` for making the context of the specified window
|
||||
current
|
||||
- Added `glfwSetErrorCallback`, `GLFWerrorfun` and error type tokens for
|
||||
receiving error notifications
|
||||
- Added `glfwSetWindowUserPointer` and `glfwGetWindowUserPointer` for
|
||||
per-window user pointers
|
||||
- Added `glfwGetVersionString` for determining which code paths were enabled at
|
||||
compile time
|
||||
- Added `glfwGetWindowMonitor` for querying the monitor, if any, of the
|
||||
specified window
|
||||
- Added `glfwGetFramebufferSize` and `glfwSetFramebufferSizeCallback` for
|
||||
receiving the current size, in pixels, of the framebuffer
|
||||
- Added `glfwSetWindowPosCallback` and `GLFWwindowposfun` for receiving window
|
||||
position events
|
||||
- Added `glfwSetWindowFocusCallback` and `GLFWwindowfocusfun` for receiving
|
||||
window focus events
|
||||
- Added `glfwSetWindowIconifyCallback` and `GLFWwindowiconifyfun` for receiving
|
||||
window iconification events
|
||||
- Added `glfwGetClipboardString` and `glfwSetClipboardString` for interacting
|
||||
with the system clipboard
|
||||
- Added `glfwGetJoystickName` for retrieving the name of a joystick
|
||||
- Added `glfwGetCurrentContext` for retrieving the window whose OpenGL context
|
||||
is current
|
||||
- Added `GLFW_SRGB_CAPABLE` for requesting sRGB capable framebuffers
|
||||
- Added `GLFW_CLIENT_API` and its values `GLFW_OPENGL_API` and
|
||||
`GLFW_OPENGL_ES_API` for selecting client API
|
||||
- Added `GLFW_CONTEXT_ROBUSTNESS` and values `GLFW_NO_ROBUSTNESS`,
|
||||
`GLFW_NO_RESET_NOTIFICATION` and `GLFW_LOSE_CONTEXT_ON_RESET` for
|
||||
`GL_ARB_robustness` support
|
||||
- Added `GLFW_OPENGL_REVISION` to make up for removal of `glfwGetGLVersion`
|
||||
- Added `GLFW_INCLUDE_GLCOREARB` macro for including `GL/glcorearb.h` instead of
|
||||
`GL/gl.h`
|
||||
- Added `GLFW_INCLUDE_ES1` macro for telling the GLFW header to use `GLES/gl.h`
|
||||
instead of `GL/gl.h`
|
||||
- Added `GLFW_INCLUDE_ES2` macro for telling the GLFW header to use
|
||||
`GLES2/gl2.h` instead of `GL/gl.h`
|
||||
- Added `GLFW_INCLUDE_NONE` macro for telling the GLFW header to not include
|
||||
any client API header
|
||||
- Added `GLFW_VISIBLE` window hint and parameter for controlling and polling
|
||||
window visibility
|
||||
- Added `GLFW_REPEAT` key action for repeated keys
|
||||
- Added scancode parameter to key callback
|
||||
- Added `refreshRate` member to `GLFWvidmode` struct
|
||||
- Added key modifier parameter to key and mouse button callbacks
|
||||
- Added `windows` simple multi-window test program
|
||||
- Added `sharing` simple OpenGL object sharing test program
|
||||
- Added `modes` video mode enumeration and setting test program
|
||||
- Added `threads` simple multi-threaded rendering test program
|
||||
- Added `glfw3native.h` header and platform-specific functions for explicit
|
||||
access to native display, window and context handles
|
||||
- Added `glfwSetGamma`, `glfwSetGammaRamp` and `glfwGetGammaRamp` functions and
|
||||
`GLFWgammaramp` type for monitor gamma ramp control
|
||||
- Added window parameter to `glfwSwapBuffers`
|
||||
- Changed buffer bit depth parameters of `glfwOpenWindow` to window hints
|
||||
- Changed `glfwCreateWindow` and `glfwSetWindowTitle` to use UTF-8 encoded
|
||||
strings
|
||||
- Changed `glfwGetProcAddress` to return a (generic) function pointer
|
||||
- Changed `glfwGetVideoModes` to return a dynamic, unlimited number of video
|
||||
modes for the specified monitor
|
||||
- Changed cursor position to double-precision floating-point
|
||||
- Changed default cursor mode for fullscreen to normal
|
||||
- Renamed header directory `GL` to `GLFW`
|
||||
- Renamed `glfw.h` to `glfw3.h` to avoid conflicts with 2.x series
|
||||
- Renamed `glfwOpenWindowHint` to `glfwWindowHint`
|
||||
- Renamed `glfwGetWindowParam` to `glfwGetWindowAttrib`
|
||||
- Renamed `GLFW_ACTIVE` to `GLFW_FOCUSED`
|
||||
- Renamed `GLFW_FSAA_SAMPLES` to `GLFW_SAMPLES`
|
||||
- Renamed `GLFW_WINDOW_NO_RESIZE` to `GLFW_RESIZABLE`
|
||||
- Renamed `GLFW_BUILD_DLL` to `_GLFW_BUILD_DLL`
|
||||
- Renamed `version` test to `glfwinfo`
|
||||
- Renamed `GLFW_NO_GLU` to `GLFW_INCLUDE_GLU` and made it disabled by default
|
||||
- Renamed `glfwGetJoystickPos` to `glfwGetJoystickAxes` to match
|
||||
`glfwGetJoystickButtons`
|
||||
- Renamed mouse position functions to cursor position equivalents
|
||||
- Replaced `glfwOpenWindow` and `glfwCloseWindow` with `glfwCreateWindow` and
|
||||
`glfwDestroyWindow`
|
||||
- Replaced `glfwGetDesktopMode` width `glfwGetVideoMode`
|
||||
- Replaced ad hoc build system with CMake
|
||||
- Replaced layout-dependent key codes with single, platform-independent set
|
||||
based on US layout
|
||||
- Replaced mouse wheel interface with two-dimensional, floating point scrolling
|
||||
interface
|
||||
- Replaced `glfwEnable` and `glfwDisable` with `glfwGetInputMode` and
|
||||
`glfwSetInputMode`
|
||||
- Replaced `joystick` test with graphical version
|
||||
- Replaced automatic closing of windows with the window close flag
|
||||
- Removed the `GLFW_KEY_REPEAT` input option
|
||||
- Removed event auto-polling and the `GLFW_AUTO_POLL_EVENTS` window enable
|
||||
- Removed the Win32 port .def files
|
||||
- Removed the entire threading API
|
||||
- Removed the entire image loading API
|
||||
- Removed deprecated Carbon port
|
||||
- Removed registering `glfwTerminate` with `atexit`
|
||||
- Removed `glfwSleep` function
|
||||
- Removed `glfwGetNumberOfProcessors` function
|
||||
- Removed `glfwGetGLVersion` function
|
||||
- Removed `GLFW_OPENED` window parameter
|
||||
- Removed `GLFW_WINDOW` and `GLFW_FULLSCREEN`
|
||||
- Removed nonsensical key actions for Unicode character input
|
||||
- Removed `GLFWCALL` and `GLFWAPIENTRY` macros for stdcall calling convention
|
||||
- Removed `GLFW_ACCELERATED` window parameter
|
||||
- Removed default framebuffer attributes from `glfwGetWindowParam`
|
||||
- Bugfix: The default OpenGL version in the `glfwinfo` test was set to 1.1
|
||||
- Bugfix: The OpenGL profile and forward-compatibility window parameters were
|
||||
not saved after context creation
|
||||
- Bugfix: The FSAA test did not check for the availability of
|
||||
`GL_ARB_multisample`
|
||||
- Bugfix: Cursor centering upon leaving captured cursor mode was reported
|
||||
before the mode was changed to non-captured
|
||||
- [Cocoa] Added support for OpenGL 3.2 core profile in 10.7 Lion and above
|
||||
- [Cocoa] Added support for high-DPI (Retina) monitors
|
||||
- [Cocoa] Added support for joysticks
|
||||
- [Cocoa] Postponed menu creation to first window creation
|
||||
- [Cocoa] Replaced `NSDate` time source with `mach_absolute_time`
|
||||
- [Cocoa] Replaced all deprecated CoreGraphics calls with non-deprecated
|
||||
counterparts
|
||||
- [Cocoa] Bugfix: The `NSOpenGLPFAFullScreen` pixel format attribute caused
|
||||
creation to fail on some machines
|
||||
- [Cocoa] Bugfix: `glfwCreateWindow` did not properly enforce the
|
||||
forward-compatible and context profile hints
|
||||
- [Cocoa] Bugfix: The loop condition for saving video modes used the wrong
|
||||
index variable
|
||||
- [Cocoa] Bugfix: The OpenGL framework was not retrieved, making
|
||||
`glfwGetProcAddress` crash
|
||||
- [Cocoa] Bugfix: `glfwInit` changed the current directory for unbundled
|
||||
executables
|
||||
- [Cocoa] Bugfix: The `GLFW_WINDOW_NO_RESIZE` window parameter was always zero
|
||||
- [Cocoa] Bugfix: The cursor position incorrectly rounded during conversion
|
||||
- [Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen
|
||||
windows
|
||||
- [Cocoa] Bugfix: The GLFW window was flagged as restorable
|
||||
- [X11] Added support for the `GLX_EXT_swap_control` and
|
||||
`GLX_MESA_swap_control` extensions as alternatives to
|
||||
`GLX_SGI_swap_control`
|
||||
- [X11] Added the POSIX `CLOCK_MONOTONIC` time source as the preferred method
|
||||
- [X11] Added dependency on libm, where present
|
||||
- [X11] Added support for the `_NET_WM_NAME` and `_NET_WM_ICON_NAME` EWMH
|
||||
window properties
|
||||
- [X11] Made client-side RandR and Xf86VidMode extensions required
|
||||
- [X11] Bugfix: Some window properties required by the ICCCM were not set
|
||||
- [X11] Bugfix: Calling `glXCreateContextAttribsARB` with an unavailable OpenGL
|
||||
version caused the application to terminate with a `BadMatch`
|
||||
Xlib error
|
||||
- [X11] Bugfix: A synchronization point necessary for jitter-free locked cursor
|
||||
mode was incorrectly removed
|
||||
- [X11] Bugfix: The window size hints were not updated when calling
|
||||
`glfwSetWindowSize` on a non-resizable window
|
||||
- [Win32] Added support for high-DPI monitors
|
||||
- [Win32] Changed port to use Unicode mode only
|
||||
- [Win32] Removed explicit support for versions of Windows older than Windows
|
||||
XP
|
||||
- [Win32] Bugfix: Window activation and iconification did not work as expected
|
||||
- [Win32] Bugfix: Software rasterizer pixel formats were not discarded by the
|
||||
`WGL_ARB_pixel_format` code path
|
||||
- [Win32] Bugfix: The array for WGL context attributes was too small and could
|
||||
overflow
|
||||
- [Win32] Bugfix: Alt+F4 hot key was not translated into `WM_CLOSE`
|
||||
- [Win32] Bugfix: The `GLFW_WINDOW_NO_RESIZE` window parameter was always zero
|
||||
- [Win32] Bugfix: A test was missing for whether all available pixel formats
|
||||
had been disqualified
|
||||
- Added the `GLFW_BUILD_DOCS` CMake option for controlling whether the
|
||||
documentation is built
|
||||
- Added the `_GLFW_USE_CONFIG_H` configuration macro for controlling whether to
|
||||
include the configuration header
|
||||
- Moved version number macro to `internal.h` for easier manual compilation
|
||||
- Renamed configuration header to `glfw_config.h` to avoid conflicts
|
||||
- Bugfix: The `glfw3.pc` file did not respect the `LIB_SUFFIX` CMake option
|
||||
- Bugfix: The `joysticks` test would segfault if a controller had no axes
|
||||
- [Win32] Allowed swap interval to be explicitly set to zero on DWM systems
|
||||
- [Win32] Bugfix: Removed joystick axis value negation left over from GLFW 2
|
||||
- [Win32] Bugfix: Restoring windows using the Win+D hot key did not trigger the
|
||||
focus callback
|
||||
- [Win32] Bugfix: The disabled cursor mode clip rectangle was updated for
|
||||
unfocused windows
|
||||
- [Win32] Bugfix: Cursor was not properly re-centered over odd-sized windows
|
||||
- [Win32] Bugfix: Negative window positions were reported incorrectly
|
||||
- [Win32] Bugfix: The iconify callback was not triggered when switching away
|
||||
from a full screen window using Alt+Tab
|
||||
- [Win32] Bugfix: Resizing a window with `glfwSetWindowSize` gave it focus
|
||||
- [Cocoa] Added dependency on CoreVideo framework for refresh rate retrieval
|
||||
- [Cocoa] Enabled Lion full screen for resizable windowed mode windows
|
||||
- [Cocoa] Moved to Cocoa API for application transformation and activation
|
||||
- [Cocoa] Bugfix: The `GLFW_KEY_GRAVE_ACCENT` key was reported as
|
||||
`GLFW_KEY_WORLD_1` and vice versa
|
||||
- [Cocoa] Bugfix: The `GLFW_KEY_F13` key was reported as
|
||||
`GLFW_KEY_PRINT_SCREEN`
|
||||
- [Cocoa] Bugfix: Implicit conversion from `NSUInteger` to int caused warnings
|
||||
with Xcode 5
|
||||
- [Cocoa] Bugfix: Use of undeclared selectors with `@selector` caused warnings
|
||||
with Xcode 5
|
||||
- [Cocoa] Bugfix: The cursor remained visible if moved onto client area after
|
||||
having been set to hidden outside it
|
||||
- [Cocoa] Bugfix: The refresh rate was zero for all modes of certain monitors
|
||||
- [Cocoa] Bugfix: The `install_name` field of the dynamic library was not set
|
||||
- [Cocoa] Bugfix: Full screen windows were never reported as having focus
|
||||
- [Cocoa] Bugfix: A superfluous I/O flag test prevented video modes from being
|
||||
listed for Thunderbolt monitor
|
||||
- [Cocoa] Bugfix: Retrieving the name of some external displays caused segfault
|
||||
- [Cocoa] Bugfix: The 10.9 SDK defines `GLintptrARB` and `GLsizeiptrARB`
|
||||
differently from the Khronos `glext.h`
|
||||
- [Cocoa] Bugfix: Creating hidden windows would steal application focus
|
||||
- [Cocoa] Bugfix: Controllers were reported as having zero buttons and axes
|
||||
- [Cocoa] Bugfix: Removed joystick axis value negation left over from GLFW 2
|
||||
- [X11] Added setting of the `WM_CLASS` property to the initial window title
|
||||
- [X11] Added support for `_NET_WM_BYPASS_COMPOSITOR`
|
||||
- [X11] Bugfix: Removed joystick axis value negation left over from GLFW 2
|
||||
- [X11] Bugfix: The position of hidden windows was ignored by Metacity
|
||||
and Compiz
|
||||
- [X11] Bugfix: The `pthread.h` header was not included by the GLX platform
|
||||
header.
|
||||
|
||||
|
||||
## Contact
|
||||
@@ -292,11 +95,11 @@ If you have questions related to the use of GLFW, we have a
|
||||
channel `#glfw` on [Freenode](http://freenode.net/).
|
||||
|
||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||
request, please file it in one of the
|
||||
[issue trackers](https://sourceforge.net/p/glfw/_list/tickets) on SF.net.
|
||||
request, please file it in the
|
||||
[issue tracker](https://github.com/glfw/glfw/issues) on GitHub.
|
||||
|
||||
Finally, if you're interested in helping out with the development of GLFW or
|
||||
porting it to your favorite platform, we have a
|
||||
porting it to your favorite platform, we have an occasionally active
|
||||
[developer's mailing list](https://lists.stacken.kth.se/mailman/listinfo/glfw-dev),
|
||||
or you could join us on `#glfw`.
|
||||
|
||||
@@ -308,24 +111,30 @@ skills.
|
||||
|
||||
- Bobyshev Alexander
|
||||
- artblanc
|
||||
- arturo
|
||||
- Matt Arsenault
|
||||
- Keith Bauer
|
||||
- John Bartholomew
|
||||
- Niklas Behrens
|
||||
- Niklas Bergström
|
||||
- Doug Binks
|
||||
- blanco
|
||||
- Lambert Clara
|
||||
- Andrew Corrigan
|
||||
- Noel Cower
|
||||
- Jarrod Davis
|
||||
- Olivier Delannoy
|
||||
- Paul R. Deppe
|
||||
- Jonathan Dummer
|
||||
- Ralph Eastwood
|
||||
- Michael Fogleman
|
||||
- Gerald Franz
|
||||
- GeO4d
|
||||
- Marcus Geelnard
|
||||
- Stefan Gustavson
|
||||
- Sylvain Hellegouarch
|
||||
- heromyth
|
||||
- Paul Holden
|
||||
- Toni Jovanoski
|
||||
- Osman Keskin
|
||||
- Cameron King
|
||||
@@ -337,17 +146,24 @@ skills.
|
||||
- Martins Mozeiko
|
||||
- Tristam MacDonald
|
||||
- Hans Mackowiak
|
||||
- Kyle McDonald
|
||||
- David Medlock
|
||||
- Jonathan Mercier
|
||||
- Marcel Metz
|
||||
- Kenneth Miller
|
||||
- Bruce Mitchener
|
||||
- Jack Moffitt
|
||||
- Jeff Molofee
|
||||
- Jon Morton
|
||||
- Pierre Moulon
|
||||
- Julian Møller
|
||||
- Ozzy at Orkysquad
|
||||
- Kamil Nowakowski
|
||||
- Ozzy
|
||||
- Andri Pálsson
|
||||
- Peoro
|
||||
- Braden Pellett
|
||||
- Arturo J. Pérez
|
||||
- Pieroman
|
||||
- Jorge Rodriguez
|
||||
- Ed Ropple
|
||||
- Riku Salminen
|
||||
@@ -355,15 +171,18 @@ skills.
|
||||
- Matt Sealey
|
||||
- SephiRok
|
||||
- Steve Sexton
|
||||
- Systemcluster
|
||||
- Dmitri Shuralyov
|
||||
- Daniel Skorupski
|
||||
- Bradley Smith
|
||||
- Julian Squires
|
||||
- Johannes Stein
|
||||
- Justin Stoecker
|
||||
- Nathan Sweet
|
||||
- TTK-Bandit
|
||||
- Sergey Tikhomirov
|
||||
- Samuli Tuomola
|
||||
- urraka
|
||||
- Jari Vetoniemi
|
||||
- Simon Voordouw
|
||||
- Torsten Walluhn
|
||||
|
||||
Vendored
+9149
-10857
File diff suppressed because it is too large
Load Diff
Vendored
+677
-848
File diff suppressed because it is too large
Load Diff
Vendored
+648
-758
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -1,5 +1,5 @@
|
||||
|
||||
add_custom_target(docs ALL ${DOXYGEN_EXECUTABLE}
|
||||
WORKING_DIRECTORY ${GLFW_BINARY_DIR}/docs
|
||||
COMMENT "Generating HTML documentation" VERBATIM)
|
||||
|
||||
|
||||
add_custom_target(docs ALL ${DOXYGEN_EXECUTABLE}
|
||||
WORKING_DIRECTORY ${GLFW_BINARY_DIR}/docs
|
||||
COMMENT "Generating HTML documentation" VERBATIM)
|
||||
|
||||
|
||||
+4
-3
@@ -659,6 +659,7 @@ INPUT = @GLFW_INTERNAL_DOCS@ \
|
||||
@GLFW_SOURCE_DIR@/docs/news.dox \
|
||||
@GLFW_SOURCE_DIR@/docs/quick.dox \
|
||||
@GLFW_SOURCE_DIR@/docs/moving.dox \
|
||||
@GLFW_SOURCE_DIR@/docs/compile.dox \
|
||||
@GLFW_SOURCE_DIR@/docs/build.dox \
|
||||
@GLFW_SOURCE_DIR@/docs/context.dox \
|
||||
@GLFW_SOURCE_DIR@/docs/monitor.dox \
|
||||
@@ -899,13 +900,13 @@ HTML_FILE_EXTENSION = .html
|
||||
# have to redo this when upgrading to a newer version of doxygen or when
|
||||
# changing the value of configuration settings such as GENERATE_TREEVIEW!
|
||||
|
||||
HTML_HEADER =
|
||||
HTML_HEADER = @GLFW_SOURCE_DIR@/docs/header.html
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard footer.
|
||||
|
||||
HTML_FOOTER =
|
||||
HTML_FOOTER = @GLFW_SOURCE_DIR@/docs/footer.html
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
@@ -924,7 +925,7 @@ HTML_STYLESHEET =
|
||||
# robust against future updates. Doxygen will copy the style sheet file to
|
||||
# the output directory.
|
||||
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET = @GLFW_SOURCE_DIR@/docs/extra.css
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
|
||||
+106
-50
@@ -1,11 +1,13 @@
|
||||
/*!
|
||||
|
||||
@page build Building programs using GLFW
|
||||
@page build Building programs that use GLFW
|
||||
|
||||
@tableofcontents
|
||||
|
||||
This is about compiling and linking programs that use GLFW. For information on
|
||||
how to *write* such programs, start with the [introductory tutorial](@ref quick).
|
||||
how to write such programs, start with the [introductory tutorial](@ref quick).
|
||||
For information on how to compile the GLFW library itself, see the @ref compile
|
||||
guide.
|
||||
|
||||
|
||||
@section build_include Including the GLFW header file
|
||||
@@ -48,10 +50,12 @@ header that the GLFW header includes and GLEW will work as expected.
|
||||
@subsection build_macros GLFW header option macros
|
||||
|
||||
These macros may be defined before the inclusion of the GLFW header and affect
|
||||
how that header behaves.
|
||||
the behavior of the header. Note that GLFW does not provide any of the OpenGL
|
||||
or OpenGL ES headers mentioned below. These are provided by your development
|
||||
environment or your OpenGL or OpenGL ES SDK.
|
||||
|
||||
`GLFW_INCLUDE_GLCOREARB` makes the header include the modern `GL/glcorearb.h`
|
||||
header (`OpenGL/gl3.h` on Mac OS X) instead of the regular OpenGL header.
|
||||
header (`OpenGL/gl3.h` on OS X) instead of the regular OpenGL header.
|
||||
|
||||
`GLFW_INCLUDE_ES1` makes the header include the OpenGL ES 1.x `GLES/gl.h` header
|
||||
instead of the regular OpenGL header.
|
||||
@@ -64,35 +68,27 @@ header instead of the regular OpenGL header.
|
||||
|
||||
`GLFW_INCLUDE_NONE` makes the header not include any client API header.
|
||||
|
||||
`GLFW_INCLUDE_GLU` makes the header include the GLU header. This only makes
|
||||
sense if you are using OpenGL.
|
||||
`GLFW_INCLUDE_GLU` makes the header include the GLU header *in addition to* the
|
||||
OpenGL header. This should only be used with the default `GL/gl.h` header
|
||||
(`OpenGL/gl.h` on OS X), i.e. if you are not using any of the above macros.
|
||||
|
||||
`GLFW_DLL` is necessary when using the GLFW DLL on Windows, in order to explain
|
||||
to the compiler that the GLFW functions will be coming from another executable.
|
||||
It has no function on other platforms.
|
||||
|
||||
|
||||
@section build_link Link with the right libraries
|
||||
|
||||
@subsection build_link_cmake Using GLFW from CMake
|
||||
|
||||
The `GLFW_LIBRARIES` cache variable contains all link-time dependencies of GLFW
|
||||
as it is currently configured, so to link against GLFW simply do:
|
||||
|
||||
target_link_libraries(myapp glfw ${GLFW_LIBRARIES})
|
||||
|
||||
Note that this does not include GLU, as GLFW does not use it. If your
|
||||
application needs GLU, you can add it to the list of dependencies with the
|
||||
`OPENGL_glu_LIBRARY` cache variable.
|
||||
|
||||
|
||||
@subsection build_link_win32 Windows
|
||||
@subsection build_link_win32 With MinGW or Visual C++ on Windows
|
||||
|
||||
The static version of the GLFW library is named `glfw3`. When using this
|
||||
version, it is also necessary to link with some libraries that GLFW uses.
|
||||
|
||||
When linking a program under Windows that uses the static version of GLFW, you
|
||||
must link with `opengl32`. If you are using GLU, you must also link with
|
||||
`glu32`.
|
||||
must link with `opengl32`. On some versions of MinGW, you must also explicitly
|
||||
link with `gdi32`, while other versions of MinGW include it in the set of
|
||||
default libraries along with other dependencies like `user32` and `kernel32`.
|
||||
If you are using GLU, you must also link with `glu32`.
|
||||
|
||||
The link library for the GLFW DLL is named `glfw3dll`. When compiling a program
|
||||
that uses the DLL version of GLFW, you need to define the `GLFW_DLL` macro
|
||||
@@ -104,12 +100,72 @@ dependencies, but you still have to link against `opengl32` if your program uses
|
||||
OpenGL and `glu32` if it uses GLU.
|
||||
|
||||
|
||||
@subsection build_link_unix Unix with X11
|
||||
@subsection build_link_cmake_source With CMake and GLFW source
|
||||
|
||||
You can use the GLFW source tree directly from a project that uses CMake. This
|
||||
way, GLFW will be built along with your application as needed.
|
||||
|
||||
Firstly, add the root directory of the GLFW source tree to your project. This
|
||||
will add the `glfw` target and the necessary cache variables to your project.
|
||||
|
||||
add_subdirectory(path/to/glfw)
|
||||
|
||||
To be able to include the GLFW header from your code, you need to tell the
|
||||
compiler where to find it.
|
||||
|
||||
include_directories(path/to/glfw/include)
|
||||
|
||||
Once GLFW has been added to the project, the `GLFW_LIBRARIES` cache variable
|
||||
contains all link-time dependencies of GLFW as it is currently configured. To
|
||||
link against GLFW, link against them and the `glfw` target.
|
||||
|
||||
target_link_libraries(myapp glfw ${GLFW_LIBRARIES})
|
||||
|
||||
Note that `GLFW_LIBRARIES` does not include GLU, as GLFW does not use it. If
|
||||
your application needs GLU, you can add it to the list of dependencies with the
|
||||
`OPENGL_glu_LIBRARY` cache variable, which is implicitly created when the GLFW
|
||||
CMake files look for OpenGL.
|
||||
|
||||
target_link_libraries(myapp glfw ${OPENGL_glu_LIBRARY} ${GLFW_LIBRARIES})
|
||||
|
||||
|
||||
@subsection build_link_cmake_pkgconfig With CMake on Unix and installed GLFW binaries
|
||||
|
||||
CMake can import settings from pkg-config, which GLFW supports. When you
|
||||
installed GLFW, the pkg-config file `glfw3.pc` was installed along with it.
|
||||
|
||||
First you need to find the PkgConfig package. If this fails, you may need to
|
||||
install the pkg-config package for your distribution.
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
This creates the CMake commands to find pkg-config packages. Then you need to
|
||||
find the GLFW package.
|
||||
|
||||
pkg_search_module(GLFW REQUIRED glfw3)
|
||||
|
||||
This creates the CMake variables you need to use GLFW. To be able to include
|
||||
the GLFW header, you need to tell your compiler where it is.
|
||||
|
||||
include_directories(${GLFW_INCLUDE_DIRS})
|
||||
|
||||
You also need to link against the correct libraries. If you are using the
|
||||
shared library version of GLFW, use the `GLFW_LIBRARIES` variable.
|
||||
|
||||
target_link_libraries(simple ${GLFW_LIBRARIES})
|
||||
|
||||
|
||||
If you are using the static library version of GLFW, use the
|
||||
`GLFW_STATIC_LIBRARIES` variable instead.
|
||||
|
||||
target_link_libraries(simple ${GLFW_STATIC_LIBRARIES})
|
||||
|
||||
|
||||
@subsection build_link_pkgconfig With pkg-config on OS X or other Unix
|
||||
|
||||
GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/),
|
||||
and `glfw3.pc` file is generated when the library is built and installed along
|
||||
with it. You can use it without installation using the `PKG_CONFIG_PATH`
|
||||
environment variable. See the documentation for pkg-config for more details.
|
||||
and the `glfw3.pc` file is generated when the GLFW library is built and installed
|
||||
along with it.
|
||||
|
||||
A typical compile and link command-line when using the static may look like this:
|
||||
|
||||
@@ -117,45 +173,45 @@ A typical compile and link command-line when using the static may look like this
|
||||
|
||||
If you are using the shared library, simply omit the `--static` flag.
|
||||
|
||||
If you are using GLU, you should also add `-lGLU` to your link flags.
|
||||
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --libs glfw3`
|
||||
|
||||
You can also use the `glfw3.pc` file without installing it first, by using the
|
||||
`PKG_CONFIG_PATH` environment variable.
|
||||
|
||||
env PKG_CONFIG_PATH=path/to/glfw/src cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3`
|
||||
|
||||
The dependencies do not include GLU, as GLFW does not need it. On OS X, GLU is
|
||||
built into the OpenGL framework, so if you need GLU you don't need to do
|
||||
anything extra. If you need GLU and are using Linux or BSD, you should add
|
||||
`-lGLU` to your link flags.
|
||||
|
||||
See the manpage and other documentation for pkg-config and your compiler and
|
||||
linker for more information on how to link programs.
|
||||
|
||||
|
||||
@subsection build_link_osx Mac OS X
|
||||
@subsection build_link_xcode With Xcode on OS X
|
||||
|
||||
GLFW on Mac OS X uses the Cocoa, OpenGL and IOKit frameworks.
|
||||
If you are using the dynamic library version of GLFW, simply add it to the
|
||||
project dependencies.
|
||||
|
||||
If you are using Xcode, you can simply add the GLFW library and these frameworks
|
||||
as dependencies.
|
||||
If you are using the static library version of GLFW, add it and the Cocoa,
|
||||
OpenGL, IOKit and CoreVideo frameworks to the project as dependencies.
|
||||
|
||||
If you are building from the
|
||||
command-line, it is recommended that you use pkg-config
|
||||
|
||||
GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/),
|
||||
and `glfw3.pc` file is generated when the library is built and installed along
|
||||
with it. You can use it without installation using the `PKG_CONFIG_PATH`
|
||||
environment variable. See the documentation for pkg-config for more details.
|
||||
|
||||
You can find pkg-config in most package systems such as
|
||||
[Fink](http://www.finkproject.org/) and [MacPorts](http://www.macports.org/), so
|
||||
if you have one of them installed, simply install pkg-config. Once you have
|
||||
pkg-config available, the command-line for compiling and linking your
|
||||
program is:
|
||||
|
||||
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3`
|
||||
@subsection build_link_osx With command-line on OS X
|
||||
|
||||
If you do not wish to use pkg-config, you need to add the required frameworks
|
||||
and libraries to your command-line using the `-l` and `-framework` switches,
|
||||
i.e.:
|
||||
|
||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
|
||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
|
||||
|
||||
Note that you do not add the `.framework` extension to a framework when adding
|
||||
it from the command-line.
|
||||
|
||||
The OpenGL framework contains both the OpenGL and GLU APIs, so there is no need
|
||||
to add additional libraries or frameworks when using GLU. Also note that even
|
||||
though your machine may have `libGL`-style OpenGL libraries, they are for use
|
||||
with the X Window System and will *not* work with the Mac OS X native version of
|
||||
GLFW.
|
||||
The OpenGL framework contains both the OpenGL and GLU APIs, so there is nothing
|
||||
special to do when using GLU. Also note that even though your machine may have
|
||||
`libGL`-style OpenGL libraries, they are for use with the X Window System and
|
||||
will *not* work with the OS X native version of GLFW.
|
||||
|
||||
*/
|
||||
|
||||
+17
-15
@@ -112,24 +112,26 @@ context profiles. Where this extension is unavailable, setting the
|
||||
`GLFW_OPENGL_PROFILE` hint to anything but zero will cause @ref glfwCreateWindow
|
||||
to fail.
|
||||
|
||||
@section cmopat_osx OpenGL 3.2 on Mac OS X
|
||||
@section compat_osx OpenGL 3.2 and later on OS X
|
||||
|
||||
Support for OpenGL 3.0 and above was introduced with Mac OS X 10.7, and even
|
||||
then only forward-compatible OpenGL 3.2 core profile contexts are supported.
|
||||
There is also still no mechanism for requesting debug contexts. Versions of
|
||||
Mac OS X earlier than 10.7 support at most OpenGL version 2.1.
|
||||
Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then
|
||||
only forward-compatible, core profile contexts are supported. Support for
|
||||
OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible,
|
||||
core profile contexts. There is also still no mechanism for requesting debug
|
||||
contexts. Versions of Mac OS X earlier than 10.7 support at most OpenGL
|
||||
version 2.1.
|
||||
|
||||
Because of this, on Mac OS X 10.7, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 3.2, the
|
||||
`GLFW_OPENGL_FORWARD_COMPAT` is required for creating OpenGL 3.2 contexts, the
|
||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored and setting the
|
||||
`GLFW_OPENGL_PROFILE` hint to anything except `GLFW_OPENGL_CORE_PROFILE` will
|
||||
cause @ref glfwCreateWindow to fail.
|
||||
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
|
||||
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
|
||||
non-zero and the `GLFW_OPENGL_PROFILE` hint must be set to
|
||||
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts and the
|
||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
|
||||
|
||||
Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, the
|
||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the
|
||||
`GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value
|
||||
will cause @ref glfwCreateWindow to fail.
|
||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1,
|
||||
setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to
|
||||
a non-default value will cause @ref glfwCreateWindow to fail and the
|
||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
|
||||
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
/*!
|
||||
|
||||
@page compile Compiling GLFW
|
||||
|
||||
@tableofcontents
|
||||
|
||||
This is about compiling the GLFW library itself. For information on how to
|
||||
build programs that use GLFW, see the @ref build guide.
|
||||
|
||||
|
||||
@section compile_deps Dependencies
|
||||
|
||||
To compile GLFW and the accompanying example programs, you will need **CMake**,
|
||||
which will generate the project files or makefiles for your particular
|
||||
development environment. If you are on a Unix-like system such as Linux or
|
||||
FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you
|
||||
can simply install its CMake package. If not, you can get installers for
|
||||
Windows and OS X from the [CMake website](http://www.cmake.org/).
|
||||
|
||||
Additional dependencies are listed below.
|
||||
|
||||
If you wish to compile GLFW without CMake, see @ref compile_manual.
|
||||
|
||||
|
||||
@subsection compile_deps_msvc Dependencies using Visual C++ on Windows
|
||||
|
||||
The Microsoft Platform SDK that is installed along with Visual C++ contains all
|
||||
the necessary headers, link libraries and tools except for CMake.
|
||||
|
||||
|
||||
@subsection compile_deps_mingw Dependencies with MinGW or MinGW-w64 on Windows
|
||||
|
||||
Both the MinGW and the MinGW-w64 packages contain all the necessary headers,
|
||||
link libraries and tools except for CMake.
|
||||
|
||||
|
||||
@subsection compile_deps_mingw_cross Dependencies using MinGW or MinGW-w64 cross-compilation
|
||||
|
||||
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
|
||||
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
|
||||
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
|
||||
like Ubuntu have the `mingw-w64` package for both.
|
||||
|
||||
GLFW has CMake toolchain files in the `CMake/` directory that allow for easy
|
||||
cross-compilation of Windows binaries. To use these files you need to add a
|
||||
special parameter when generating the project files or makefiles:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
|
||||
|
||||
The exact toolchain file to use depends on the prefix used by the MinGW or
|
||||
MinGW-w64 binaries on your system. You can usually see this in the /usr
|
||||
directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages
|
||||
have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct
|
||||
invocation would be:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
|
||||
|
||||
For more details see the article
|
||||
[CMake Cross Compiling](http://www.paraview.org/Wiki/CMake_Cross_Compiling) on
|
||||
the CMake wiki.
|
||||
|
||||
|
||||
@subsection compile_deps_xcode Dependencies using Xcode on OS X
|
||||
|
||||
Xcode contains all necessary tools except for CMake. The necessary headers and
|
||||
libraries are included in the core OS frameworks. Xcode can be downloaded from
|
||||
the Mac App Store or from the ADC Member Center.
|
||||
|
||||
|
||||
@subsection compile_deps_x11 Dependencies using Linux and X11
|
||||
|
||||
To compile GLFW for X11, you need to have the X11 and OpenGL header packages
|
||||
installed, as well as the basic development tools like GCC and make. For
|
||||
example, on Ubuntu and other distributions based on Debian GNU/Linux, you need
|
||||
to install the `xorg-dev` and `libglu1-mesa-dev` packages. The former pulls in
|
||||
all X.org header packages and the latter pulls in the Mesa OpenGL and GLU
|
||||
packages. GLFW itself doesn't need or use GLU, but some of the examples do.
|
||||
Note that using header files and libraries from Mesa during compilation *will
|
||||
not* tie your binaries to the Mesa implementation of OpenGL.
|
||||
|
||||
|
||||
@section compile_cmake Generating files with CMake
|
||||
|
||||
Once you have all necessary dependencies it is time to generate the project
|
||||
files or makefiles for your development environment. CMake needs to know two
|
||||
paths for this: the path to the *root* directory of the GLFW source tree (i.e.
|
||||
*not* the `src` subdirectory) and the target path for the generated files and
|
||||
compiled binaries. If these are the same, it is called an in-tree build,
|
||||
otherwise it is called an out-of-tree build.
|
||||
|
||||
One of several advantages of out-of-tree builds is that you can generate files
|
||||
and compile for different development environments using a single source tree.
|
||||
|
||||
|
||||
@subsection compile_cmake_cli Generating files with the CMake command-line tool
|
||||
|
||||
To make an in-tree build, enter the *root* directory of the GLFW source tree
|
||||
(i.e. *not* the `src` subdirectory) and run CMake. The current directory is
|
||||
used as target path, while the path provided as an argument is used to find the
|
||||
source tree.
|
||||
|
||||
cd <glfw-root-dir>
|
||||
cmake .
|
||||
|
||||
To make an out-of-tree build, make another directory, enter it and run CMake
|
||||
with the (relative or absolute) path to the root of the source tree as an
|
||||
argument.
|
||||
|
||||
cd <glfw-root-dir>
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
|
||||
@subsection compile_cmake_gui Generating files with the CMake GUI
|
||||
|
||||
If you are using the GUI version, choose the root of the GLFW source tree as
|
||||
source location and the same directory or another, empty directory as the
|
||||
destination for binaries. Choose *Configure*, change any options you wish to,
|
||||
*Configure* again to let the changes take effect and then *Generate*.
|
||||
|
||||
|
||||
@section compile_options CMake options
|
||||
|
||||
The CMake files for GLFW provide a number of options, although not all are
|
||||
available on all supported platforms. Some of these are de facto standards
|
||||
among CMake users and so have no `GLFW_` prefix.
|
||||
|
||||
If you are using the GUI version of CMake, these are listed and can be changed
|
||||
from there. If you are using the command-line version, use the `ccmake` tool.
|
||||
Some package systems like Ubuntu and other distributions based on Debian
|
||||
GNU/Linux have this tool in a separate `cmake-curses-gui` package.
|
||||
|
||||
|
||||
@subsection compile_options_shared Shared CMake options
|
||||
|
||||
`BUILD_SHARED_LIBS` determines whether GLFW is built as a static
|
||||
library or as a DLL / shared library / dynamic library.
|
||||
|
||||
`LIB_SUFFIX` affects where the GLFW shared /dynamic library is installed. If it
|
||||
is empty, it is installed to `${CMAKE_INSTALL_PREFIX}/lib`. If it is set to
|
||||
`64`, it is installed to `${CMAKE_INSTALL_PREFIX}/lib64`.
|
||||
|
||||
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
|
||||
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
|
||||
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
|
||||
selected library and its header files must be present on the system for this to
|
||||
work.
|
||||
|
||||
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
|
||||
along with the library.
|
||||
|
||||
`GLFW_BUILD_TESTS` determines whether the GLFW test programs are
|
||||
built along with the library.
|
||||
|
||||
`GLFW_BUILD_DOCS` determines whether the GLFW documentation is built along with
|
||||
the library.
|
||||
|
||||
|
||||
@subsection compile_options_osx OS X specific CMake options
|
||||
|
||||
`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current
|
||||
directory of bundled applications to the `Contents/Resources` directory.
|
||||
|
||||
`GLFW_USE_MENUBAR` determines whether the first call to
|
||||
`glfwCreateWindow` sets up a minimal menu bar.
|
||||
|
||||
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
|
||||
|
||||
|
||||
@subsection compile_options_win32 Windows specific CMake options
|
||||
|
||||
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the
|
||||
static library version of the Visual C++ runtime library. If set to `ON`, the
|
||||
DLL version of the Visual C++ library is used. It is recommended to set this to
|
||||
`ON`, as this keeps the executable smaller and benefits from security and bug
|
||||
fix updates of the Visual C++ runtime.
|
||||
|
||||
`GLFW_USE_DWM_SWAP_INTERVAL` determines whether the swap interval is set even
|
||||
when DWM compositing is enabled. If this is `ON`, the swap interval is set even
|
||||
if DWM is enabled. It is recommended to set this to `OFF`, as doing otherwise
|
||||
can lead to severe jitter.
|
||||
|
||||
`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement`
|
||||
symbol, which forces the use of the high-performance GPU on nVidia Optimus
|
||||
systems.
|
||||
|
||||
|
||||
@subsection compile_options_egl EGL specific CMake options
|
||||
|
||||
`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific
|
||||
context creation API. Note that EGL is not yet provided on all supported
|
||||
platforms.
|
||||
|
||||
|
||||
@section compile_manual Compiling GLFW manually
|
||||
|
||||
If you wish to compile GLFW without its CMake build environment then you will
|
||||
have to do at least some of the platform detection yourself. GLFW needs
|
||||
a number of configuration macros to be defined in order to know what it's being
|
||||
compiled for and has many optional, platform-specific ones for various features.
|
||||
|
||||
When building with CMake, the `glfw_config.h` configuration header is generated
|
||||
based on the current platform and CMake options. The GLFW CMake environment
|
||||
defines `_GLFW_USE_CONFIG_H`, which causes this header to be included by
|
||||
`internal.h`. Without this macro, GLFW will expect the necessary configuration
|
||||
macros to be defined on the command-line.
|
||||
|
||||
Three macros *must* be defined when compiling GLFW: one for selecting the window
|
||||
creation API, one selecting the context creation API and one client library.
|
||||
Exactly one of each kind must be defined for GLFW to compile and link.
|
||||
|
||||
The window creation API is used to create windows, handle input, monitors, gamma
|
||||
ramps and clipboard. The options are:
|
||||
|
||||
- `_GLFW_COCOA` to use the Cocoa frameworks
|
||||
- `_GLFW_WIN32` to use the Win32 API
|
||||
- `_GLFW_X11` to use the X Window System
|
||||
|
||||
The context creation API is used to enumerate pixel formats / framebuffer
|
||||
configurations and to create contexts. The options are:
|
||||
|
||||
- `_GLFW_NSGL` to use the Cocoa OpenGL framework
|
||||
- `_GLFW_WGL` to use the Win32 WGL API
|
||||
- `_GLFW_GLX` to use the X11 GLX API
|
||||
- `_GLFW_EGL` to use the EGL API (experimental)
|
||||
|
||||
The client library is the one providing the OpenGL or OpenGL ES API, which is
|
||||
used by GLFW to probe the created context. This is not the same thing as the
|
||||
client API, as many desktop OpenGL client libraries now expose the OpenGL ES API
|
||||
through extensions. The options are:
|
||||
|
||||
- `_GLFW_USE_OPENGL` for the desktop OpenGL (opengl32.dll, libGL.so or
|
||||
OpenGL.framework)
|
||||
- `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental)
|
||||
- `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental)
|
||||
|
||||
Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL,
|
||||
as the other context creation APIs do not interface with OpenGL ES client
|
||||
libraries.
|
||||
|
||||
If you are building GLFW as a shared library / dynamic library / DLL then you
|
||||
must also define `_GLFW_BUILD_DLL`. Otherwise, you may not define it.
|
||||
|
||||
If you are using the X11 window creation API then you *must* also select an entry
|
||||
point retrieval mechanism.
|
||||
|
||||
- `_GLFW_HAS_GLXGETPROCADDRESS` to use `glXGetProcAddress` (recommended)
|
||||
- `_GLFW_HAS_GLXGETPROCADDRESSARB` to use `glXGetProcAddressARB` (legacy)
|
||||
- `_GLFW_HAS_GLXGETPROCADDRESSEXT` to use `glXGetProcAddressEXT` (legacy)
|
||||
- `_GLFW_HAS_DLOPEN` to do manual retrieval with `dlopen` (fallback)
|
||||
|
||||
If you are using the Cocoa window creation API, the following options are
|
||||
available:
|
||||
|
||||
- `_GLFW_USE_CHDIR` to `chdir` to the `Resources` subdirectory of the
|
||||
application bundle during @ref glfwInit (recommended)
|
||||
- `_GLFW_USE_MENUBAR` to create and populate the menu bar when the first window
|
||||
is created (recommended)
|
||||
|
||||
*/
|
||||
@@ -24,6 +24,15 @@ what kind of context is created. See
|
||||
[context related hints](@ref window_hints_ctx) in the window handling guide.
|
||||
|
||||
|
||||
@section context_sharing Context object sharing
|
||||
|
||||
When creating a window and context with @ref glfwCreateWindow, you can specify
|
||||
another window whose context the new one should share its objects with. OpenGL
|
||||
object sharing is implemented by the operating system and graphics driver and is
|
||||
described in the OpenGL documentation. On platforms where it is possible to
|
||||
choose which types of objects are shared, GLFW requests that all are shared.
|
||||
|
||||
|
||||
@section context_current Current context
|
||||
|
||||
Before you can use the OpenGL or OpenGL ES APIs, you need to have a current
|
||||
|
||||
+312
@@ -0,0 +1,312 @@
|
||||
html {
|
||||
background-color:hsl(0,0%,95%);
|
||||
}
|
||||
|
||||
.glfwheader {
|
||||
font-size:16px;
|
||||
height:64px;
|
||||
max-width:920px;
|
||||
margin:0em auto;
|
||||
}
|
||||
|
||||
.glfwheader a#glfwhome {
|
||||
line-height:64px;
|
||||
padding-right:48px;
|
||||
float:left;
|
||||
color:hsl(0,0%,40%);
|
||||
font-size:2.5em;
|
||||
background-image:url("http://www.glfw.org/css/arrow.png");
|
||||
background-position:right top;
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
|
||||
.glfwnavbar {
|
||||
list-style-type:none;
|
||||
margin-top:0px;
|
||||
float:right;
|
||||
}
|
||||
|
||||
.glfwnavbar li {
|
||||
float:left;
|
||||
}
|
||||
|
||||
.glfwnavbar a,.glfwnavbar a:visited {
|
||||
line-height:64px;
|
||||
margin-left:2em;
|
||||
display:block;
|
||||
color:hsl(0,0%,40%);
|
||||
}
|
||||
|
||||
.glfwheader a#glfwhome,.glfwnavbar a,.glfwnavbar a:visited {
|
||||
transition:all 0.35s ease 0s;
|
||||
}
|
||||
|
||||
#titlearea,address.footer {
|
||||
color:hsl(0,0%,40%);
|
||||
background-color:hsl(0,0%,95%);
|
||||
border-bottom:none;
|
||||
}
|
||||
|
||||
address.footer {
|
||||
text-align:center;
|
||||
padding:2em;
|
||||
}
|
||||
|
||||
div#top {
|
||||
background-color:hsl(0,0%,40%);
|
||||
}
|
||||
|
||||
div#navrow1,div#navrow2,div#navrow3,div#navrow4 {
|
||||
background-color:hsl(0,0%,40%);
|
||||
background-image:none;
|
||||
max-width:920px;
|
||||
margin:0em auto;
|
||||
}
|
||||
|
||||
ul.tablist {
|
||||
min-width:700px;
|
||||
}
|
||||
|
||||
.tablist a,.tablist a:hover,.tablist li,.tablist li.current a {
|
||||
background-image:none;
|
||||
text-shadow:none;
|
||||
}
|
||||
|
||||
.tablist a,.tablist a:visited {
|
||||
color:hsl(0,0%,95%);
|
||||
text-shadow:none;
|
||||
}
|
||||
|
||||
.tablist li.current a {
|
||||
background:linear-gradient(to bottom,hsl(34,100%,60%) 0%,hsl(24,100%,50%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(24,100%,50%);
|
||||
text-shadow:0px -1px 1px hsl(24,100%,35%);
|
||||
color:hsl(0,0%,100%);
|
||||
}
|
||||
|
||||
div.contents {
|
||||
min-height:590px;
|
||||
}
|
||||
|
||||
div.contents,div.header {
|
||||
max-width:920px;
|
||||
margin:0em auto;
|
||||
padding:0em 2em 2em 2em;
|
||||
background-color:hsl(0,0%,100%);
|
||||
}
|
||||
|
||||
div.header {
|
||||
background-image:none;
|
||||
border-bottom:none;
|
||||
}
|
||||
|
||||
table.doxtable th,dl.reflist dt,div.levels {
|
||||
background:linear-gradient(to bottom,hsl(34,100%,60%) 0%,hsl(24,100%,50%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(24,100%,50%);
|
||||
text-shadow:0px -1px 1px hsl(24,100%,35%);
|
||||
color:hsl(0,0%,100%);
|
||||
}
|
||||
|
||||
dl.reflist dt a.el,div.levels span {
|
||||
color:hsl(24,100%,50%);
|
||||
padding:0.2em;
|
||||
border-radius:4px;
|
||||
background-color:hsl(24,100%,90%);
|
||||
text-shadow:none;
|
||||
}
|
||||
|
||||
div.memproto,div.qindex,div.ah {
|
||||
background:linear-gradient(to bottom,hsl(34,0%,95%) 0%,hsl(24,0%,90%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(24,0%,90%);
|
||||
text-shadow:0px 1px 1px hsl(24,0%,100%);
|
||||
color:hsl(0,0%,10%);
|
||||
}
|
||||
|
||||
div.memproto a {
|
||||
color:hsl(24,100%,50%);
|
||||
}
|
||||
|
||||
div.memproto td.paramname {
|
||||
text-shadow:0px 1px 1px hsl(24,0%,100%);
|
||||
}
|
||||
|
||||
div.memproto,div.qindex,div.ah {
|
||||
border:2px solid hsl(24,0%,90%);
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
div.memdoc {
|
||||
background:none;
|
||||
box-shadow:none;
|
||||
border:none;
|
||||
}
|
||||
|
||||
td.paramname {
|
||||
color:hsl(24,100%,25%);
|
||||
}
|
||||
|
||||
dl.reflist dt {
|
||||
border:2px solid hsl(24,100%,50%);
|
||||
border-top-left-radius:4px;
|
||||
border-top-right-radius:4px;
|
||||
border-bottom:none;
|
||||
}
|
||||
|
||||
dl.reflist dd {
|
||||
border:2px solid hsl(24,100%,50%);
|
||||
border-bottom-right-radius:4px;
|
||||
border-bottom-left-radius:4px;
|
||||
border-top:none;
|
||||
background:none;
|
||||
box-shadow:none;
|
||||
}
|
||||
|
||||
table.doxtable {
|
||||
border-collapse:inherit;
|
||||
border-spacing:0px;
|
||||
border:2px solid hsl(24,100%,50%);
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
table.doxtable td,table.doxtable th {
|
||||
border:none;
|
||||
}
|
||||
|
||||
tr.even,.directory tr.even,table.doxtable tr:nth-child(even) {
|
||||
background-color:hsl(0,0%,95%);
|
||||
}
|
||||
|
||||
body {
|
||||
color:hsl(0,0%,30%);
|
||||
}
|
||||
|
||||
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
|
||||
color:hsl(0,0%,10%);
|
||||
border-bottom:none;
|
||||
}
|
||||
|
||||
a,a:hover,a:visited,a:visited:hover,a.el,a.el:visited,.glfwheader a#glfwhome:hover,.tablist a:hover {
|
||||
color:hsl(24,100%,50%);
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.mdescLeft,.mdescRight,.memItemLeft,.memItemRight {
|
||||
background-color:hsl(0,0%,95%);
|
||||
}
|
||||
|
||||
div.directory {
|
||||
border-collapse:inherit;
|
||||
border-spacing:0px;
|
||||
border:2px solid hsl(24,100%,50%);
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
.directory .levels span {
|
||||
color:hsl(24,100%,50%);
|
||||
padding:0.1em 0.5em;
|
||||
margin:auto 0.25em;
|
||||
border-radius:2px;
|
||||
background-color:hsl(24,100%,90%);
|
||||
text-shadow:none;
|
||||
}
|
||||
|
||||
td.memSeparator {
|
||||
height:2px;
|
||||
border:0px;
|
||||
background:linear-gradient(to right,hsl(0,0%,95%) 0%,hsl(0,0%,85%) 50%,hsl(0,0%,95%) 100%);
|
||||
}
|
||||
|
||||
dl.note,dl.pre,dl.post,dl.invariant {
|
||||
background:linear-gradient(to bottom,hsl(103,80%,90%) 0%,hsl(103,80%,85%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(103,40%,80%);
|
||||
color:hsl(103,80%,10%);
|
||||
border:2px solid hsl(103,40%,75%);
|
||||
}
|
||||
|
||||
dl.warning,dl.attention {
|
||||
background:linear-gradient(to bottom,hsl(34,80%,90%) 0%,hsl(34,80%,85%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(34,40%,80%);
|
||||
color:hsl(34,80%,10%);
|
||||
border:2px solid hsl(34,40%,75%);
|
||||
}
|
||||
|
||||
dl.deprecated,dl.bug {
|
||||
background:linear-gradient(to bottom,hsl(333,80%,90%) 0%,hsl(333,80%,85%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(333,40%,80%);
|
||||
color:hsl(333,80%,10%);
|
||||
border:2px solid hsl(333,40%,75%);
|
||||
}
|
||||
|
||||
dl.todo,dl.test {
|
||||
background:linear-gradient(to bottom,hsl(200,80%,90%) 0%,hsl(200,80%,85%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(200,40%,80%);
|
||||
color:hsl(200,80%,10%);
|
||||
border:2px solid hsl(200,40%,75%);
|
||||
}
|
||||
|
||||
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test {
|
||||
border-radius:4px;
|
||||
padding:1em;
|
||||
text-shadow:0px 1px 1px hsl(0,0%,100%);
|
||||
}
|
||||
|
||||
div.toc {
|
||||
background:linear-gradient(to bottom,hsl(34,0%,95%) 0%,hsl(24,0%,90%) 100%);
|
||||
box-shadow:inset 0px 0px 32px hsl(24,0%,90%);
|
||||
text-shadow:0px 1px 1px hsl(24,0%,100%);
|
||||
color:hsl(0,0%,10%);
|
||||
border:2px solid hsl(24,0%,90%);
|
||||
border-radius:4px;
|
||||
float:none;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
div.toc h3 {
|
||||
font-size:1.17em;
|
||||
}
|
||||
|
||||
div.toc ul {
|
||||
padding-left:1.5em;
|
||||
}
|
||||
|
||||
div.toc li {
|
||||
background:none;
|
||||
font-size:1em;
|
||||
padding-left:0em;
|
||||
list-style-type:disc;
|
||||
}
|
||||
|
||||
div.ah {
|
||||
background-image:none;
|
||||
}
|
||||
|
||||
div.fragment,pre.fragment {
|
||||
background-color:hsl(0,0%,20%);
|
||||
border-radius:4px;
|
||||
border-width:0px;
|
||||
padding:0.5em 2em;
|
||||
overflow:auto;
|
||||
border-left:4px solid hsl(0,0%,80%);
|
||||
}
|
||||
|
||||
div.line,pre.fragment {
|
||||
color:hsl(60,30%,96%);
|
||||
}
|
||||
|
||||
a.code,a.code:visited,span.preprocessor,span.comment {
|
||||
color:hsl(80,76%,53%);
|
||||
}
|
||||
|
||||
span.keyword,span.keywordtype,span.keywordflow {
|
||||
color:hsl(190,81%,67%);
|
||||
}
|
||||
|
||||
span.stringliteral {
|
||||
color:hsl(54,70%,68%);
|
||||
}
|
||||
|
||||
code {
|
||||
background-color:hsl(0,0%,95%);
|
||||
padding:0.1em;
|
||||
border-radius: 4px;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<address class="footer">
|
||||
<p>
|
||||
Last update on $date for $projectname $projectnumber
|
||||
</p>
|
||||
</address>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||
$treeview
|
||||
$search
|
||||
$mathjax
|
||||
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||
$extrastylesheet
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
|
||||
<!--BEGIN TITLEAREA-->
|
||||
<div id="titlearea">
|
||||
<div class="glfwheader">
|
||||
<a href="http://www.glfw.org/" id="glfwhome">GLFW</a>
|
||||
<ul class="glfwnavbar">
|
||||
<li><a href="http://www.glfw.org/documentation.html">Documentation</a></li>
|
||||
<li><a href="http://www.glfw.org/download.html">Download</a></li>
|
||||
<li><a href="http://www.glfw.org/media.html">Media</a></li>
|
||||
<li><a href="http://www.glfw.org/community.html">Community</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!--END TITLEAREA-->
|
||||
<!-- end header part -->
|
||||
+2
-2
@@ -105,8 +105,8 @@ Examples: `clearScrollOffsets`
|
||||
@section internals_config Configuration macros
|
||||
|
||||
GLFW uses a number of configuration macros to select at compile time which
|
||||
interfaces and code paths to use. They are defined in the config.h header file,
|
||||
which is generated from the `config.h.in` file by CMake.
|
||||
interfaces and code paths to use. They are defined in the glfw_config.h header file,
|
||||
which is generated from the `glfw_config.h.in` file by CMake.
|
||||
|
||||
Configuration macros the same style as tokens in the public interface, except
|
||||
with a leading underscore.
|
||||
|
||||
+3
-3
@@ -11,12 +11,12 @@ existing applications and does not lay claim to the main loop.
|
||||
This is the documentation for version 3.0, which has [many new features](@ref news).
|
||||
|
||||
There is a [quick tutorial](@ref quick) for people new to GLFW, which shows how
|
||||
to write a small but complete program.
|
||||
to write a small but complete program, and guides for
|
||||
[compiling GLFW](@ref compile) and
|
||||
[building programs that use GLFW](@ref build).
|
||||
|
||||
If you have used GLFW 2.x in the past, there is a
|
||||
[transition guide](@ref moving) that explains what has changed and how to update
|
||||
existing code to use the new API.
|
||||
|
||||
As this is still unfinished software, there are still [a number of bugs](@ref bug).
|
||||
|
||||
*/
|
||||
|
||||
+12
-3
@@ -9,6 +9,9 @@
|
||||
|
||||
The @ref GLFWmonitor object represents a currently connected monitor.
|
||||
|
||||
|
||||
@section monitor_monitors Retrieving monitors
|
||||
|
||||
The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is usually
|
||||
the user's preferred monitor and the one with global UI elements like task bar
|
||||
or menu bar.
|
||||
@@ -25,7 +28,7 @@ GLFWmonitor** monitors = glfwGetMonitors(&count);
|
||||
@endcode
|
||||
|
||||
|
||||
@section monitor_modes Querying video modes
|
||||
@section monitor_modes Retrieving video modes
|
||||
|
||||
Although GLFW generally does a good job at selecting a suitable video
|
||||
mode for you when you open a full screen window, it is sometimes useful to
|
||||
@@ -49,14 +52,20 @@ const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||
@section monitor_size Monitor physical size
|
||||
|
||||
The physical size in millimetres of a monitor, or an approximation of it, can be
|
||||
retrieved with @ref glfwGetMonitorPhysicalSize. This can, for example, be used
|
||||
together with the current video mode to calculate DPI.
|
||||
retrieved with @ref glfwGetMonitorPhysicalSize.
|
||||
|
||||
@code
|
||||
int widthMM, heightMM;
|
||||
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
|
||||
@endcode
|
||||
|
||||
This can, for example, be used together with the current video mode to calculate
|
||||
the DPI of a monitor.
|
||||
|
||||
@code
|
||||
const double dpi = mode->width / (widthMM / 25.4);
|
||||
@endcode
|
||||
|
||||
|
||||
@section monitor_name Monitor name
|
||||
|
||||
|
||||
+24
-5
@@ -125,6 +125,14 @@ or something else, are nowadays expected to be good desktop citizens and allow
|
||||
these hotkeys to function even when running in full screen mode.
|
||||
|
||||
|
||||
@subsection moving_opened Window open parameter
|
||||
|
||||
The `GLFW_OPENED` window parameter has been removed. As long as the
|
||||
[window object](@ref window_object) is around, the window is "open". To detect
|
||||
when the user attempts to close the window, see @ref glfwWindowShouldClose and
|
||||
the [close callback](@ref GLFWwindowclosefun).
|
||||
|
||||
|
||||
@subsection moving_autopoll Automatic polling of events
|
||||
|
||||
GLFW 3 does not automatically poll for events on @ref glfwSwapBuffers, which
|
||||
@@ -168,13 +176,24 @@ similar to that of GLFW 2.
|
||||
|
||||
@subsection moving_window_close Window closing
|
||||
|
||||
Window closing is now just an event like any other. GLFW 3 windows won't
|
||||
disappear from underfoot even when no close callback is set; instead the
|
||||
window's close flag is set. You can query this flag using @ref
|
||||
glfwWindowShouldClose, or capture close events by setting a close callback. The
|
||||
close flag can be modified from any point in your program using @ref
|
||||
Window closing initiated by the user is now just an event like any other.
|
||||
Unlike GLFW 2, windows and contexts created with GLFW 3 will not disappear from
|
||||
underfoot. Each window now has a close flag, which is set when the user
|
||||
attempts to close it. By default, nothing else happens and the window stays
|
||||
open and visible. It is then up to you to either destroy the window, take some
|
||||
other action or simply ignore the request. You can query the close flag at any
|
||||
time with @ref glfwWindowShouldClose and set it at any time with @ref
|
||||
glfwSetWindowShouldClose.
|
||||
|
||||
The close callback no longer returns a value. Instead, it is called after the
|
||||
close flag has been set so it can override its value, if it chooses to, before
|
||||
event processing completes. You may however not call @ref glfwDestroyWindow
|
||||
from the close callback (or any other window related callback).
|
||||
|
||||
GLFW itself never clears the close flag, allowing you to set it for other
|
||||
reasons for the window to close as well, for example the user choosing Quit from
|
||||
the main menu.
|
||||
|
||||
|
||||
@subsection moving_context Explicit context management
|
||||
|
||||
|
||||
+173
-164
@@ -1,164 +1,173 @@
|
||||
/*!
|
||||
|
||||
@page news New features
|
||||
|
||||
@tableofcontents
|
||||
|
||||
|
||||
@section news_30 New features in version 3.0
|
||||
|
||||
@subsection news_30_cmake CMake build system
|
||||
|
||||
GLFW now uses the CMake build system instead of the various makefiles and
|
||||
project files used by earlier versions. CMake is available for all platforms
|
||||
supported by GLFW, is present in most package systems and can generate
|
||||
makefiles and/or project files for most popular development environments.
|
||||
|
||||
For more information on how to use CMake, see the
|
||||
[CMake manual](http://cmake.org/cmake/help/documentation.html).
|
||||
|
||||
|
||||
@subsection new_30_multiwnd Multi-window support
|
||||
|
||||
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
||||
or OpenGL ES context, and all window functions now take a window handle. Event
|
||||
callbacks are now per-window and are provided with the handle of the window that
|
||||
received the event. The @ref glfwMakeContextCurrent function has been added to
|
||||
select which context is current on a given thread.
|
||||
|
||||
|
||||
@subsection news_30_multimon Multi-monitor support
|
||||
|
||||
GLFW now explicitly supports multiple monitors. They can be enumerated with
|
||||
@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref
|
||||
glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize,
|
||||
and specified at window creation to make the newly created window full screen on
|
||||
that specific monitor.
|
||||
|
||||
|
||||
@subsection news_30_unicode Unicode support
|
||||
|
||||
All string arguments to GLFW functions and all strings returned by GLFW use the
|
||||
UTF-8 encoding. This includes the window title, error string, clipboard text,
|
||||
monitor and joystick names as well as the extension function arguments (as ASCII
|
||||
is a subset of UTF-8).
|
||||
|
||||
|
||||
@subsection news_30_clipboard Clipboard text I/O
|
||||
|
||||
GLFW now supports reading and writing plain text to and from the system
|
||||
clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString
|
||||
functions.
|
||||
|
||||
|
||||
@subsection news_30_gamma Gamma ramp support
|
||||
|
||||
GLFW now supports setting and reading back the gamma ramp of monitors, with the
|
||||
@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref
|
||||
glfwSetGamma, which generates a ramp from a gamma value and then sets it.
|
||||
|
||||
|
||||
@subsection news_30_gles OpenGL ES and EGL support
|
||||
|
||||
GLFW now supports the creation of OpenGL ES contexts, by setting the
|
||||
`GLFW_CLIENT_API` window hint to `GLFW_OPENGL_ES_API`, where creation of such
|
||||
contexts are supported. Note that GLFW *does not implement* OpenGL ES, so your
|
||||
driver must provide support in a way usable by GLFW. Modern nVidia and Intel
|
||||
drivers support creation of OpenGL ES context using the GLX and WGL APIs, while
|
||||
AMD provides an EGL implementation instead.
|
||||
|
||||
GLFW now has an (experimental) EGL context creation back end, which can be
|
||||
selected through CMake options.
|
||||
|
||||
|
||||
@subsection news_30_hidpi High-DPI support
|
||||
|
||||
GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full
|
||||
resolution framebuffers where other UI elements are scaled up. To achieve this,
|
||||
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
|
||||
added. These work with pixels, while the rest of the GLFW API work with screen
|
||||
coordinates.
|
||||
|
||||
|
||||
@subsection news_30_error Error callback
|
||||
|
||||
GLFW now has an error callback, which can provide your application with much
|
||||
more detailed diagnostics than was previously possible. The callback is passed
|
||||
an error code and a description string.
|
||||
|
||||
|
||||
@subsection news_30_wndptr Per-window user pointer
|
||||
|
||||
Each window object has a user-defined pointer, retrieved with @ref
|
||||
glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
|
||||
easier to integrate GLFW into C++ code.
|
||||
|
||||
|
||||
@subsection news_30_iconifyfun Window iconification callback
|
||||
|
||||
Each window object has a callback for iconification and restoration events,
|
||||
which is set with @ref glfwSetWindowIconifyCallback.
|
||||
|
||||
|
||||
@subsection news_30_wndposfun Window position callback
|
||||
|
||||
Each window object has a callback for position events, which is set with @ref
|
||||
glfwSetWindowPosCallback.
|
||||
|
||||
|
||||
@subsection news_30_wndpos Window position query
|
||||
|
||||
The position of a window can now be retrieved using @ref glfwGetWindowPos.
|
||||
|
||||
|
||||
@subsection news_30_focusfun Window focus callback
|
||||
|
||||
Windows now have a callback for focus events, which is set with @ref
|
||||
glfwSetWindowFocusCallback.
|
||||
|
||||
|
||||
@subsection news_30_wndtitle Initial window title
|
||||
|
||||
The title of a window is now specified at creation time, as one of the arguments
|
||||
to @ref glfwCreateWindow.
|
||||
|
||||
|
||||
@subsection news_30_hidden Hidden windows
|
||||
|
||||
Windows can now be hidden with @ref glfwHideWindow, shown using @ref
|
||||
glfwShowWindow and created initially hidden with the `GLFW_VISIBLE` window hint.
|
||||
This allows for off-screen rendering in a way compatible with most drivers, as
|
||||
well as moving a window to a specific position before showing it.
|
||||
|
||||
|
||||
@subsection news_30_undecorated Undecorated windows
|
||||
|
||||
Windowed mode windows can now be created without decorations, i.e. things like
|
||||
a frame, a title bar, with the `GLFW_DECORATED` window hint. This allows for
|
||||
the creation of things like splash screens.
|
||||
|
||||
|
||||
@subsection news_30_keymods Modifier key bit masks
|
||||
|
||||
[Modifier key bit mask](@ref mods) parameters have been added to the
|
||||
[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks.
|
||||
|
||||
|
||||
@subsection news_30_scancode Platform-specific scancodes
|
||||
|
||||
A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys
|
||||
that don't have a [key token](@ref keys) still get passed on with the key
|
||||
parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines
|
||||
and are intended to be used for key bindings.
|
||||
|
||||
|
||||
@subsection news_30_jsname Joystick names
|
||||
|
||||
The name of a joystick can now be retrieved using @ref glfwGetJoystickName.
|
||||
|
||||
|
||||
@subsection news_30_doxygen Doxygen documentation
|
||||
|
||||
You are reading it.
|
||||
|
||||
*/
|
||||
/*!
|
||||
|
||||
@page news New features
|
||||
|
||||
@tableofcontents
|
||||
|
||||
|
||||
@section news_30 New features in version 3.0
|
||||
|
||||
@subsection news_30_cmake CMake build system
|
||||
|
||||
GLFW now uses the CMake build system instead of the various makefiles and
|
||||
project files used by earlier versions. CMake is available for all platforms
|
||||
supported by GLFW, is present in most package systems and can generate
|
||||
makefiles and/or project files for most popular development environments.
|
||||
|
||||
For more information on how to use CMake, see the
|
||||
[CMake manual](http://cmake.org/cmake/help/documentation.html).
|
||||
|
||||
|
||||
@subsection news_30_multiwnd Multi-window support
|
||||
|
||||
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
||||
or OpenGL ES context, and all window functions now take a window handle. Event
|
||||
callbacks are now per-window and are provided with the handle of the window that
|
||||
received the event. The @ref glfwMakeContextCurrent function has been added to
|
||||
select which context is current on a given thread.
|
||||
|
||||
|
||||
@subsection news_30_multimon Multi-monitor support
|
||||
|
||||
GLFW now explicitly supports multiple monitors. They can be enumerated with
|
||||
@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref
|
||||
glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize,
|
||||
and specified at window creation to make the newly created window full screen on
|
||||
that specific monitor.
|
||||
|
||||
|
||||
@subsection news_30_unicode Unicode support
|
||||
|
||||
All string arguments to GLFW functions and all strings returned by GLFW now use
|
||||
the UTF-8 encoding. This includes the window title, error string, clipboard
|
||||
text, monitor and joystick names as well as the extension function arguments (as
|
||||
ASCII is a subset of UTF-8).
|
||||
|
||||
|
||||
@subsection news_30_clipboard Clipboard text I/O
|
||||
|
||||
GLFW now supports reading and writing plain text to and from the system
|
||||
clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString
|
||||
functions.
|
||||
|
||||
|
||||
@subsection news_30_gamma Gamma ramp support
|
||||
|
||||
GLFW now supports setting and reading back the gamma ramp of monitors, with the
|
||||
@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref
|
||||
glfwSetGamma, which generates a ramp from a gamma value and then sets it.
|
||||
|
||||
|
||||
@subsection news_30_gles OpenGL ES support
|
||||
|
||||
GLFW now supports the creation of OpenGL ES contexts, by setting the
|
||||
`GLFW_CLIENT_API` window hint to `GLFW_OPENGL_ES_API`, where creation of such
|
||||
contexts are supported. Note that GLFW *does not implement* OpenGL ES, so your
|
||||
driver must provide support in a way usable by GLFW. Modern nVidia and Intel
|
||||
drivers support creation of OpenGL ES context using the GLX and WGL APIs, while
|
||||
AMD provides an EGL implementation instead.
|
||||
|
||||
|
||||
@subsection news_30_egl (Experimental) EGL support
|
||||
|
||||
GLFW now has an experimental EGL context creation back end that can be selected
|
||||
through CMake options.
|
||||
|
||||
|
||||
@subsection news_30_hidpi High-DPI support
|
||||
|
||||
GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full
|
||||
resolution framebuffers where other UI elements are scaled up. To achieve this,
|
||||
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
|
||||
added. These work with pixels, while the rest of the GLFW API works with screen
|
||||
coordinates.
|
||||
|
||||
|
||||
@subsection news_30_error Error callback
|
||||
|
||||
GLFW now has an error callback, which can provide your application with much
|
||||
more detailed diagnostics than was previously possible. The callback is passed
|
||||
an error code and a description string.
|
||||
|
||||
|
||||
@subsection news_30_wndptr Per-window user pointer
|
||||
|
||||
Each window now has a user-defined pointer, retrieved with @ref
|
||||
glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
|
||||
easier to integrate GLFW into C++ code.
|
||||
|
||||
|
||||
@subsection news_30_iconifyfun Window iconification callback
|
||||
|
||||
Each window now has a callback for iconification and restoration events,
|
||||
which is set with @ref glfwSetWindowIconifyCallback.
|
||||
|
||||
|
||||
@subsection news_30_wndposfun Window position callback
|
||||
|
||||
Each window now has a callback for position events, which is set with @ref
|
||||
glfwSetWindowPosCallback.
|
||||
|
||||
|
||||
@subsection news_30_wndpos Window position query
|
||||
|
||||
The position of a window can now be retrieved using @ref glfwGetWindowPos.
|
||||
|
||||
|
||||
@subsection news_30_focusfun Window focus callback
|
||||
|
||||
Each windows now has a callback for focus events, which is set with @ref
|
||||
glfwSetWindowFocusCallback.
|
||||
|
||||
|
||||
@subsection news_30_enterleave Cursor enter/leave callback
|
||||
|
||||
Each window now has a callback for when the mouse cursor enters or leaves its
|
||||
client area, which is set with @ref glfwSetCursorEnterCallback.
|
||||
|
||||
|
||||
@subsection news_30_wndtitle Initial window title
|
||||
|
||||
The title of a window is now specified at creation time, as one of the arguments
|
||||
to @ref glfwCreateWindow.
|
||||
|
||||
|
||||
@subsection news_30_hidden Hidden windows
|
||||
|
||||
Windows can now be hidden with @ref glfwHideWindow, shown using @ref
|
||||
glfwShowWindow and created initially hidden with the `GLFW_VISIBLE` window hint.
|
||||
This allows for off-screen rendering in a way compatible with most drivers, as
|
||||
well as moving a window to a specific position before showing it.
|
||||
|
||||
|
||||
@subsection news_30_undecorated Undecorated windows
|
||||
|
||||
Windowed mode windows can now be created without decorations, i.e. things like
|
||||
a frame, a title bar, with the `GLFW_DECORATED` window hint. This allows for
|
||||
the creation of things like splash screens.
|
||||
|
||||
|
||||
@subsection news_30_keymods Modifier key bit masks
|
||||
|
||||
[Modifier key bit mask](@ref mods) parameters have been added to the
|
||||
[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks.
|
||||
|
||||
|
||||
@subsection news_30_scancode Platform-specific scancodes
|
||||
|
||||
A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys
|
||||
that don't have a [key token](@ref keys) still get passed on with the key
|
||||
parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines
|
||||
and are intended to be used for key bindings.
|
||||
|
||||
|
||||
@subsection news_30_jsname Joystick names
|
||||
|
||||
The name of a joystick can now be retrieved using @ref glfwGetJoystickName.
|
||||
|
||||
|
||||
@subsection news_30_doxygen Doxygen documentation
|
||||
|
||||
You are reading it.
|
||||
|
||||
*/
|
||||
|
||||
+6
-3
@@ -140,9 +140,9 @@ full screen, just pass along the monitor handle:
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
|
||||
@endcode
|
||||
|
||||
Full screen windows cover the entire screen, have no border or decorations, and
|
||||
change the monitor's resolution to the one most closely matching the requested
|
||||
window size.
|
||||
Full screen windows cover the entire display area of a monitor, have no border
|
||||
or decorations, and change the monitor's resolution to the one most closely
|
||||
matching the requested window size.
|
||||
|
||||
When you are done with the window, destroy it with the @ref glfwDestroyWindow
|
||||
function.
|
||||
@@ -302,4 +302,7 @@ the screen, rendering a triangle and processing events until the user closes the
|
||||
window. It can be found in the source distribution as `examples/simple.c`, and
|
||||
is by default compiled along with all other examples when you build GLFW.
|
||||
|
||||
To learn more about how to compile and link programs that use GLFW, see
|
||||
@ref build.
|
||||
|
||||
*/
|
||||
|
||||
+106
-11
@@ -6,7 +6,7 @@
|
||||
|
||||
The primary purpose of GLFW is to provide a simple interface to window
|
||||
management and OpenGL and OpenGL ES context creation. GLFW supports multiple
|
||||
windows, which can be either a normal desktop window or a fullscreen window.
|
||||
windows, which can be either a normal desktop window or a full screen window.
|
||||
|
||||
|
||||
@section window_object Window handles
|
||||
@@ -17,6 +17,59 @@ created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow (or
|
||||
linked, the object pointer is used as both a context and window handle.
|
||||
|
||||
|
||||
@section window_creation Window creation
|
||||
|
||||
The window and its context are created with @ref glfwCreateWindow, which
|
||||
returns a handle to the created window object. For example, this creates a 640
|
||||
by 480 windowed mode window:
|
||||
|
||||
@code
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||
@endcode
|
||||
|
||||
If window creation fails, `NULL` will be returned, so you need to check whether
|
||||
it did.
|
||||
|
||||
This handle is then passed to all window related functions, and is provided to
|
||||
you along with input events, so you know which window received the input.
|
||||
|
||||
To create a full screen window, you need to specify which monitor the window
|
||||
should use. In most cases, the user's primary monitor is a good choice. For
|
||||
more information about monitors, see the @ref monitor.
|
||||
|
||||
@code
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
|
||||
@endcode
|
||||
|
||||
Full screen windows cover the entire display area of a monitor, have no border
|
||||
or decorations, and change the monitor's resolution to the one most closely
|
||||
matching the requested window size.
|
||||
|
||||
For more control over how the window and its context are created, see @ref
|
||||
window_hints below.
|
||||
|
||||
|
||||
@section window_destruction Window destruction
|
||||
|
||||
When you are done with the window, destroy it with the @ref glfwDestroyWindow
|
||||
function.
|
||||
|
||||
@code
|
||||
glfwDestroyWindow(window);
|
||||
@endcode
|
||||
|
||||
Once this function is called, no more events will be delivered for that window
|
||||
and its handle becomes invalid.
|
||||
|
||||
|
||||
@section window_userptr Window user pointer
|
||||
|
||||
Each window has a user pointer that can be set with @ref
|
||||
glfwSetWindowUserPointer and fetched with @ref glfwGetWindowUserPointer. This
|
||||
can be used for any purpose you need and will not modified by GLFW throughout
|
||||
the life-time of the window.
|
||||
|
||||
|
||||
@section window_hints Window creation hints
|
||||
|
||||
There are a number of hints that can be set before the creation of a window and
|
||||
@@ -54,14 +107,14 @@ Hints that do not apply to a given type of window or context are ignored.
|
||||
|
||||
The `GLFW_RESIZABLE` hint specifies whether the window will be resizable *by the
|
||||
user*. The window will still be resizable using the @ref glfwSetWindowSize
|
||||
function. This hint is ignored for fullscreen windows.
|
||||
function. This hint is ignored for full screen windows.
|
||||
|
||||
The `GLFW_VISIBLE` hint specifies whether the window will be initially
|
||||
visible. This hint is ignored for fullscreen windows.
|
||||
visible. This hint is ignored for full screen windows.
|
||||
|
||||
The `GLFW_DECORATED` hint specifies whether the window will have window
|
||||
decorations such as a border, a close widget, etc. This hint is ignored for
|
||||
fullscreen windows. Note that even though a window may lack a close widget, it
|
||||
full screen windows. Note that even though a window may lack a close widget, it
|
||||
is usually still possible for the user to generate close events.
|
||||
|
||||
|
||||
@@ -227,13 +280,11 @@ the system, you can set the size callback with @ref glfwSetWindowSizeCallback.
|
||||
glfwSetWindowSizeCallback(window, window_size_callback);
|
||||
@endcode
|
||||
|
||||
The callback function receives the new size of the client area of the window,
|
||||
which can for example be used to update the viewport.
|
||||
The callback function receives the new size of the client area of the window.
|
||||
|
||||
@code
|
||||
void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
@endcode
|
||||
|
||||
@@ -243,9 +294,49 @@ a window.
|
||||
@code
|
||||
int width, height;
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
@endcode
|
||||
|
||||
|
||||
@section window_fbsize Window framebuffer size
|
||||
|
||||
While the size of a window is measured in screen coordinates, OpenGL works with
|
||||
pixels. The size you pass into `glViewport`, for example, should be in pixels
|
||||
and not screen coordinates. On some platforms screen coordinates and pixels are
|
||||
the same, but this is not the case on all platforms supported by GLFW. There is
|
||||
a second set of functions to retrieve the size in pixels of the framebuffer of
|
||||
a window.
|
||||
|
||||
If you wish to be notified when the framebuffer of a window is resized, whether
|
||||
by the user or the system, you can set the size callback with @ref
|
||||
glfwSetFramebufferSizeCallback.
|
||||
|
||||
@code
|
||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||
@endcode
|
||||
|
||||
The callback function receives the new size of the client area of the window,
|
||||
which can for example be used to update the OpenGL viewport.
|
||||
|
||||
@code
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
@endcode
|
||||
|
||||
There is also @ref glfwGetFramebufferSize for directly retrieving the current
|
||||
size of the framebuffer of a window.
|
||||
|
||||
@code
|
||||
int width, height;
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
glViewport(0, 0, width, height);
|
||||
@endcode
|
||||
|
||||
Note that the size of a framebuffer may change independently of the size of
|
||||
a window, for example if the window is dragged between a regular monitor and
|
||||
a high-DPI one.
|
||||
|
||||
|
||||
@section window_pos Window position
|
||||
|
||||
@@ -357,7 +448,9 @@ context is an OpenGL debug context, or `GL_FALSE` otherwise.
|
||||
The `GLFW_OPENGL_PROFILE` attribute indicates the OpenGL profile used by the
|
||||
context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`
|
||||
if the context uses a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the
|
||||
OpenGL profile is unknown or the context is for another client API.
|
||||
OpenGL profile is unknown or the context is for another client API. Note that
|
||||
the returned profile may not match the profile bits of the context flags, as
|
||||
GLFW will try other means of detecting the profile when no bits are set.
|
||||
|
||||
The `GLFW_CONTEXT_ROBUSTNESS` attribute indicates the robustness strategy
|
||||
used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or
|
||||
@@ -394,8 +487,10 @@ zero can be useful for benchmarking purposes, when it is not desirable to
|
||||
measure the time it takes to wait for the vertical retrace. However, a swap
|
||||
interval of one lets you avoid tearing.
|
||||
|
||||
Note that not all OpenGL implementations properly implement this function, in
|
||||
which case @ref glfwSwapInterval will have no effect. Some drivers also have
|
||||
user settings that override requests by GLFW.
|
||||
Note that this may not work on all machines, as some drivers have
|
||||
user-controlled settings that override any swap interval the application
|
||||
requests. It is also by default disabled on Windows Vista and later when using
|
||||
DWM (Aero), as using it there sometimes leads to severe jitter. You can
|
||||
forcibly enable it for machines using DWM using @ref compile_options_win32.
|
||||
|
||||
*/
|
||||
|
||||
@@ -11,10 +11,6 @@ endif()
|
||||
include_directories(${GLFW_SOURCE_DIR}/include
|
||||
${GLFW_SOURCE_DIR}/deps)
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE)
|
||||
# HACK: This is NOTFOUND on OS X 10.8
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
@@ -644,7 +644,7 @@ int main(int argc, char** argv)
|
||||
/* main loop */
|
||||
frame = 0;
|
||||
iter = 0;
|
||||
dt = last_update_time = glfwGetTime();
|
||||
last_update_time = glfwGetTime();
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
|
||||
+126
-83
@@ -1,7 +1,6 @@
|
||||
/*************************************************************************
|
||||
* GLFW - An OpenGL library
|
||||
* API version: 3.0
|
||||
* WWW: http://www.glfw.org/
|
||||
* GLFW 3.0 - www.glfw.org
|
||||
* A library for OpenGL, window and input
|
||||
*------------------------------------------------------------------------
|
||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -45,21 +44,22 @@ extern "C" {
|
||||
*/
|
||||
/*! @defgroup error Error handling
|
||||
*/
|
||||
/*! @defgroup gamma Gamma ramp support
|
||||
*/
|
||||
/*! @defgroup init Initialization and version information
|
||||
*/
|
||||
/*! @defgroup input Input handling
|
||||
*/
|
||||
/*! @defgroup monitor Monitor handling
|
||||
*
|
||||
* This is the reference documentation for monitor related functions and types.
|
||||
* For more information, see the @ref monitor.
|
||||
*/
|
||||
/*! @defgroup time Time input
|
||||
*/
|
||||
/*! @defgroup window Window handling
|
||||
*
|
||||
* This is the reference documentation for the window handling API, including
|
||||
* creation, deletion and event polling. For more information, see the
|
||||
* [article on window handling](@ref window).
|
||||
* This is the reference documentation for window related functions and types,
|
||||
* including creation, deletion and event polling. For more information, see
|
||||
* the @ref window.
|
||||
*/
|
||||
|
||||
|
||||
@@ -131,45 +131,12 @@ extern "C" {
|
||||
#define GLFW_CALLBACK_DEFINED
|
||||
#endif /* CALLBACK */
|
||||
|
||||
/* Most <GL/glu.h> variants on Windows need wchar_t */
|
||||
#if defined(_WIN32)
|
||||
/* Most GL/glu.h variants on Windows need wchar_t
|
||||
* OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */
|
||||
#if !defined(GLFW_INCLUDE_NONE)
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* ---------------- GLFW related system specific defines ----------------- */
|
||||
|
||||
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
|
||||
#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
|
||||
|
||||
/* We are building a Win32 DLL */
|
||||
#define GLFWAPI __declspec(dllexport)
|
||||
|
||||
#elif defined(_WIN32) && defined(GLFW_DLL)
|
||||
|
||||
/* We are calling a Win32 DLL */
|
||||
#if defined(__LCC__)
|
||||
#define GLFWAPI extern
|
||||
#else
|
||||
#define GLFWAPI __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
|
||||
|
||||
#define GLFWAPI __attribute__((visibility("default")))
|
||||
|
||||
#else
|
||||
|
||||
/* We are either building/calling a static lib or we are non-win32 */
|
||||
#define GLFWAPI
|
||||
|
||||
#endif
|
||||
|
||||
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
|
||||
|
||||
/* Include the chosen client API headers.
|
||||
*/
|
||||
#if defined(__APPLE_CC__)
|
||||
@@ -199,6 +166,41 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
|
||||
/* GLFW_DLL is defined by users of GLFW when compiling programs that will link
|
||||
* to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the
|
||||
* GLFW configuration header when compiling the DLL version of the library.
|
||||
*/
|
||||
#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
|
||||
|
||||
/* We are building a Win32 DLL */
|
||||
#define GLFWAPI __declspec(dllexport)
|
||||
|
||||
#elif defined(_WIN32) && defined(GLFW_DLL)
|
||||
|
||||
/* We are calling a Win32 DLL */
|
||||
#if defined(__LCC__)
|
||||
#define GLFWAPI extern
|
||||
#else
|
||||
#define GLFWAPI __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
|
||||
|
||||
#define GLFWAPI __attribute__((visibility("default")))
|
||||
|
||||
#else
|
||||
|
||||
/* We are either building/calling a static lib or we are non-win32 */
|
||||
#define GLFWAPI
|
||||
|
||||
#endif
|
||||
|
||||
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* GLFW API tokens
|
||||
@@ -225,7 +227,7 @@ extern "C" {
|
||||
* API changes.
|
||||
* @ingroup init
|
||||
*/
|
||||
#define GLFW_VERSION_REVISION 0
|
||||
#define GLFW_VERSION_REVISION 4
|
||||
/*! @} */
|
||||
|
||||
/*! @name Key and button actions
|
||||
@@ -704,8 +706,8 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
||||
* This is the function signature for cursor position callback functions.
|
||||
*
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] xpos The new x-coordinate of the cursor.
|
||||
* @param[in] ypos The new y-coordinate of the cursor.
|
||||
* @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.
|
||||
* @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.
|
||||
*
|
||||
* @sa glfwSetCursorPosCallback
|
||||
*
|
||||
@@ -763,7 +765,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
||||
* This is the function signature for Unicode character callback functions.
|
||||
*
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] character The Unicode code point of the character.
|
||||
* @param[in] codepoint The Unicode code point of the character.
|
||||
*
|
||||
* @sa glfwSetCharCallback
|
||||
*
|
||||
@@ -790,7 +792,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
||||
*
|
||||
* @ingroup monitor
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct GLFWvidmode
|
||||
{
|
||||
/*! The width, in screen coordinates, of the video mode.
|
||||
*/
|
||||
@@ -818,9 +820,9 @@ typedef struct
|
||||
*
|
||||
* @sa glfwGetGammaRamp glfwSetGammaRamp
|
||||
*
|
||||
* @ingroup gamma
|
||||
* @ingroup monitor
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct GLFWgammaramp
|
||||
{
|
||||
/*! An array of value describing the response of the red channel.
|
||||
*/
|
||||
@@ -861,10 +863,7 @@ typedef struct
|
||||
*
|
||||
* @note This function may only be called from the main thread.
|
||||
*
|
||||
* @note This function may take several seconds to complete on some systems,
|
||||
* while on other systems it may take only a fraction of a second to complete.
|
||||
*
|
||||
* @note **Mac OS X:** This function will change the current directory of the
|
||||
* @note **OS X:** This function will change the current directory of the
|
||||
* application to the `Contents/Resources` subdirectory of the application's
|
||||
* bundle, if present.
|
||||
*
|
||||
@@ -1119,12 +1118,12 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
|
||||
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
|
||||
*
|
||||
* This function generates a 256-element gamma ramp from the specified exponent
|
||||
* and then calls @ref glfwSetGamma with it.
|
||||
* and then calls @ref glfwSetGammaRamp with it.
|
||||
*
|
||||
* @param[in] monitor The monitor whose gamma ramp to set.
|
||||
* @param[in] gamma The desired exponent.
|
||||
*
|
||||
* @ingroup gamma
|
||||
* @ingroup monitor
|
||||
*/
|
||||
GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
|
||||
|
||||
@@ -1138,7 +1137,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
|
||||
* @note The value arrays of the returned ramp are allocated and freed by GLFW.
|
||||
* You should not free them yourself.
|
||||
*
|
||||
* @ingroup gamma
|
||||
* @ingroup monitor
|
||||
*/
|
||||
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
|
||||
|
||||
@@ -1151,7 +1150,7 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
|
||||
*
|
||||
* @note Gamma ramp sizes other than 256 are not supported by all hardware.
|
||||
*
|
||||
* @ingroup gamma
|
||||
* @ingroup monitor
|
||||
*/
|
||||
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
||||
|
||||
@@ -1207,10 +1206,16 @@ GLFWAPI void glfwWindowHint(int target, int hint);
|
||||
* attributes of the created window and context, use queries like @ref
|
||||
* glfwGetWindowAttrib and @ref glfwGetWindowSize.
|
||||
*
|
||||
* To create a full screen window, you need to specify the monitor to use. If
|
||||
* no monitor is specified, windowed mode will be used. Unless you have a way
|
||||
* for the user to choose a specific monitor, it is recommended that you pick
|
||||
* the primary monitor. For more information on how to retrieve monitors, see
|
||||
* @ref monitor_monitors.
|
||||
*
|
||||
* To create the window at a specific position, make it initially invisible
|
||||
* using the `GLFW_VISIBLE` window hint, set its position and then show it.
|
||||
*
|
||||
* If a fullscreen window is active, the screensaver is prohibited from
|
||||
* If a full screen window is active, the screensaver is prohibited from
|
||||
* starting.
|
||||
*
|
||||
* @param[in] width The desired width, in screen coordinates, of the window.
|
||||
@@ -1224,17 +1229,26 @@ GLFWAPI void glfwWindowHint(int target, int hint);
|
||||
* to not share resources.
|
||||
* @return The handle of the created window, or `NULL` if an error occurred.
|
||||
*
|
||||
* @remarks **Windows:** Window creation will fail if the Microsoft GDI
|
||||
* software OpenGL implementation is the only one available.
|
||||
*
|
||||
* @remarks **Windows:** If the executable has an icon resource named
|
||||
* `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
|
||||
* present, the `IDI_WINLOGO` icon will be used instead.
|
||||
*
|
||||
* @remarks **Mac OS X:** The GLFW window has no icon, as it is not a document
|
||||
* @remarks **OS X:** The GLFW window has no icon, as it is not a document
|
||||
* window, but the dock icon will be the same as the application bundle's icon.
|
||||
* Also, the first time a window is opened the menu bar is populated with
|
||||
* common commands like Hide, Quit and About. The (minimal) about dialog uses
|
||||
* information from the application's bundle. For more information on bundles,
|
||||
* see the Bundle Programming Guide provided by Apple.
|
||||
*
|
||||
* @remarks **X11:** There is no mechanism for setting the window icon yet.
|
||||
*
|
||||
* @remarks The swap interval is not set during window creation, but is left at
|
||||
* the default value for that platform. For more information, see @ref
|
||||
* glfwSwapInterval.
|
||||
*
|
||||
* @note This function may only be called from the main thread.
|
||||
*
|
||||
* @sa glfwDestroyWindow
|
||||
@@ -1272,6 +1286,8 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
|
||||
* @param[in] window The window to query.
|
||||
* @return The value of the close flag.
|
||||
*
|
||||
* @remarks This function may be called from secondary threads.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
|
||||
@@ -1285,6 +1301,8 @@ GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
|
||||
* @param[in] window The window whose flag to change.
|
||||
* @param[in] value The new value.
|
||||
*
|
||||
* @remarks This function may be called from secondary threads.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
|
||||
@@ -1342,10 +1360,6 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
||||
*
|
||||
* @note The window manager may put limits on what positions are allowed.
|
||||
*
|
||||
* @bug **X11:** Some window managers ignore the set position of hidden (i.e.
|
||||
* unmapped) windows, instead placing them where it thinks is appropriate once
|
||||
* they are shown.
|
||||
*
|
||||
* @sa glfwGetWindowPos
|
||||
*
|
||||
* @ingroup window
|
||||
@@ -1355,7 +1369,8 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
|
||||
/*! @brief Retrieves the size of the client area of the specified window.
|
||||
*
|
||||
* This function retrieves the size, in screen coordinates, of the client area
|
||||
* of the specified window.
|
||||
* of the specified window. If you wish to retrieve the size of the
|
||||
* framebuffer in pixels, see @ref glfwGetFramebufferSize.
|
||||
*
|
||||
* @param[in] window The window whose size to retrieve.
|
||||
* @param[out] width Where to store the width, in screen coordinates, of the
|
||||
@@ -1396,7 +1411,8 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
|
||||
/*! @brief Retrieves the size of the framebuffer of the specified window.
|
||||
*
|
||||
* This function retrieves the size, in pixels, of the framebuffer of the
|
||||
* specified window.
|
||||
* specified window. If you wish to retrieve the size of the window in screen
|
||||
* coordinates, see @ref glfwGetWindowSize.
|
||||
*
|
||||
* @param[in] window The window whose framebuffer to query.
|
||||
* @param[out] width Where to store the width, in pixels, of the framebuffer,
|
||||
@@ -1579,7 +1595,10 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
|
||||
* @return The previously set callback, or `NULL` if no callback was set or an
|
||||
* error occurred.
|
||||
*
|
||||
* @remarks **Mac OS X:** Selecting Quit from the application menu will
|
||||
* @par New in GLFW 3
|
||||
* The close callback no longer returns a value.
|
||||
*
|
||||
* @remarks **OS X:** Selecting Quit from the application menu will
|
||||
* trigger the close callback for all windows.
|
||||
*
|
||||
* @ingroup window
|
||||
@@ -1672,6 +1691,12 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window
|
||||
* This function is no longer called by @ref glfwSwapBuffers. You need to call
|
||||
* it or @ref glfwWaitEvents yourself.
|
||||
*
|
||||
* @remarks On some platforms, a window move, resize or menu operation will
|
||||
* cause event processing to block. This is due to how event processing is
|
||||
* designed on those platforms. You can use the
|
||||
* [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents
|
||||
* of your window when necessary during the operation.
|
||||
*
|
||||
* @note This function may only be called from the main thread.
|
||||
*
|
||||
* @note This function may not be called from a callback.
|
||||
@@ -1688,7 +1713,7 @@ GLFWAPI void glfwPollEvents(void);
|
||||
/*! @brief Waits until events are pending and processes them.
|
||||
*
|
||||
* This function puts the calling thread to sleep until at least one event has
|
||||
* been received. Once one or more events have been recevied, it behaves as if
|
||||
* been received. Once one or more events have been received, it behaves as if
|
||||
* @ref glfwPollEvents was called, i.e. the events are processed and the
|
||||
* function then returns immediately. Processing events will cause the window
|
||||
* and input callbacks associated with those events to be called.
|
||||
@@ -1699,6 +1724,12 @@ GLFWAPI void glfwPollEvents(void);
|
||||
*
|
||||
* This function is not required for joystick input to work.
|
||||
*
|
||||
* @remarks On some platforms, a window move, resize or menu operation will
|
||||
* cause event processing to block. This is due to how event processing is
|
||||
* designed on those platforms. You can use the
|
||||
* [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents
|
||||
* of your window when necessary during the operation.
|
||||
*
|
||||
* @note This function may only be called from the main thread.
|
||||
*
|
||||
* @note This function may not be called from a callback.
|
||||
@@ -1734,9 +1765,12 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
|
||||
* modes:
|
||||
* - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
|
||||
* - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
|
||||
* area of the window.
|
||||
* - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on
|
||||
* cursor movement.
|
||||
* area of the window but does not restrict the cursor from leaving. This is
|
||||
* useful if you wish to render your own cursor or have no visible cursor at
|
||||
* all.
|
||||
* - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
|
||||
* and unlimited cursor movement. This is useful for implementing for
|
||||
* example 3D camera controls.
|
||||
*
|
||||
* If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
|
||||
* enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
|
||||
@@ -1806,7 +1840,8 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
||||
/*! @brief Retrieves the last reported cursor position, relative to the client
|
||||
* area of the window.
|
||||
*
|
||||
* This function returns the last reported position of the cursor to the
|
||||
* This function returns the last reported position of the cursor, in screen
|
||||
* coordinates, relative to the upper-left corner of the client area of the
|
||||
* specified window.
|
||||
*
|
||||
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
|
||||
@@ -1829,11 +1864,13 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
|
||||
*/
|
||||
GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
||||
|
||||
/*! @brief Sets the position of the cursor, relative to the client area of the window.
|
||||
/*! @brief Sets the position of the cursor, relative to the client area of the
|
||||
* window.
|
||||
*
|
||||
* This function sets the position of the cursor. The specified window must be
|
||||
* focused. If the window does not have focus when this function is called, it
|
||||
* fails silently.
|
||||
* This function sets the position, in screen coordinates, of the cursor
|
||||
* relative to the upper-left corner of the client area of the specified
|
||||
* window. The window must be focused. If the window does not have focus when
|
||||
* this function is called, it fails silently.
|
||||
*
|
||||
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
|
||||
* position is unbounded and limited only by the minimum and maximum values of
|
||||
@@ -1841,9 +1878,9 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
||||
*
|
||||
* @param[in] window The desired window.
|
||||
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
|
||||
* client area, or `NULL`.
|
||||
* client area.
|
||||
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
|
||||
* client area, or `NULL`.
|
||||
* client area.
|
||||
*
|
||||
* @sa glfwGetCursorPos
|
||||
*
|
||||
@@ -1929,7 +1966,8 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmo
|
||||
*
|
||||
* This function sets the cursor position callback of the specified window,
|
||||
* which is called when the cursor is moved. The callback is provided with the
|
||||
* position relative to the upper-left corner of the client area of the window.
|
||||
* position, in screen coordinates, relative to the upper-left corner of the
|
||||
* client area of the window.
|
||||
*
|
||||
* @param[in] window The window whose callback to set.
|
||||
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
||||
@@ -2006,14 +2044,14 @@ GLFWAPI int glfwJoystickPresent(int joy);
|
||||
*/
|
||||
GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
|
||||
|
||||
/*! @brief Returns the values of all buttons of the specified joystick.
|
||||
/*! @brief Returns the state of all buttons of the specified joystick.
|
||||
*
|
||||
* This function returns the values of all buttons of the specified joystick.
|
||||
* This function returns the state of all buttons of the specified joystick.
|
||||
*
|
||||
* @param[in] joy The joystick to query.
|
||||
* @param[out] count Where to store the size of the returned array. This is
|
||||
* set to zero if an error occurred.
|
||||
* @return An array of axis values, or `NULL` if the joystick is not present.
|
||||
* @return An array of button states, or `NULL` if the joystick is not present.
|
||||
*
|
||||
* @note The returned array is allocated and freed by GLFW. You should not
|
||||
* free it yourself.
|
||||
@@ -2189,6 +2227,11 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
|
||||
*
|
||||
* @remarks This function may be called from secondary threads.
|
||||
*
|
||||
* @note This function is not called during window creation, leaving the swap
|
||||
* interval set to whatever is the default on that platform. This is done
|
||||
* because some swap interval extensions used by GLFW do not allow the swap
|
||||
* interval to be reset to zero once it has been set to a non-zero value.
|
||||
*
|
||||
* @note Some GPU drivers do not honor the requested swap interval, either
|
||||
* because of user settings that override the request or due to bugs in the
|
||||
* driver.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*************************************************************************
|
||||
* GLFW - An OpenGL library
|
||||
* API version: 3.0
|
||||
* WWW: http://www.glfw.org/
|
||||
* GLFW 3.0 - www.glfw.org
|
||||
* A library for OpenGL, window and input
|
||||
*------------------------------------------------------------------------
|
||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -41,7 +40,7 @@ extern "C" {
|
||||
|
||||
/*! @defgroup native Native access
|
||||
*
|
||||
* **By using the native API, you assert that you know what you are doing and
|
||||
* **By using the native API, you assert that you know what you're doing and
|
||||
* how to fix problems caused by using it. If you don't, you shouldn't be
|
||||
* using it.**
|
||||
*
|
||||
@@ -60,8 +59,8 @@ extern "C" {
|
||||
* * `GLFW_EXPOSE_NATIVE_GLX`
|
||||
* * `GLFW_EXPOSE_NATIVE_EGL`
|
||||
*
|
||||
* These macros select which of the native access functions are declared and
|
||||
* which platform-specific headers to include. It is then up your (by
|
||||
* These macros select which of the native access functions that are declared
|
||||
* and which platform-specific headers to include. It is then up your (by
|
||||
* definition platform-specific) code to handle which of these should be
|
||||
* defined.
|
||||
*/
|
||||
|
||||
+9
-8
@@ -3,11 +3,11 @@ include_directories(${GLFW_SOURCE_DIR}/src
|
||||
${GLFW_BINARY_DIR}/src
|
||||
${glfw_INCLUDE_DIRS})
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
add_definitions(-D_GLFW_USE_CONFIG_H)
|
||||
|
||||
set(common_HEADERS ${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h internal.h)
|
||||
set(common_HEADERS ${GLFW_BINARY_DIR}/src/glfw_config.h internal.h
|
||||
${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h
|
||||
${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h)
|
||||
set(common_SOURCES clipboard.c context.c gamma.c init.c input.c joystick.c
|
||||
monitor.c time.c window.c)
|
||||
|
||||
@@ -74,14 +74,15 @@ if (BUILD_SHARED_LIBS)
|
||||
set(glfw_CFLAGS "")
|
||||
endif()
|
||||
set_target_properties(glfw PROPERTIES
|
||||
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common")
|
||||
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common"
|
||||
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(glfw ${glfw_LIBRARIES})
|
||||
target_link_libraries(glfw LINK_INTERFACE_LIBRARIES)
|
||||
endif()
|
||||
|
||||
install(TARGETS glfw
|
||||
EXPORT glfwTargets
|
||||
DESTINATION lib${LIB_SUFFIX} )
|
||||
if (GLFW_INSTALL)
|
||||
install(TARGETS glfw EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX})
|
||||
endif()
|
||||
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
|
||||
+4
-7
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -43,7 +40,7 @@
|
||||
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||
CGGammaValue* values = (CGGammaValue*) malloc(size * 3 * sizeof(CGGammaValue));
|
||||
CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
|
||||
|
||||
CGGetDisplayTransferByTable(monitor->ns.displayID,
|
||||
size,
|
||||
@@ -52,7 +49,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
values + size * 2,
|
||||
&size);
|
||||
|
||||
_glfwAllocGammaRamp(ramp, size);
|
||||
_glfwAllocGammaArrays(ramp, size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
@@ -67,7 +64,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
{
|
||||
int i;
|
||||
CGGammaValue* values = (CGGammaValue*) malloc(ramp->size * 3 * sizeof(CGGammaValue));
|
||||
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
|
||||
|
||||
for (i = 0; i < ramp->size; i++)
|
||||
{
|
||||
|
||||
+10
-13
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa/NSOpenGL
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -84,19 +81,18 @@ int _glfwPlatformInit(void)
|
||||
changeToResourcesDirectory();
|
||||
#endif
|
||||
|
||||
_glfwInitTimer();
|
||||
|
||||
_glfwInitJoysticks();
|
||||
|
||||
if (!_glfwInitContextAPI())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||
if (!_glfw.ns.eventSource)
|
||||
return GL_FALSE;
|
||||
|
||||
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
|
||||
|
||||
if (!_glfwInitContextAPI())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfwInitTimer();
|
||||
_glfwInitJoysticks();
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -118,14 +114,15 @@ void _glfwPlatformTerminate(void)
|
||||
[_glfw.ns.cursor release];
|
||||
_glfw.ns.cursor = nil;
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
free(_glfw.ns.clipboardString);
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
_glfwTerminateContextAPI();
|
||||
}
|
||||
|
||||
const char* _glfwPlatformGetVersionString(void)
|
||||
{
|
||||
const char* version = _GLFW_VERSION_FULL " Cocoa"
|
||||
const char* version = _GLFW_VERSION_NUMBER " Cocoa"
|
||||
#if defined(_GLFW_NSGL)
|
||||
" NSGL"
|
||||
#endif
|
||||
|
||||
+19
-26
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
||||
@@ -113,7 +110,7 @@ static void addJoystickElement(_GLFWjoy* joystick, CFTypeRef elementRef)
|
||||
{
|
||||
long number;
|
||||
CFTypeRef numberRef;
|
||||
_GLFWjoyelement* element = (_GLFWjoyelement*) malloc(sizeof(_GLFWjoyelement));
|
||||
_GLFWjoyelement* element = calloc(1, sizeof(_GLFWjoyelement));
|
||||
|
||||
CFArrayAppendValue(elementsArray, element);
|
||||
|
||||
@@ -254,9 +251,6 @@ static void pollJoystickEvents(void)
|
||||
joystick->axes[i] = value;
|
||||
else
|
||||
joystick->axes[i] = (2.f * (value - axis->minReport) / readScale) - 1.f;
|
||||
|
||||
if (i & 1)
|
||||
joystick->axes[i] = -joystick->axes[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < CFArrayGetCount(joystick->hatElements); i++)
|
||||
@@ -322,8 +316,9 @@ void _glfwInitJoysticks(void)
|
||||
|
||||
while ((ioHIDDeviceObject = IOIteratorNext(objectIterator)))
|
||||
{
|
||||
CFMutableDictionaryRef propsRef = NULL;
|
||||
CFTypeRef valueRef = NULL;
|
||||
kern_return_t result;
|
||||
CFTypeRef valueRef = 0;
|
||||
|
||||
IOCFPlugInInterface** ppPlugInInterface = NULL;
|
||||
HRESULT plugInResult = S_OK;
|
||||
@@ -332,26 +327,29 @@ void _glfwInitJoysticks(void)
|
||||
long usagePage, usage;
|
||||
|
||||
// Check device type
|
||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
||||
CFSTR(kIOHIDPrimaryUsagePageKey),
|
||||
result = IORegistryEntryCreateCFProperties(ioHIDDeviceObject,
|
||||
&propsRef,
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
|
||||
if (result != kIOReturnSuccess)
|
||||
continue;
|
||||
|
||||
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsagePageKey));
|
||||
if (valueRef)
|
||||
{
|
||||
CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage);
|
||||
if (usagePage != kHIDPage_GenericDesktop)
|
||||
{
|
||||
// This device is not relevant to GLFW
|
||||
CFRelease(valueRef);
|
||||
continue;
|
||||
}
|
||||
|
||||
CFRelease(valueRef);
|
||||
}
|
||||
|
||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
||||
CFSTR(kIOHIDPrimaryUsageKey),
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsageKey));
|
||||
if (valueRef)
|
||||
{
|
||||
CFNumberGetValue(valueRef, kCFNumberLongType, &usage);
|
||||
@@ -361,6 +359,7 @@ void _glfwInitJoysticks(void)
|
||||
usage != kHIDUsage_GD_MultiAxisController))
|
||||
{
|
||||
// This device is not relevant to GLFW
|
||||
CFRelease(valueRef);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -396,10 +395,7 @@ void _glfwInitJoysticks(void)
|
||||
joystick);
|
||||
|
||||
// Get product string
|
||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
||||
CFSTR(kIOHIDProductKey),
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDProductKey));
|
||||
if (valueRef)
|
||||
{
|
||||
CFStringGetCString(valueRef,
|
||||
@@ -413,10 +409,7 @@ void _glfwInitJoysticks(void)
|
||||
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||
|
||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
||||
CFSTR(kIOHIDElementKey),
|
||||
kCFAllocatorDefault,
|
||||
kNilOptions);
|
||||
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDElementKey));
|
||||
if (CFGetTypeID(valueRef) == CFArrayGetTypeID())
|
||||
{
|
||||
CFRange range = { 0, CFArrayGetCount(valueRef) };
|
||||
@@ -427,10 +420,10 @@ void _glfwInitJoysticks(void)
|
||||
CFRelease(valueRef);
|
||||
}
|
||||
|
||||
joystick->axes = (float*) calloc(CFArrayGetCount(joystick->axisElements),
|
||||
joystick->axes = calloc(CFArrayGetCount(joystick->axisElements),
|
||||
sizeof(float));
|
||||
joystick->buttons = (unsigned char*) calloc(CFArrayGetCount(joystick->buttonElements) +
|
||||
CFArrayGetCount(joystick->hatElements) * 4, 1);
|
||||
joystick->buttons = calloc(CFArrayGetCount(joystick->buttonElements) +
|
||||
CFArrayGetCount(joystick->hatElements) * 4, 1);
|
||||
|
||||
joy++;
|
||||
if (joy > GLFW_JOYSTICK_LAST)
|
||||
|
||||
+35
-18
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -34,6 +31,9 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
#include <CoreVideo/CVBase.h>
|
||||
#include <CoreVideo/CVDisplayLink.h>
|
||||
|
||||
|
||||
// Get the name of the specified display
|
||||
@@ -49,16 +49,18 @@ static const char* getDisplayName(CGDirectDisplayID displayID)
|
||||
kIODisplayOnlyPreferredName);
|
||||
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
||||
|
||||
if (!CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
||||
(const void**) &value))
|
||||
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
||||
(const void**) &value))
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
|
||||
|
||||
CFRelease(info);
|
||||
return strdup("Unknown");
|
||||
}
|
||||
|
||||
size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(value),
|
||||
kCFStringEncodingUTF8);
|
||||
name = (char*) malloc(size + 1);
|
||||
name = calloc(size + 1, sizeof(char));
|
||||
CFStringGetCString(value, name, size, kCFStringEncodingUTF8);
|
||||
|
||||
CFRelease(info);
|
||||
@@ -77,9 +79,6 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
|
||||
if (flags & kDisplayModeInterlacedFlag)
|
||||
return GL_FALSE;
|
||||
|
||||
if (flags & kDisplayModeTelevisionFlag)
|
||||
return GL_FALSE;
|
||||
|
||||
if (flags & kDisplayModeStretchedFlag)
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -97,13 +96,21 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
|
||||
|
||||
// Convert Core Graphics display mode to GLFW video mode
|
||||
//
|
||||
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
|
||||
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
||||
CVDisplayLinkRef link)
|
||||
{
|
||||
GLFWvidmode result;
|
||||
result.width = CGDisplayModeGetWidth(mode);
|
||||
result.height = CGDisplayModeGetHeight(mode);
|
||||
result.width = (int) CGDisplayModeGetWidth(mode);
|
||||
result.height = (int) CGDisplayModeGetHeight(mode);
|
||||
result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode);
|
||||
|
||||
if (result.refreshRate == 0)
|
||||
{
|
||||
const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
|
||||
if (!(time.flags & kCVTimeIsIndefinite))
|
||||
result.refreshRate = (int) (time.timeScale / (double) time.timeValue);
|
||||
}
|
||||
|
||||
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
||||
|
||||
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
|
||||
@@ -253,8 +260,8 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
|
||||
CGGetActiveDisplayList(0, NULL, &monitorCount);
|
||||
|
||||
displays = (CGDirectDisplayID*) calloc(monitorCount, sizeof(CGDirectDisplayID));
|
||||
monitors = (_GLFWmonitor**) calloc(monitorCount, sizeof(_GLFWmonitor*));
|
||||
displays = calloc(monitorCount, sizeof(CGDirectDisplayID));
|
||||
monitors = calloc(monitorCount, sizeof(_GLFWmonitor*));
|
||||
|
||||
CGGetActiveDisplayList(monitorCount, displays, &monitorCount);
|
||||
|
||||
@@ -337,11 +344,14 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||
CFArrayRef modes;
|
||||
CFIndex count, i;
|
||||
GLFWvidmode* result;
|
||||
CVDisplayLinkRef link;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
|
||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
count = CFArrayGetCount(modes);
|
||||
|
||||
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * count);
|
||||
result = calloc(count, sizeof(GLFWvidmode));
|
||||
*found = 0;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
@@ -351,21 +361,28 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||
mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||
if (modeIsGood(mode))
|
||||
{
|
||||
result[*found] = vidmodeFromCGDisplayMode(mode);
|
||||
result[*found] = vidmodeFromCGDisplayMode(mode, link);
|
||||
(*found)++;
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(modes);
|
||||
|
||||
CVDisplayLinkRelease(link);
|
||||
return result;
|
||||
}
|
||||
|
||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
||||
{
|
||||
CGDisplayModeRef displayMode;
|
||||
CVDisplayLinkRef link;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
|
||||
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||
*mode = vidmodeFromCGDisplayMode(displayMode);
|
||||
*mode = vidmodeFromCGDisplayMode(displayMode, link);
|
||||
CGDisplayModeRelease(displayMode);
|
||||
|
||||
CVDisplayLinkRelease(link);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -108,8 +105,6 @@ typedef struct _GLFWlibraryNS
|
||||
id autoreleasePool;
|
||||
id cursor;
|
||||
|
||||
GLboolean cursorHidden;
|
||||
|
||||
char* clipboardString;
|
||||
|
||||
_GLFWjoy joysticks[GLFW_JOYSTICK_LAST + 1];
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
|
||||
+139
-79
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa/NSOpenGL
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -33,6 +30,25 @@
|
||||
#include <crt_externs.h>
|
||||
|
||||
|
||||
// Center the cursor in the view of the window
|
||||
//
|
||||
static void centerCursor(_GLFWwindow *window)
|
||||
{
|
||||
int width, height;
|
||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
||||
}
|
||||
|
||||
// Update the cursor to match the specified cursor mode
|
||||
//
|
||||
static void setModeCursor(_GLFWwindow* window, int mode)
|
||||
{
|
||||
if (mode == GLFW_CURSOR_NORMAL)
|
||||
[[NSCursor arrowCursor] set];
|
||||
else
|
||||
[(NSCursor*) _glfw.ns.cursor set];
|
||||
}
|
||||
|
||||
// Enter fullscreen mode
|
||||
//
|
||||
static void enterFullscreenMode(_GLFWwindow* window)
|
||||
@@ -42,8 +58,18 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
||||
|
||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||
|
||||
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:NO],
|
||||
NSFullScreenModeAllScreens,
|
||||
nil];
|
||||
|
||||
[window->ns.view enterFullScreenMode:window->monitor->ns.screen
|
||||
withOptions:nil];
|
||||
withOptions:options];
|
||||
|
||||
// HACK: Synthesize focus event as window does not become key when the view
|
||||
// is made full screen
|
||||
// TODO: Remove this when moving to a full screen window
|
||||
_glfwInputWindowFocus(window, GL_TRUE);
|
||||
}
|
||||
|
||||
// Leave fullscreen mode
|
||||
@@ -53,6 +79,11 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
||||
if (![window->ns.view isInFullScreenMode])
|
||||
return;
|
||||
|
||||
// HACK: Synthesize focus event as window does not become key when the view
|
||||
// is made full screen
|
||||
// TODO: Remove this when moving to a full screen window
|
||||
_glfwInputWindowFocus(window, GL_FALSE);
|
||||
|
||||
_glfwRestoreVideoMode(window->monitor);
|
||||
|
||||
// Exit full screen after the video restore to avoid a nasty display
|
||||
@@ -69,6 +100,18 @@ static float transformY(float y)
|
||||
return height - y;
|
||||
}
|
||||
|
||||
// Returns the backing rect of the specified window
|
||||
//
|
||||
static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||
return [window->ns.view convertRectToBacking:contentRect];
|
||||
else
|
||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||
return contentRect;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Delegate for window related notifications
|
||||
@@ -85,13 +128,6 @@ static float transformY(float y)
|
||||
|
||||
@implementation GLFWWindowDelegate
|
||||
|
||||
static void centerCursor(_GLFWwindow *window)
|
||||
{
|
||||
int width, height;
|
||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
||||
}
|
||||
|
||||
- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow
|
||||
{
|
||||
self = [super init];
|
||||
@@ -112,7 +148,7 @@ static void centerCursor(_GLFWwindow *window)
|
||||
[window->nsgl.context update];
|
||||
|
||||
const NSRect contentRect = [window->ns.view frame];
|
||||
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
|
||||
const NSRect fbRect = convertRectToBacking(window, contentRect);
|
||||
|
||||
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
||||
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
|
||||
@@ -150,14 +186,13 @@ static void centerCursor(_GLFWwindow *window)
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
_glfwInputWindowFocus(window, GL_TRUE);
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
centerCursor(window);
|
||||
_glfwPlatformSetCursorMode(window, window->cursorMode);
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
_glfwInputWindowFocus(window, GL_FALSE);
|
||||
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -208,7 +243,7 @@ static void centerCursor(_GLFWwindow *window)
|
||||
|
||||
@end
|
||||
|
||||
// Translates Mac OS X key modifiers into GLFW ones
|
||||
// Translates OS X key modifiers into GLFW ones
|
||||
//
|
||||
static int translateFlags(NSUInteger flags)
|
||||
{
|
||||
@@ -226,12 +261,11 @@ static int translateFlags(NSUInteger flags)
|
||||
return mods;
|
||||
}
|
||||
|
||||
// Translates a Mac OS X keycode to a GLFW keycode
|
||||
// Translates a OS X keycode to a GLFW keycode
|
||||
//
|
||||
static int translateKey(unsigned int key)
|
||||
{
|
||||
// Keyboard symbol translation table
|
||||
// TODO: Need to find mappings for F13-F15, volume down/up/mute, and eject.
|
||||
static const unsigned int table[128] =
|
||||
{
|
||||
/* 00 */ GLFW_KEY_A,
|
||||
@@ -244,7 +278,7 @@ static int translateKey(unsigned int key)
|
||||
/* 07 */ GLFW_KEY_X,
|
||||
/* 08 */ GLFW_KEY_C,
|
||||
/* 09 */ GLFW_KEY_V,
|
||||
/* 0a */ GLFW_KEY_GRAVE_ACCENT,
|
||||
/* 0a */ GLFW_KEY_WORLD_1,
|
||||
/* 0b */ GLFW_KEY_B,
|
||||
/* 0c */ GLFW_KEY_Q,
|
||||
/* 0d */ GLFW_KEY_W,
|
||||
@@ -284,7 +318,7 @@ static int translateKey(unsigned int key)
|
||||
/* 2f */ GLFW_KEY_PERIOD,
|
||||
/* 30 */ GLFW_KEY_TAB,
|
||||
/* 31 */ GLFW_KEY_SPACE,
|
||||
/* 32 */ GLFW_KEY_WORLD_1,
|
||||
/* 32 */ GLFW_KEY_GRAVE_ACCENT,
|
||||
/* 33 */ GLFW_KEY_BACKSPACE,
|
||||
/* 34 */ GLFW_KEY_UNKNOWN,
|
||||
/* 35 */ GLFW_KEY_ESCAPE,
|
||||
@@ -339,7 +373,7 @@ static int translateKey(unsigned int key)
|
||||
/* 66 */ GLFW_KEY_UNKNOWN,
|
||||
/* 67 */ GLFW_KEY_F11,
|
||||
/* 68 */ GLFW_KEY_UNKNOWN,
|
||||
/* 69 */ GLFW_KEY_PRINT_SCREEN,
|
||||
/* 69 */ GLFW_KEY_F13,
|
||||
/* 6a */ GLFW_KEY_F16,
|
||||
/* 6b */ GLFW_KEY_F14,
|
||||
/* 6c */ GLFW_KEY_UNKNOWN,
|
||||
@@ -436,6 +470,11 @@ static int translateKey(unsigned int key)
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)cursorUpdate:(NSEvent *)event
|
||||
{
|
||||
setModeCursor(window, window->cursorMode);
|
||||
}
|
||||
|
||||
- (void)mouseDown:(NSEvent *)event
|
||||
{
|
||||
_glfwInputMouseClick(window,
|
||||
@@ -494,7 +533,7 @@ static int translateKey(unsigned int key)
|
||||
- (void)otherMouseDown:(NSEvent *)event
|
||||
{
|
||||
_glfwInputMouseClick(window,
|
||||
[event buttonNumber],
|
||||
(int) [event buttonNumber],
|
||||
GLFW_PRESS,
|
||||
translateFlags([event modifierFlags]));
|
||||
}
|
||||
@@ -507,7 +546,7 @@ static int translateKey(unsigned int key)
|
||||
- (void)otherMouseUp:(NSEvent *)event
|
||||
{
|
||||
_glfwInputMouseClick(window,
|
||||
[event buttonNumber],
|
||||
(int) [event buttonNumber],
|
||||
GLFW_RELEASE,
|
||||
translateFlags([event modifierFlags]));
|
||||
}
|
||||
@@ -525,7 +564,7 @@ static int translateKey(unsigned int key)
|
||||
- (void)viewDidChangeBackingProperties
|
||||
{
|
||||
const NSRect contentRect = [window->ns.view frame];
|
||||
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
|
||||
const NSRect fbRect = convertRectToBacking(window, contentRect);
|
||||
|
||||
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
||||
}
|
||||
@@ -539,7 +578,8 @@ static int translateKey(unsigned int key)
|
||||
}
|
||||
|
||||
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
|
||||
NSTrackingActiveAlways |
|
||||
NSTrackingActiveInKeyWindow |
|
||||
NSTrackingCursorUpdate |
|
||||
NSTrackingInVisibleRect;
|
||||
|
||||
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
||||
@@ -548,7 +588,7 @@ static int translateKey(unsigned int key)
|
||||
userInfo:nil];
|
||||
|
||||
[self addTrackingArea:trackingArea];
|
||||
[super updateTrackingAreas];
|
||||
[super updateTrackingAreas];
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent *)event
|
||||
@@ -557,9 +597,6 @@ static int translateKey(unsigned int key)
|
||||
const int mods = translateFlags([event modifierFlags]);
|
||||
_glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods);
|
||||
|
||||
if (mods & GLFW_MOD_SUPER)
|
||||
return;
|
||||
|
||||
NSString* characters = [event characters];
|
||||
NSUInteger i, length = [characters length];
|
||||
|
||||
@@ -594,19 +631,31 @@ static int translateKey(unsigned int key)
|
||||
|
||||
- (void)scrollWheel:(NSEvent *)event
|
||||
{
|
||||
double deltaX = [event deltaX];
|
||||
double deltaY = [event deltaY];
|
||||
double deltaX, deltaY;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||
{
|
||||
deltaX = [event scrollingDeltaX];
|
||||
deltaY = [event scrollingDeltaY];
|
||||
|
||||
if ([event hasPreciseScrollingDeltas])
|
||||
{
|
||||
deltaX *= 0.1;
|
||||
deltaY *= 0.1;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||
{
|
||||
deltaX = [event deltaX];
|
||||
deltaY = [event deltaY];
|
||||
}
|
||||
|
||||
if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
|
||||
_glfwInputScroll(window, deltaX, deltaY);
|
||||
}
|
||||
|
||||
- (void)resetCursorRects
|
||||
{
|
||||
[self discardCursorRects];
|
||||
[self addCursorRect:[self bounds] cursor:_glfw.ns.cursor];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -656,7 +705,7 @@ static int translateKey(unsigned int key)
|
||||
//
|
||||
static NSString* findAppName(void)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
|
||||
// Keys to search for as potential application names
|
||||
@@ -678,14 +727,6 @@ static NSString* findAppName(void)
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, the application is unbundled
|
||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
|
||||
// Having the app in front of the terminal window is also generally
|
||||
// handy. There is an NSApplication API to do this, but...
|
||||
SetFrontProcess(&psn);
|
||||
|
||||
char** progname = _NSGetProgname();
|
||||
if (progname && *progname)
|
||||
return [NSString stringWithUTF8String:*progname];
|
||||
@@ -743,7 +784,7 @@ static void createMenuBar(void)
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
|
||||
[windowMenu addItemWithTitle:@"Miniaturize"
|
||||
[windowMenu addItemWithTitle:@"Minimize"
|
||||
action:@selector(performMiniaturize:)
|
||||
keyEquivalent:@"m"];
|
||||
[windowMenu addItemWithTitle:@"Zoom"
|
||||
@@ -754,9 +795,23 @@ static void createMenuBar(void)
|
||||
action:@selector(arrangeInFront:)
|
||||
keyEquivalent:@""];
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||
{
|
||||
// TODO: Make this appear at the bottom of the menu (for consistency)
|
||||
|
||||
[windowMenu addItem:[NSMenuItem separatorItem]];
|
||||
[[windowMenu addItemWithTitle:@"Enter Full Screen"
|
||||
action:@selector(toggleFullScreen:)
|
||||
keyEquivalent:@"f"]
|
||||
setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
|
||||
}
|
||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||
|
||||
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
|
||||
// to get the application menu working properly.
|
||||
[NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu];
|
||||
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
|
||||
[NSApp performSelector:setAppleMenuSelector withObject:appMenu];
|
||||
}
|
||||
|
||||
#endif /* _GLFW_USE_MENUBAR */
|
||||
@@ -771,6 +826,9 @@ static GLboolean initializeAppKit(void)
|
||||
// Implicitly create shared NSApplication instance
|
||||
[GLFWApplication sharedApplication];
|
||||
|
||||
// In case we are unbundled, make us a proper UI application
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
#if defined(_GLFW_USE_MENUBAR)
|
||||
// Menu bar setup must go between sharedApplication above and
|
||||
// finishLaunching below, in order to properly emulate the behavior
|
||||
@@ -815,17 +873,26 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
|
||||
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
|
||||
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||
{
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
if (wndconfig->resizable)
|
||||
[window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
}
|
||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||
|
||||
[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
|
||||
[window->ns.object setContentView:window->ns.view];
|
||||
[window->ns.object setDelegate:window->ns.delegate];
|
||||
[window->ns.object setAcceptsMouseMovedEvents:YES];
|
||||
[window->ns.object disableCursorRects];
|
||||
[window->ns.object center];
|
||||
|
||||
if ([window->ns.object respondsToSelector:@selector(setRestorable:)])
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
|
||||
[window->ns.object setRestorable:NO];
|
||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
@@ -920,8 +987,9 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
||||
|
||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
|
||||
{
|
||||
const NSRect frameRect =
|
||||
[window->ns.object frameRectForContentRect:NSMakeRect(x, y, 0, 0)];
|
||||
const NSRect contentRect = [window->ns.view frame];
|
||||
const NSRect dummyRect = NSMakeRect(x, transformY(y + contentRect.size.height), 0, 0);
|
||||
const NSRect frameRect = [window->ns.object frameRectForContentRect:dummyRect];
|
||||
[window->ns.object setFrameOrigin:frameRect.origin];
|
||||
}
|
||||
|
||||
@@ -942,7 +1010,13 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
|
||||
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
|
||||
{
|
||||
_glfwPlatformGetWindowSize(window, width, height);
|
||||
const NSRect contentRect = [window->ns.view frame];
|
||||
const NSRect fbRect = convertRectToBacking(window, contentRect);
|
||||
|
||||
if (width)
|
||||
*width = (int) fbRect.size.width;
|
||||
if (height)
|
||||
*height = (int) fbRect.size.height;
|
||||
}
|
||||
|
||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||
@@ -960,6 +1034,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||
|
||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||
{
|
||||
// Make us the active application
|
||||
// HACK: This has been moved here from initializeAppKit to prevent
|
||||
// applications using only hidden windows from being activated, but
|
||||
// should probably not be done every time any window is shown
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
[window->ns.object makeKeyAndOrderFront:nil];
|
||||
_glfwInputWindowVisibility(window, GL_TRUE);
|
||||
}
|
||||
@@ -1004,6 +1084,8 @@ void _glfwPlatformWaitEvents(void)
|
||||
|
||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
||||
{
|
||||
setModeCursor(window, window->cursorMode);
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
CGDisplayMoveCursorToPoint(window->monitor->ns.displayID,
|
||||
@@ -1022,37 +1104,15 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
||||
|
||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
||||
{
|
||||
if (mode == GLFW_CURSOR_HIDDEN)
|
||||
{
|
||||
[window->ns.object enableCursorRects];
|
||||
[window->ns.object invalidateCursorRectsForView:window->ns.view];
|
||||
}
|
||||
else
|
||||
{
|
||||
[window->ns.object disableCursorRects];
|
||||
[window->ns.object invalidateCursorRectsForView:window->ns.view];
|
||||
}
|
||||
setModeCursor(window, mode);
|
||||
|
||||
if (mode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
CGAssociateMouseAndMouseCursorPosition(false);
|
||||
|
||||
if (!_glfw.ns.cursorHidden)
|
||||
{
|
||||
[NSCursor hide];
|
||||
_glfw.ns.cursorHidden = GL_TRUE;
|
||||
}
|
||||
centerCursor(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGAssociateMouseAndMouseCursorPosition(true);
|
||||
|
||||
if (_glfw.ns.cursorHidden)
|
||||
{
|
||||
[NSCursor unhide];
|
||||
_glfw.ns.cursorHidden = GL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+32
-18
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -101,7 +98,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
||||
|
||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
||||
{
|
||||
if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0 ||
|
||||
if ((wndconfig->glMajor < 1 || wndconfig->glMinor < 0) ||
|
||||
(wndconfig->glMajor == 1 && wndconfig->glMinor > 5) ||
|
||||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 1) ||
|
||||
(wndconfig->glMajor == 3 && wndconfig->glMinor > 3))
|
||||
@@ -405,8 +402,8 @@ GLboolean _glfwRefreshContextAttribs(void)
|
||||
else if (glfwExtensionSupported("GL_ARB_debug_output"))
|
||||
{
|
||||
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
||||
// not setting the debug bit in the context flags for debug
|
||||
// contexts
|
||||
// not setting the debug bit in the context flags for
|
||||
// debug contexts
|
||||
window->glDebug = GL_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -422,13 +419,21 @@ GLboolean _glfwRefreshContextAttribs(void)
|
||||
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
||||
window->glProfile = GLFW_OPENGL_CORE_PROFILE;
|
||||
else if (glfwExtensionSupported("GL_ARB_compatibility"))
|
||||
{
|
||||
// HACK: This is a workaround for the compatibility profile bit
|
||||
// not being set in the context flags if an OpenGL 3.2+
|
||||
// context was created without having requested a specific
|
||||
// version
|
||||
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||
}
|
||||
}
|
||||
|
||||
// Read back robustness strategy
|
||||
if (glfwExtensionSupported("GL_ARB_robustness"))
|
||||
{
|
||||
// NOTE: We avoid using the context flags for detection, as they are
|
||||
// only present from 3.0 while the extension applies from 1.1
|
||||
// only present from 3.0 while the extension applies from 1.1
|
||||
|
||||
GLint strategy;
|
||||
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
||||
@@ -445,7 +450,7 @@ GLboolean _glfwRefreshContextAttribs(void)
|
||||
if (glfwExtensionSupported("GL_EXT_robustness"))
|
||||
{
|
||||
// NOTE: The values of these constants match those of the OpenGL ARB
|
||||
// one, so we can reuse them here
|
||||
// one, so we can reuse them here
|
||||
|
||||
GLint strategy;
|
||||
glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
|
||||
@@ -569,7 +574,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (extension == NULL || *extension == '\0')
|
||||
if (!extension || *extension == '\0')
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||
return GL_FALSE;
|
||||
@@ -580,11 +585,15 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||
// Check if extension is in the old style OpenGL extensions string
|
||||
|
||||
extensions = glGetString(GL_EXTENSIONS);
|
||||
if (extensions != NULL)
|
||||
if (!extensions)
|
||||
{
|
||||
if (_glfwStringInExtensionString(extension, extensions))
|
||||
return GL_TRUE;
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Failed to retrieve extension string");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (_glfwStringInExtensionString(extension, extensions))
|
||||
return GL_TRUE;
|
||||
}
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
else
|
||||
@@ -598,11 +607,16 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (strcmp((const char*) window->GetStringi(GL_EXTENSIONS, i),
|
||||
extension) == 0)
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
|
||||
if (!en)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Failed to retrieve extension string %i", i);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (strcmp(en, extension) == 0)
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
#endif // _GLFW_USE_OPENGL
|
||||
|
||||
+6
-9
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: EGL
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 EGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -127,10 +124,10 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
nativeConfigs = (EGLConfig*) calloc(nativeCount, sizeof(EGLConfig));
|
||||
nativeConfigs = calloc(nativeCount, sizeof(EGLConfig));
|
||||
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
|
||||
|
||||
usableConfigs = (_GLFWfbconfig*) calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableCount = 0;
|
||||
|
||||
for (i = 0; i < nativeCount; i++)
|
||||
@@ -210,7 +207,7 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
|
||||
//
|
||||
int _glfwInitContextAPI(void)
|
||||
{
|
||||
_glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
|
||||
_glfw.egl.display = eglGetDisplay((EGLNativeDisplayType)_GLFW_EGL_NATIVE_DISPLAY);
|
||||
if (_glfw.egl.display == EGL_NO_DISPLAY)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
@@ -246,7 +243,7 @@ void _glfwTerminateContextAPI(void)
|
||||
{ \
|
||||
attribs[index++] = attribName; \
|
||||
attribs[index++] = attribValue; \
|
||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||
}
|
||||
|
||||
// Prepare for creation of the OpenGL context
|
||||
@@ -464,7 +461,7 @@ void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
||||
{
|
||||
window->egl.surface = eglCreateWindowSurface(_glfw.egl.display,
|
||||
window->egl.config,
|
||||
_GLFW_EGL_NATIVE_WINDOW,
|
||||
(EGLNativeWindowType)_GLFW_EGL_NATIVE_WINDOW,
|
||||
NULL);
|
||||
if (window->egl.surface == EGL_NO_SURFACE)
|
||||
{
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: EGL
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 EGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
|
||||
+12
-17
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -42,15 +39,15 @@
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void _glfwAllocGammaRamp(GLFWgammaramp* ramp, unsigned int size)
|
||||
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
|
||||
{
|
||||
ramp->red = (unsigned short*) malloc(size * sizeof(unsigned short));
|
||||
ramp->green = (unsigned short*) malloc(size * sizeof(unsigned short));
|
||||
ramp->blue = (unsigned short*) malloc(size * sizeof(unsigned short));
|
||||
ramp->red = calloc(size, sizeof(unsigned short));
|
||||
ramp->green = calloc(size, sizeof(unsigned short));
|
||||
ramp->blue = calloc(size, sizeof(unsigned short));
|
||||
ramp->size = size;
|
||||
}
|
||||
|
||||
void _glfwFreeGammaRamp(GLFWgammaramp* ramp)
|
||||
void _glfwFreeGammaArrays(GLFWgammaramp* ramp)
|
||||
{
|
||||
free(ramp->red);
|
||||
free(ramp->green);
|
||||
@@ -81,18 +78,16 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
float value;
|
||||
double value;
|
||||
|
||||
// Calculate intensity
|
||||
value = i / 255.f;
|
||||
value = i / 255.0;
|
||||
// Apply gamma curve
|
||||
value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f;
|
||||
value = pow(value, 1.0 / gamma) * 65535.0 + 0.5;
|
||||
|
||||
// Clamp to value range
|
||||
if (value < 0.f)
|
||||
value = 0.f;
|
||||
else if (value > 65535.f)
|
||||
value = 65535.f;
|
||||
if (value > 65535.0)
|
||||
value = 65535.0;
|
||||
|
||||
values[i] = (unsigned short) value;
|
||||
}
|
||||
@@ -111,7 +106,7 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
_glfwFreeGammaRamp(&monitor->currentRamp);
|
||||
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||
_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp);
|
||||
|
||||
return &monitor->currentRamp;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
libdir=${exec_prefix}/lib@LIB_SUFFIX@
|
||||
|
||||
Name: GLFW
|
||||
Description: A portable library for OpenGL, window and input
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -26,13 +23,15 @@
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// As config.h.in, this file is used by CMake to produce the config.h shared
|
||||
// configuration header file. If you are adding a feature requiring
|
||||
// conditional compilation, this is the proper place to add the macros.
|
||||
// As glfw_config.h.in, this file is used by CMake to produce the
|
||||
// glfw_config.h configuration header file. If you are adding a feature
|
||||
// requiring conditional compilation, this is where to add the macro.
|
||||
//========================================================================
|
||||
// As config.h, this file defines compile-time build options and macros for
|
||||
// all platforms supported by GLFW. As this is a generated file, don't modify
|
||||
// it. Instead, you should modify the config.h.in file.
|
||||
// As glfw_config.h, this file defines compile-time option macros for a
|
||||
// specific platform and development environment. If you are using the
|
||||
// GLFW CMake files, modify glfw_config.h.in instead of this file. If you
|
||||
// are using your own build system, make this file define the appropriate
|
||||
// macros in whatever way is suitable.
|
||||
//========================================================================
|
||||
|
||||
// Define this to 1 if building GLFW for X11
|
||||
@@ -56,6 +55,10 @@
|
||||
|
||||
// Define this to 1 to disable dynamic loading of winmm
|
||||
#cmakedefine _GLFW_NO_DLOAD_WINMM
|
||||
// Define this to 1 if glfwSwapInterval should ignore DWM compositing status
|
||||
#cmakedefine _GLFW_USE_DWM_SWAP_INTERVAL
|
||||
// Define this to 1 to force use of high-performance GPU on Optimus systems
|
||||
#cmakedefine _GLFW_USE_OPTIMUS_HPG
|
||||
|
||||
// Define this to 1 if glXGetProcAddress is available
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
|
||||
@@ -78,6 +81,3 @@
|
||||
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
||||
#cmakedefine _GLFW_USE_GLESV2
|
||||
|
||||
// The GLFW version as used by glfwGetVersionString
|
||||
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"
|
||||
|
||||
+20
-42
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11/GLX
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 GLX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -33,7 +30,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
// This is the only glXGetProcAddress variant not declared by glxext.h
|
||||
@@ -45,14 +41,6 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
||||
#endif
|
||||
|
||||
|
||||
// Error handler used when creating a context
|
||||
//
|
||||
static int errorHandler(Display *display, XErrorEvent* event)
|
||||
{
|
||||
_glfw.glx.errorCode = event->error_code;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns the specified attribute of the specified GLXFBConfig
|
||||
// NOTE: Do not call this unless we have found GLX 1.3+ or GLX_SGIX_fbconfig
|
||||
//
|
||||
@@ -86,7 +74,7 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
||||
if (strcmp(vendor, "Chromium") == 0)
|
||||
{
|
||||
// HACK: This is a (hopefully temporary) workaround for Chromium
|
||||
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
||||
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
||||
trustWindowBit = GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -111,7 +99,7 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
usableConfigs = (_GLFWfbconfig*) calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableCount = 0;
|
||||
|
||||
for (i = 0; i < nativeCount; i++)
|
||||
@@ -191,14 +179,12 @@ static GLXContext createLegacyContext(_GLFWwindow* window,
|
||||
share,
|
||||
True);
|
||||
}
|
||||
else
|
||||
{
|
||||
return glXCreateNewContext(_glfw.x11.display,
|
||||
fbconfig,
|
||||
GLX_RGBA_TYPE,
|
||||
share,
|
||||
True);
|
||||
}
|
||||
|
||||
return glXCreateNewContext(_glfw.x11.display,
|
||||
fbconfig,
|
||||
GLX_RGBA_TYPE,
|
||||
share,
|
||||
True);
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +340,7 @@ void _glfwTerminateContextAPI(void)
|
||||
{ \
|
||||
attribs[index++] = attribName; \
|
||||
attribs[index++] = attribValue; \
|
||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||
}
|
||||
|
||||
// Prepare for creation of the OpenGL context
|
||||
@@ -399,7 +385,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
!_glfw.glx.ARB_create_context_profile ||
|
||||
!_glfw.glx.EXT_create_context_es2_profile)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"GLX: OpenGL ES requested but "
|
||||
"GLX_EXT_create_context_es2_profile is unavailable");
|
||||
return GL_FALSE;
|
||||
@@ -429,8 +415,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
}
|
||||
}
|
||||
|
||||
_glfw.glx.errorCode = Success;
|
||||
XSetErrorHandler(errorHandler);
|
||||
_glfwGrabXErrorHandler();
|
||||
|
||||
if (_glfw.glx.ARB_create_context)
|
||||
{
|
||||
@@ -471,8 +456,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
||||
{
|
||||
// NOTE: Only request an explicitly versioned context when
|
||||
// necessary, as explicitly requesting version 1.0 does not always
|
||||
// return the highest available version
|
||||
// necessary, as explicitly requesting version 1.0 does not
|
||||
// always return the highest available version
|
||||
|
||||
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
|
||||
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
|
||||
@@ -499,9 +484,10 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (window->glx.context == NULL)
|
||||
{
|
||||
// HACK: This is a fallback for the broken Mesa implementation of
|
||||
// GLX_ARB_create_context_profile, which fails default 1.0 context
|
||||
// creation with a GLXBadProfileARB error in violation of the spec
|
||||
if (_glfw.glx.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
||||
// GLX_ARB_create_context_profile, which fails default 1.0
|
||||
// context creation with a GLXBadProfileARB error in violation
|
||||
// of the extension spec
|
||||
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
||||
wndconfig->clientAPI == GLFW_OPENGL_API &&
|
||||
wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE &&
|
||||
wndconfig->glForward == GL_FALSE)
|
||||
@@ -513,19 +499,11 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
else
|
||||
window->glx.context = createLegacyContext(window, native, share);
|
||||
|
||||
XSetErrorHandler(NULL);
|
||||
_glfwReleaseXErrorHandler();
|
||||
|
||||
if (window->glx.context == NULL)
|
||||
{
|
||||
char buffer[8192];
|
||||
XGetErrorText(_glfw.x11.display,
|
||||
_glfw.glx.errorCode,
|
||||
buffer, sizeof(buffer));
|
||||
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"GLX: Failed to create context: %s",
|
||||
buffer);
|
||||
|
||||
_glfwInputXError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+3
-7
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11/GLX
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 GLX - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -44,6 +41,8 @@
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
// We support four different ways for getting addresses for GL/GLX
|
||||
// extension functions: glXGetProcAddress, glXGetProcAddressARB,
|
||||
// glXGetProcAddressEXT, and dlsym
|
||||
@@ -97,9 +96,6 @@ typedef struct _GLFWlibraryGLX
|
||||
// TLS key for per-thread current context/window
|
||||
pthread_key_t current;
|
||||
|
||||
// GLX error code received by Xlib error callback
|
||||
int errorCode;
|
||||
|
||||
// GLX extensions
|
||||
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
|
||||
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
|
||||
|
||||
+6
-8
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -133,7 +130,7 @@ GLFWAPI int glfwInit(void)
|
||||
_glfw.monitors = _glfwPlatformGetMonitors(&_glfw.monitorCount);
|
||||
if (_glfw.monitors == NULL)
|
||||
{
|
||||
_glfwErrorCallback(GLFW_PLATFORM_ERROR, "No monitors found");
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "No monitors found");
|
||||
_glfwPlatformTerminate();
|
||||
return GL_FALSE;
|
||||
}
|
||||
@@ -153,6 +150,8 @@ GLFWAPI void glfwTerminate(void)
|
||||
if (!_glfwInitialized)
|
||||
return;
|
||||
|
||||
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
|
||||
|
||||
// Close all remaining windows
|
||||
while (_glfw.windowListHead)
|
||||
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
|
||||
@@ -192,8 +191,7 @@ GLFWAPI const char* glfwGetVersionString(void)
|
||||
|
||||
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
|
||||
{
|
||||
GLFWerrorfun previous = _glfwErrorCallback;
|
||||
_glfwErrorCallback = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(_glfwErrorCallback, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
|
||||
+24
-50
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -38,7 +35,7 @@
|
||||
//
|
||||
static void setCursorMode(_GLFWwindow* window, int newMode)
|
||||
{
|
||||
int oldMode;
|
||||
const int oldMode = window->cursorMode;
|
||||
|
||||
if (newMode != GLFW_CURSOR_NORMAL &&
|
||||
newMode != GLFW_CURSOR_HIDDEN &&
|
||||
@@ -48,14 +45,20 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
||||
return;
|
||||
}
|
||||
|
||||
oldMode = window->cursorMode;
|
||||
if (oldMode == newMode)
|
||||
return;
|
||||
|
||||
window->cursorMode = newMode;
|
||||
|
||||
if (window == _glfw.focusedWindow)
|
||||
{
|
||||
if (oldMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
window->cursorPosX = _glfw.cursorPosX;
|
||||
window->cursorPosY = _glfw.cursorPosY;
|
||||
|
||||
_glfwPlatformSetCursorPos(window, _glfw.cursorPosX, _glfw.cursorPosY);
|
||||
}
|
||||
else if (newMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
int width, height;
|
||||
@@ -69,8 +72,6 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
||||
|
||||
_glfwPlatformSetCursorMode(window, newMode);
|
||||
}
|
||||
|
||||
window->cursorMode = newMode;
|
||||
}
|
||||
|
||||
// Set sticky keys mode for the specified window
|
||||
@@ -147,16 +148,13 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
||||
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
|
||||
}
|
||||
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int character)
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint)
|
||||
{
|
||||
if (character == -1)
|
||||
return;
|
||||
|
||||
if (character < 32 || (character > 126 && character < 160))
|
||||
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
|
||||
return;
|
||||
|
||||
if (window->callbacks.character)
|
||||
window->callbacks.character((GLFWwindow*) window, character);
|
||||
window->callbacks.character((GLFWwindow*) window, codepoint);
|
||||
}
|
||||
|
||||
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
|
||||
@@ -347,76 +345,52 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
|
||||
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWkeyfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.key;
|
||||
window->callbacks.key = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWcharfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.character;
|
||||
window->callbacks.character = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
|
||||
GLFWmousebuttonfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWmousebuttonfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.mouseButton;
|
||||
window->callbacks.mouseButton = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
|
||||
GLFWcursorposfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWcursorposfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.cursorPos;
|
||||
window->callbacks.cursorPos = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
|
||||
GLFWcursorenterfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWcursorenterfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.cursorEnter;
|
||||
window->callbacks.cursorEnter = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
||||
GLFWscrollfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWscrollfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.scroll;
|
||||
window->callbacks.scroll = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
|
||||
+32
-12
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -32,7 +29,11 @@
|
||||
#define _internal_h_
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#if defined(_GLFW_USE_CONFIG_H)
|
||||
#include "glfw_config.h"
|
||||
#endif
|
||||
|
||||
#define _GLFW_VERSION_NUMBER "3.0.4"
|
||||
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
// This is the default for glfw3.h
|
||||
@@ -120,6 +121,15 @@ typedef struct _GLFWmonitor _GLFWmonitor;
|
||||
return x; \
|
||||
}
|
||||
|
||||
// Swaps the provided pointers
|
||||
#define _GLFW_SWAP_POINTERS(x, y) \
|
||||
{ \
|
||||
void* t; \
|
||||
t = x; \
|
||||
x = y; \
|
||||
y = t; \
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Internal types
|
||||
@@ -298,7 +308,10 @@ struct _GLFWlibrary
|
||||
|
||||
_GLFWmonitor** monitors;
|
||||
int monitorCount;
|
||||
GLFWmonitorfun monitorCallback;
|
||||
|
||||
struct {
|
||||
GLFWmonitorfun monitor;
|
||||
} callbacks;
|
||||
|
||||
// This is defined in the window API's platform.h
|
||||
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
|
||||
@@ -615,10 +628,10 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
|
||||
|
||||
/*! @brief Notifies shared code of a Unicode character input event.
|
||||
* @param[in] window The window that received the event.
|
||||
* @param[in] character The Unicode code point of the input character.
|
||||
* @param[in] codepoint The Unicode code point of the input character.
|
||||
* @ingroup event
|
||||
*/
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int character);
|
||||
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint);
|
||||
|
||||
/*! @brief Notifies shared code of a scroll event.
|
||||
* @param[in] window The window that received the event.
|
||||
@@ -735,17 +748,24 @@ GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig);
|
||||
|
||||
/*! @ingroup utility
|
||||
*/
|
||||
void _glfwAllocGammaRamp(GLFWgammaramp* ramp, unsigned int size);
|
||||
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
|
||||
|
||||
/*! @ingroup utility
|
||||
*/
|
||||
void _glfwFreeGammaRamp(GLFWgammaramp* ramp);
|
||||
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
|
||||
|
||||
/*! @ingroup utility
|
||||
/*! @brief Allocates and returns a monitor object with the specified name
|
||||
* and dimensions.
|
||||
* @param[in] name The name of the monitor.
|
||||
* @param[in] widthMM The width, in mm, of the monitor's display area.
|
||||
* @param[in] heightMM The height, in mm, of the monitor's display area.
|
||||
* @return The newly created object.
|
||||
* @ingroup utility
|
||||
*/
|
||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM);
|
||||
|
||||
/*! @ingroup utility
|
||||
/*! @brief Frees a monitor object and any data associated with it.
|
||||
* @ingroup utility
|
||||
*/
|
||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor);
|
||||
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
|
||||
+10
-16
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL framework
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -144,8 +141,8 @@ void _glfwInputMonitorChange(void)
|
||||
window->monitor = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.monitorCallback)
|
||||
_glfw.monitorCallback((GLFWmonitor*) monitors[i], GLFW_DISCONNECTED);
|
||||
if (_glfw.callbacks.monitor)
|
||||
_glfw.callbacks.monitor((GLFWmonitor*) monitors[i], GLFW_DISCONNECTED);
|
||||
}
|
||||
|
||||
// Find and report newly connected monitors (not in the old list)
|
||||
@@ -166,8 +163,8 @@ void _glfwInputMonitorChange(void)
|
||||
if (j < monitorCount)
|
||||
continue;
|
||||
|
||||
if (_glfw.monitorCallback)
|
||||
_glfw.monitorCallback((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||
if (_glfw.callbacks.monitor)
|
||||
_glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||
}
|
||||
|
||||
_glfwDestroyMonitors(monitors, monitorCount);
|
||||
@@ -180,7 +177,7 @@ void _glfwInputMonitorChange(void)
|
||||
|
||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
|
||||
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
|
||||
monitor->name = strdup(name);
|
||||
monitor->widthMM = widthMM;
|
||||
monitor->heightMM = heightMM;
|
||||
@@ -193,8 +190,8 @@ void _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
||||
if (monitor == NULL)
|
||||
return;
|
||||
|
||||
_glfwFreeGammaRamp(&monitor->originalRamp);
|
||||
_glfwFreeGammaRamp(&monitor->currentRamp);
|
||||
_glfwFreeGammaArrays(&monitor->originalRamp);
|
||||
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||
|
||||
free(monitor->modes);
|
||||
free(monitor->name);
|
||||
@@ -328,12 +325,9 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
||||
|
||||
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
||||
{
|
||||
GLFWmonitorfun previous;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = _glfw.monitorCallback;
|
||||
_glfw.monitorCallback = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(_glfw.callbacks.monitor, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
||||
|
||||
+18
-23
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Cocoa/NSOpenGL
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -43,7 +40,7 @@ int _glfwInitContextAPI(void)
|
||||
if (pthread_key_create(&_glfw.nsgl.current, NULL) != 0)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"NSOpenGL: Failed to create context TLS");
|
||||
"NSGL: Failed to create context TLS");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -74,7 +71,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
{
|
||||
unsigned int attributeCount = 0;
|
||||
|
||||
// Mac OS X needs non-zero color size, so set resonable values
|
||||
// OS X needs non-zero color size, so set resonable values
|
||||
int colorBits = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits;
|
||||
if (colorBits == 0)
|
||||
colorBits = 24;
|
||||
@@ -84,18 +81,16 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSOpenGL: This API does not support OpenGL ES");
|
||||
"NSGL: This API does not support OpenGL ES");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||
// Fail if any OpenGL version above 2.1 other than 3.2 was requested
|
||||
if (wndconfig->glMajor > 3 ||
|
||||
(wndconfig->glMajor == 3 && wndconfig->glMinor != 2))
|
||||
if (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSOpenGL: The targeted version of Mac OS X does not "
|
||||
"support any OpenGL version above 2.1 except 3.2");
|
||||
"NSGL: The targeted version of OS X does not "
|
||||
"support OpenGL 3.0 or 3.1");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -104,18 +99,18 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (!wndconfig->glForward)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSOpenGL: The targeted version of Mac OS X only "
|
||||
"supports OpenGL 3.2 contexts if they are "
|
||||
"forward-compatible");
|
||||
"NSGL: The targeted version of OS X only "
|
||||
"supports OpenGL 3.2 and later versions if they "
|
||||
"are forward-compatible");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSOpenGL: The targeted version of Mac OS X only "
|
||||
"supports OpenGL 3.2 contexts if they use the "
|
||||
"core profile");
|
||||
"NSGL: The targeted version of OS X only "
|
||||
"supports OpenGL 3.2 and later versions if they "
|
||||
"use the core profile");
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +119,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (wndconfig->glMajor > 2)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSOpenGL: The targeted version of Mac OS X does not "
|
||||
"NSGL: The targeted version of OS X does not "
|
||||
"support OpenGL version 3.0 or above");
|
||||
return GL_FALSE;
|
||||
}
|
||||
@@ -134,7 +129,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (wndconfig->glRobustness)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
"NSOpenGL: Mac OS X does not support OpenGL robustness "
|
||||
"NSGL: OS X does not support OpenGL robustness "
|
||||
"strategies");
|
||||
return GL_FALSE;
|
||||
}
|
||||
@@ -183,7 +178,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
}
|
||||
|
||||
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
|
||||
// frambuffer, so there's no need (and no way) to request it
|
||||
// frambuffer, so there's no need (and no way) to request it
|
||||
|
||||
ADD_ATTR(0);
|
||||
|
||||
@@ -195,7 +190,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (window->nsgl.pixelFormat == nil)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"NSOpenGL: Failed to create OpenGL pixel format");
|
||||
"NSGL: Failed to create OpenGL pixel format");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -210,7 +205,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
if (window->nsgl.context == nil)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"NSOpenGL: Failed to create OpenGL context");
|
||||
"NSGL: Failed to create OpenGL context");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: NSOpenGL
|
||||
// API Version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 OS X - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
|
||||
+41
-16
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32/WGL
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 WGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -172,7 +169,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
usableConfigs = (_GLFWfbconfig*) calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||
usableCount = 0;
|
||||
|
||||
for (i = 0; i < nativeCount; i++)
|
||||
@@ -275,10 +272,26 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
||||
usableCount++;
|
||||
}
|
||||
|
||||
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
||||
if (closest)
|
||||
*result = closest->wgl;
|
||||
if (!usableCount)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"WGL: The driver does not appear to support OpenGL");
|
||||
|
||||
free(usableConfigs);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
||||
if (!closest)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to find a suitable pixel format");
|
||||
|
||||
free(usableConfigs);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
*result = closest->wgl;
|
||||
free(usableConfigs);
|
||||
|
||||
return GL_TRUE;
|
||||
@@ -293,6 +306,13 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
||||
//
|
||||
int _glfwInitContextAPI(void)
|
||||
{
|
||||
_glfw.wgl.opengl32.instance = LoadLibrary(L"opengl32.dll");
|
||||
if (!_glfw.wgl.opengl32.instance)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to load opengl32.dll");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
_glfw.wgl.current = TlsAlloc();
|
||||
if (_glfw.wgl.current == TLS_OUT_OF_INDEXES)
|
||||
{
|
||||
@@ -312,13 +332,16 @@ void _glfwTerminateContextAPI(void)
|
||||
{
|
||||
if (_glfw.wgl.hasTLS)
|
||||
TlsFree(_glfw.wgl.current);
|
||||
|
||||
if (_glfw.wgl.opengl32.instance)
|
||||
FreeLibrary(_glfw.wgl.opengl32.instance);
|
||||
}
|
||||
|
||||
#define setWGLattrib(attribName, attribValue) \
|
||||
{ \
|
||||
attribs[index++] = attribName; \
|
||||
attribs[index++] = attribValue; \
|
||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||
}
|
||||
|
||||
// Prepare for creation of the OpenGL context
|
||||
@@ -344,11 +367,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
}
|
||||
|
||||
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to find a suitable pixel format");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
||||
{
|
||||
@@ -518,7 +537,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||
!window->wgl.ARB_create_context_profile ||
|
||||
!window->wgl.EXT_create_context_es2_profile)
|
||||
{
|
||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"WGL: OpenGL ES requested but "
|
||||
"WGL_ARB_create_context_es2_profile is unavailable");
|
||||
return _GLFW_RECREATION_IMPOSSIBLE;
|
||||
@@ -586,12 +605,14 @@ void _glfwPlatformSwapInterval(int interval)
|
||||
{
|
||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||
|
||||
if (_glfwIsCompositionEnabled())
|
||||
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
|
||||
if (_glfwIsCompositionEnabled() && interval)
|
||||
{
|
||||
// Don't enabled vsync when desktop compositing is enabled, as it leads
|
||||
// to frame jitter
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (window->wgl.EXT_swap_control)
|
||||
window->wgl.SwapIntervalEXT(interval);
|
||||
@@ -628,7 +649,11 @@ int _glfwPlatformExtensionSupported(const char* extension)
|
||||
|
||||
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
|
||||
{
|
||||
return (GLFWglproc) wglGetProcAddress(procname);
|
||||
const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname);
|
||||
if (proc)
|
||||
return proc;
|
||||
|
||||
return (GLFWglproc) GetProcAddress(_glfw.wgl.opengl32.instance, procname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-6
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: WGL
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 WGL - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -77,8 +74,13 @@ typedef struct _GLFWcontextWGL
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryWGL
|
||||
{
|
||||
GLboolean hasTLS;
|
||||
DWORD current;
|
||||
GLboolean hasTLS;
|
||||
DWORD current;
|
||||
|
||||
// opengl32.dll
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
} opengl32;
|
||||
|
||||
} _GLFWlibraryWGL;
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
|
||||
+2
-5
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -50,7 +47,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
GetDeviceGammaRamp(dc, values);
|
||||
DeleteDC(dc);
|
||||
|
||||
_glfwAllocGammaRamp(ramp, 256);
|
||||
_glfwAllocGammaArrays(ramp, 256);
|
||||
|
||||
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
||||
|
||||
+28
-17
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32/WGL
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -39,6 +36,15 @@
|
||||
#endif // __BORLANDC__
|
||||
|
||||
|
||||
#if defined(_GLFW_USE_OPTIMUS_HPG)
|
||||
|
||||
// Applications exporting this symbol with this value will be automatically
|
||||
// directed to the high-performance GPU on nVidia Optimus systems
|
||||
//
|
||||
GLFWAPI DWORD NvOptimusEnablement = 0x00000001;
|
||||
|
||||
#endif // _GLFW_USE_OPTIMUS_HPG
|
||||
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
|
||||
// GLFW DLL entry point
|
||||
@@ -98,7 +104,7 @@ static GLboolean initLibraries(void)
|
||||
|
||||
// Unload used libraries (DLLs)
|
||||
//
|
||||
static void freeLibraries(void)
|
||||
static void terminateLibraries(void)
|
||||
{
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
if (_glfw.win32.winmm.instance != NULL)
|
||||
@@ -107,6 +113,12 @@ static void freeLibraries(void)
|
||||
_glfw.win32.winmm.instance = NULL;
|
||||
}
|
||||
#endif // _GLFW_NO_DLOAD_WINMM
|
||||
|
||||
if (_glfw.win32.user32.instance)
|
||||
FreeLibrary(_glfw.win32.user32.instance);
|
||||
|
||||
if (_glfw.win32.dwmapi.instance)
|
||||
FreeLibrary(_glfw.win32.dwmapi.instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +152,7 @@ WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
|
||||
if (!length)
|
||||
return NULL;
|
||||
|
||||
target = (WCHAR*) malloc(sizeof(WCHAR) * (length + 1));
|
||||
target = calloc(length + 1, sizeof(WCHAR));
|
||||
|
||||
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, length + 1))
|
||||
{
|
||||
@@ -162,7 +174,7 @@ char* _glfwCreateUTF8FromWideString(const WCHAR* source)
|
||||
if (!length)
|
||||
return NULL;
|
||||
|
||||
target = (char*) malloc(length + 1);
|
||||
target = calloc(length + 1, sizeof(char));
|
||||
|
||||
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, length + 1, NULL, NULL))
|
||||
{
|
||||
@@ -204,7 +216,6 @@ int _glfwPlatformInit(void)
|
||||
return GL_FALSE;
|
||||
|
||||
_glfwInitTimer();
|
||||
|
||||
_glfwInitJoysticks();
|
||||
|
||||
return GL_TRUE;
|
||||
@@ -218,21 +229,21 @@ void _glfwPlatformTerminate(void)
|
||||
_glfw.win32.classAtom = 0;
|
||||
}
|
||||
|
||||
_glfwTerminateContextAPI();
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
|
||||
freeLibraries();
|
||||
|
||||
// Restore previous FOREGROUNDLOCKTIMEOUT system setting
|
||||
// Restore previous foreground lock timeout system setting
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
UIntToPtr(_glfw.win32.foregroundLockTimeout),
|
||||
SPIF_SENDCHANGE);
|
||||
|
||||
free(_glfw.win32.clipboardString);
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
_glfwTerminateContextAPI();
|
||||
terminateLibraries();
|
||||
}
|
||||
|
||||
const char* _glfwPlatformGetVersionString(void)
|
||||
{
|
||||
const char* version = _GLFW_VERSION_FULL " Win32"
|
||||
const char* version = _GLFW_VERSION_NUMBER " Win32"
|
||||
#if defined(_GLFW_WGL)
|
||||
" WGL"
|
||||
#elif defined(_GLFW_EGL)
|
||||
@@ -241,7 +252,7 @@ const char* _glfwPlatformGetVersionString(void)
|
||||
#if defined(__MINGW32__)
|
||||
" MinGW"
|
||||
#elif defined(_MSC_VER)
|
||||
" VisualC "
|
||||
" VisualC"
|
||||
#elif defined(__BORLANDC__)
|
||||
" BorlandC"
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -100,7 +97,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
||||
return NULL;
|
||||
|
||||
axes[(*count)++] = calcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax);
|
||||
axes[(*count)++] = -calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
|
||||
axes[(*count)++] = calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
|
||||
|
||||
if (jc.wCaps & JOYCAPS_HASZ)
|
||||
axes[(*count)++] = calcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax);
|
||||
@@ -112,7 +109,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
||||
axes[(*count)++] = calcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax);
|
||||
|
||||
if (jc.wCaps & JOYCAPS_HASV)
|
||||
axes[(*count)++] = -calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
|
||||
axes[(*count)++] = calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
|
||||
|
||||
return axes;
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11 (Unix)
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
|
||||
+10
-9
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -55,10 +52,15 @@
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
// GLFW requires Windows XP
|
||||
#ifndef WINVER
|
||||
// GLFW requires Windows XP or later
|
||||
#if WINVER < 0x0501
|
||||
#undef WINVER
|
||||
#define WINVER 0x0501
|
||||
#endif
|
||||
#if _WIN32_WINNT < 0x0501
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
@@ -155,7 +157,7 @@ typedef struct _GLFWwindowWin32
|
||||
GLboolean cursorCentered;
|
||||
GLboolean cursorInside;
|
||||
GLboolean cursorHidden;
|
||||
double oldCursorX, oldCursorY;
|
||||
int oldCursorX, oldCursorY;
|
||||
} _GLFWwindowWin32;
|
||||
|
||||
|
||||
@@ -172,8 +174,7 @@ typedef struct _GLFWlibraryWin32
|
||||
struct {
|
||||
GLboolean hasPC;
|
||||
double resolution;
|
||||
unsigned int t0_32;
|
||||
__int64 t0_64;
|
||||
unsigned __int64 base;
|
||||
} timer;
|
||||
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
|
||||
+26
-31
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -31,6 +28,21 @@
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
// Return raw time
|
||||
//
|
||||
static unsigned __int64 getRawTime(void)
|
||||
{
|
||||
if (_glfw.win32.timer.hasPC)
|
||||
{
|
||||
unsigned __int64 time;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*) &time);
|
||||
return time;
|
||||
}
|
||||
else
|
||||
return (unsigned __int64) _glfw_timeGetTime();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -39,20 +51,20 @@
|
||||
//
|
||||
void _glfwInitTimer(void)
|
||||
{
|
||||
__int64 freq;
|
||||
unsigned __int64 frequency;
|
||||
|
||||
if (QueryPerformanceFrequency((LARGE_INTEGER*) &freq))
|
||||
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
|
||||
{
|
||||
_glfw.win32.timer.hasPC = GL_TRUE;
|
||||
_glfw.win32.timer.resolution = 1.0 / (double) freq;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*) &_glfw.win32.timer.t0_64);
|
||||
_glfw.win32.timer.resolution = 1.0 / (double) frequency;
|
||||
}
|
||||
else
|
||||
{
|
||||
_glfw.win32.timer.hasPC = GL_FALSE;
|
||||
_glfw.win32.timer.resolution = 0.001; // winmm resolution is 1 ms
|
||||
_glfw.win32.timer.t0_32 = _glfw_timeGetTime();
|
||||
}
|
||||
|
||||
_glfw.win32.timer.base = getRawTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,30 +74,13 @@ void _glfwInitTimer(void)
|
||||
|
||||
double _glfwPlatformGetTime(void)
|
||||
{
|
||||
double t;
|
||||
__int64 t_64;
|
||||
|
||||
if (_glfw.win32.timer.hasPC)
|
||||
{
|
||||
QueryPerformanceCounter((LARGE_INTEGER*) &t_64);
|
||||
t = (double)(t_64 - _glfw.win32.timer.t0_64);
|
||||
}
|
||||
else
|
||||
t = (double)(_glfw_timeGetTime() - _glfw.win32.timer.t0_32);
|
||||
|
||||
return t * _glfw.win32.timer.resolution;
|
||||
return (double) (getRawTime() - _glfw.win32.timer.base) *
|
||||
_glfw.win32.timer.resolution;
|
||||
}
|
||||
|
||||
void _glfwPlatformSetTime(double t)
|
||||
void _glfwPlatformSetTime(double time)
|
||||
{
|
||||
__int64 t_64;
|
||||
|
||||
if (_glfw.win32.timer.hasPC)
|
||||
{
|
||||
QueryPerformanceCounter((LARGE_INTEGER*) &t_64);
|
||||
_glfw.win32.timer.t0_64 = t_64 - (__int64) (t / _glfw.win32.timer.resolution);
|
||||
}
|
||||
else
|
||||
_glfw.win32.timer.t0_32 = _glfw_timeGetTime() - (int)(t * 1000.0);
|
||||
_glfw.win32.timer.base = getRawTime() -
|
||||
(unsigned __int64) (time / _glfw.win32.timer.resolution);
|
||||
}
|
||||
|
||||
|
||||
+51
-19
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Win32/WGL
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 Win32 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -148,7 +145,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Check for numeric keypad keys
|
||||
// NOTE: This way we always force "NumLock = ON", which is intentional since
|
||||
// the returned key code should correspond to a physical location.
|
||||
// the returned key code should correspond to a physical location.
|
||||
if ((HIWORD(lParam) & 0x100) == 0)
|
||||
{
|
||||
switch (MapVirtualKey(HIWORD(lParam) & 0xFF, 1))
|
||||
@@ -391,10 +388,21 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
|
||||
if (focused && iconified)
|
||||
{
|
||||
// This is a workaround for window iconification using the
|
||||
// taskbar leading to windows being told they're focused and
|
||||
// iconified and then never told they're defocused
|
||||
focused = FALSE;
|
||||
if (window->iconified && _glfw.focusedWindow != window)
|
||||
{
|
||||
// This is a workaround for window restoration using the
|
||||
// Win+D hot key leading to windows being told they're
|
||||
// focused and iconified and then never told they're
|
||||
// restored
|
||||
iconified = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a workaround for window iconification using the
|
||||
// taskbar leading to windows being told they're focused and
|
||||
// iconified and then never told they're defocused
|
||||
focused = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!focused && _glfw.focusedWindow == window)
|
||||
@@ -434,6 +442,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_ACTIVATEAPP:
|
||||
{
|
||||
if (!wParam && IsIconic(hWnd))
|
||||
{
|
||||
// This is a workaround for full screen windows losing focus
|
||||
// through Alt+Tab leading to windows being told they're
|
||||
// unfocused and restored and then never told they're iconified
|
||||
_glfwInputWindowIconify(window, GL_TRUE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
{
|
||||
_glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE);
|
||||
@@ -483,6 +504,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
}
|
||||
|
||||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
{
|
||||
_glfwInputChar(window, (unsigned int) wParam);
|
||||
return 0;
|
||||
@@ -595,7 +617,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
if (newCursorX != window->win32.oldCursorX ||
|
||||
newCursorY != window->win32.oldCursorY)
|
||||
{
|
||||
double x, y;
|
||||
int x, y;
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
@@ -656,8 +678,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
||||
_glfw.focusedWindow == window)
|
||||
{
|
||||
updateClipRect(window);
|
||||
}
|
||||
|
||||
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
|
||||
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
|
||||
@@ -666,10 +691,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
|
||||
case WM_MOVE:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
||||
_glfw.focusedWindow == window)
|
||||
{
|
||||
updateClipRect(window);
|
||||
}
|
||||
|
||||
_glfwInputWindowPos(window, LOWORD(lParam), HIWORD(lParam));
|
||||
// NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as
|
||||
// those macros do not handle negative window positions correctly
|
||||
_glfwInputWindowPos(window,
|
||||
GET_X_LPARAM(lParam),
|
||||
GET_Y_LPARAM(lParam));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -681,8 +713,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN &&
|
||||
window->win32.handle == GetForegroundWindow() &&
|
||||
if (window->cursorMode != GLFW_CURSOR_NORMAL &&
|
||||
_glfw.focusedWindow == window &&
|
||||
LOWORD(lParam) == HTCLIENT)
|
||||
{
|
||||
SetCursor(NULL);
|
||||
@@ -904,7 +936,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
||||
|
||||
// First we clear the current context (the one we just created)
|
||||
// This is usually done by glfwDestroyWindow, but as we're not doing
|
||||
// full window destruction, it's duplicated here
|
||||
// full GLFW window destruction, it's duplicated here
|
||||
_glfwPlatformMakeContextCurrent(NULL);
|
||||
|
||||
// Next destroy the Win32 window and WGL context (without resetting or
|
||||
@@ -1002,7 +1034,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
|
||||
SetWindowPos(window->win32.handle, HWND_TOP,
|
||||
0, 0, fullWidth, fullHeight,
|
||||
SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
|
||||
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1106,8 +1138,8 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
||||
ClientToScreen(window->win32.handle, &pos);
|
||||
SetCursorPos(pos.x, pos.y);
|
||||
|
||||
window->win32.oldCursorX = xpos;
|
||||
window->win32.oldCursorY = ypos;
|
||||
window->win32.oldCursorX = (int) xpos;
|
||||
window->win32.oldCursorY = (int) ypos;
|
||||
}
|
||||
|
||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
||||
|
||||
+27
-60
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: Any
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -132,7 +129,7 @@ void _glfwInputWindowDamage(_GLFWwindow* window)
|
||||
|
||||
void _glfwInputWindowCloseRequest(_GLFWwindow* window)
|
||||
{
|
||||
window->closed = GL_TRUE;
|
||||
window->closed = GL_TRUE;
|
||||
|
||||
if (window->callbacks.close)
|
||||
window->callbacks.close((GLFWwindow*) window);
|
||||
@@ -158,7 +155,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
if (width <= 0 || height <= 0)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
||||
return GL_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Set up desired framebuffer config
|
||||
@@ -196,9 +193,9 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
|
||||
// Check the OpenGL bits of the window config
|
||||
if (!_glfwIsValidContextConfig(&wndconfig))
|
||||
return GL_FALSE;
|
||||
return NULL;
|
||||
|
||||
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
||||
window = calloc(1, sizeof(_GLFWwindow));
|
||||
window->next = _glfw.windowListHead;
|
||||
_glfw.windowListHead = window;
|
||||
|
||||
@@ -216,10 +213,10 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
window->videoMode.refreshRate = Max(_glfw.hints.refreshRate, 0);
|
||||
}
|
||||
|
||||
window->monitor = wndconfig.monitor;
|
||||
window->resizable = wndconfig.resizable;
|
||||
window->decorated = wndconfig.decorated;
|
||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||
window->monitor = wndconfig.monitor;
|
||||
window->resizable = wndconfig.resizable;
|
||||
window->decorated = wndconfig.decorated;
|
||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||
|
||||
// Save the currently current context so it can be restored later
|
||||
previous = (_GLFWwindow*) glfwGetCurrentContext();
|
||||
@@ -229,7 +226,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
{
|
||||
glfwDestroyWindow((GLFWwindow*) window);
|
||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||
return GL_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent((GLFWwindow*) window);
|
||||
@@ -239,7 +236,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
{
|
||||
glfwDestroyWindow((GLFWwindow*) window);
|
||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||
return GL_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Verify the context against the requested parameters
|
||||
@@ -247,7 +244,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
{
|
||||
glfwDestroyWindow((GLFWwindow*) window);
|
||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||
return GL_FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Clearing the front buffer to black to avoid garbage pixels left over
|
||||
@@ -284,6 +281,7 @@ void glfwDefaultWindowHints(void)
|
||||
_glfw.hints.redBits = 8;
|
||||
_glfw.hints.greenBits = 8;
|
||||
_glfw.hints.blueBits = 8;
|
||||
_glfw.hints.alphaBits = 8;
|
||||
_glfw.hints.depthBits = 24;
|
||||
_glfw.hints.stencilBits = 8;
|
||||
}
|
||||
@@ -470,10 +468,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (window->iconified)
|
||||
{
|
||||
// TODO: Figure out if this is an error
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
@@ -606,91 +601,63 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
|
||||
GLFWwindowposfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWwindowposfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.pos;
|
||||
window->callbacks.pos = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.pos, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
|
||||
GLFWwindowsizefun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWwindowsizefun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.size;
|
||||
window->callbacks.size = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.size, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
|
||||
GLFWwindowclosefun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWwindowclosefun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.close;
|
||||
window->callbacks.close = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.close, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle,
|
||||
GLFWwindowrefreshfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWwindowrefreshfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.refresh;
|
||||
window->callbacks.refresh = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.refresh, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
|
||||
GLFWwindowfocusfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWwindowfocusfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.focus;
|
||||
window->callbacks.focus = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.focus, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
|
||||
GLFWwindowiconifyfun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWwindowiconifyfun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.iconify;
|
||||
window->callbacks.iconify = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.iconify, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle,
|
||||
GLFWframebuffersizefun cbfun)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
GLFWframebuffersizefun previous;
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
previous = window->callbacks.fbsize;
|
||||
window->callbacks.fbsize = cbfun;
|
||||
return previous;
|
||||
_GLFW_SWAP_POINTERS(window->callbacks.fbsize, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
GLFWAPI void glfwPollEvents(void)
|
||||
|
||||
+3
-6
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -273,11 +270,11 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||
|
||||
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
const Atom formats[] = { _glfw.x11.UTF8_STRING,
|
||||
_glfw.x11.COMPOUND_STRING,
|
||||
XA_STRING };
|
||||
const int formatCount = sizeof(formats) / sizeof(formats[0]);
|
||||
const size_t formatCount = sizeof(formats) / sizeof(formats[0]);
|
||||
|
||||
if (_glfwFindWindowByHandle(XGetSelectionOwner(_glfw.x11.display,
|
||||
_glfw.x11.CLIPBOARD)))
|
||||
|
||||
+3
-6
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
//
|
||||
@@ -79,7 +76,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
XRRCrtcGamma* gamma = XRRGetCrtcGamma(_glfw.x11.display,
|
||||
monitor->x11.crtc);
|
||||
|
||||
_glfwAllocGammaRamp(ramp, size);
|
||||
_glfwAllocGammaArrays(ramp, size);
|
||||
|
||||
memcpy(ramp->red, gamma->red, size * sizeof(unsigned short));
|
||||
memcpy(ramp->green, gamma->green, size * sizeof(unsigned short));
|
||||
@@ -92,7 +89,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
int size;
|
||||
XF86VidModeGetGammaRampSize(_glfw.x11.display, _glfw.x11.screen, &size);
|
||||
|
||||
_glfwAllocGammaRamp(ramp, size);
|
||||
_glfwAllocGammaArrays(ramp, size);
|
||||
|
||||
XF86VidModeGetGammaRamp(_glfw.x11.display,
|
||||
_glfw.x11.screen,
|
||||
|
||||
+70
-28
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11/GLX
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -51,7 +48,7 @@ static int translateKey(int keyCode)
|
||||
// Note: This way we always force "NumLock = ON", which is intentional
|
||||
// since the returned key code should correspond to a physical
|
||||
// location.
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, keyCode, 1, 0);
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, keyCode, 0, 1);
|
||||
switch (keySym)
|
||||
{
|
||||
case XK_KP_0: return GLFW_KEY_KP_0;
|
||||
@@ -412,6 +409,8 @@ static void detectEWMH(void)
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING");
|
||||
_glfw.x11.NET_ACTIVE_WINDOW =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
||||
_glfw.x11.NET_WM_BYPASS_COMPOSITOR =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_BYPASS_COMPOSITOR");
|
||||
|
||||
XFree(supportedAtoms);
|
||||
|
||||
@@ -420,21 +419,10 @@ static void detectEWMH(void)
|
||||
|
||||
// Initialize X11 display and look for supported X11 extensions
|
||||
//
|
||||
static GLboolean initDisplay(void)
|
||||
static GLboolean initExtensions(void)
|
||||
{
|
||||
Bool supported;
|
||||
|
||||
_glfw.x11.display = XOpenDisplay(NULL);
|
||||
if (!_glfw.x11.display)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
|
||||
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
||||
_glfw.x11.context = XUniqueContext();
|
||||
|
||||
// Find or create window manager atoms
|
||||
_glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False);
|
||||
_glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display,
|
||||
@@ -564,7 +552,7 @@ static Cursor createNULLCursor(void)
|
||||
XColor col;
|
||||
Cursor cursor;
|
||||
|
||||
// TODO: Add error checks
|
||||
_glfwGrabXErrorHandler();
|
||||
|
||||
cursormask = XCreatePixmap(_glfw.x11.display, _glfw.x11.root, 1, 1, 1);
|
||||
xgc.function = GXclear;
|
||||
@@ -579,6 +567,14 @@ static Cursor createNULLCursor(void)
|
||||
XFreePixmap(_glfw.x11.display, cursormask);
|
||||
XFreeGC(_glfw.x11.display, gc);
|
||||
|
||||
_glfwReleaseXErrorHandler();
|
||||
|
||||
if (cursor == None)
|
||||
{
|
||||
_glfwInputXError(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create null cursor");
|
||||
}
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@@ -593,6 +589,47 @@ static void terminateDisplay(void)
|
||||
}
|
||||
}
|
||||
|
||||
// X error handler
|
||||
//
|
||||
static int errorHandler(Display *display, XErrorEvent* event)
|
||||
{
|
||||
_glfw.x11.errorCode = event->error_code;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Install the X error handler
|
||||
//
|
||||
void _glfwGrabXErrorHandler(void)
|
||||
{
|
||||
_glfw.x11.errorCode = Success;
|
||||
XSetErrorHandler(errorHandler);
|
||||
}
|
||||
|
||||
// Remove the X error handler
|
||||
//
|
||||
void _glfwReleaseXErrorHandler(void)
|
||||
{
|
||||
// Synchronize to make sure all commands are processed
|
||||
XSync(_glfw.x11.display, False);
|
||||
XSetErrorHandler(NULL);
|
||||
}
|
||||
|
||||
// Report X error
|
||||
//
|
||||
void _glfwInputXError(int error, const char* message)
|
||||
{
|
||||
char buffer[8192];
|
||||
XGetErrorText(_glfw.x11.display, _glfw.x11.errorCode,
|
||||
buffer, sizeof(buffer));
|
||||
|
||||
_glfwInputError(error, "%s: %s", message, buffer);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
@@ -602,20 +639,28 @@ int _glfwPlatformInit(void)
|
||||
{
|
||||
XInitThreads();
|
||||
|
||||
if (!initDisplay())
|
||||
_glfw.x11.display = XOpenDisplay(NULL);
|
||||
if (!_glfw.x11.display)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
_glfwInitGammaRamp();
|
||||
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
|
||||
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
||||
_glfw.x11.context = XUniqueContext();
|
||||
|
||||
if (!_glfwInitContextAPI())
|
||||
if (!initExtensions())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfw.x11.cursor = createNULLCursor();
|
||||
|
||||
if (!_glfwInitJoysticks())
|
||||
if (!_glfwInitContextAPI())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfwInitTimer();
|
||||
_glfwInitJoysticks();
|
||||
_glfwInitGammaRamp();
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
@@ -628,19 +673,16 @@ void _glfwPlatformTerminate(void)
|
||||
_glfw.x11.cursor = (Cursor) 0;
|
||||
}
|
||||
|
||||
free(_glfw.x11.selection.string);
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
|
||||
_glfwTerminateContextAPI();
|
||||
|
||||
terminateDisplay();
|
||||
|
||||
if (_glfw.x11.selection.string)
|
||||
free(_glfw.x11.selection.string);
|
||||
}
|
||||
|
||||
const char* _glfwPlatformGetVersionString(void)
|
||||
{
|
||||
const char* version = _GLFW_VERSION_FULL " X11"
|
||||
const char* version = _GLFW_VERSION_NUMBER " X11"
|
||||
#if defined(_GLFW_GLX)
|
||||
" GLX"
|
||||
#elif defined(_GLFW_EGL)
|
||||
|
||||
+7
-20
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -80,8 +77,8 @@ static int openJoystickDevice(int joy, const char* path)
|
||||
ioctl(fd, JSIOCGBUTTONS, &buttonCount);
|
||||
_glfw.x11.joystick[joy].buttonCount = (int) buttonCount;
|
||||
|
||||
_glfw.x11.joystick[joy].axes = (float*) calloc(axisCount, sizeof(float));
|
||||
_glfw.x11.joystick[joy].buttons = (unsigned char*) calloc(buttonCount, 1);
|
||||
_glfw.x11.joystick[joy].axes = calloc(axisCount, sizeof(float));
|
||||
_glfw.x11.joystick[joy].buttons = calloc(buttonCount, 1);
|
||||
|
||||
_glfw.x11.joystick[joy].present = GL_TRUE;
|
||||
#endif // __linux__
|
||||
@@ -128,15 +125,6 @@ static void pollJoystickEvents(void)
|
||||
case JS_EVENT_AXIS:
|
||||
_glfw.x11.joystick[i].axes[e.number] =
|
||||
(float) e.value / 32767.0f;
|
||||
|
||||
// We need to change the sign for the Y axes, so that
|
||||
// positive = up/forward, according to the GLFW spec.
|
||||
if (e.number & 1)
|
||||
{
|
||||
_glfw.x11.joystick[i].axes[e.number] =
|
||||
-_glfw.x11.joystick[i].axes[e.number];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case JS_EVENT_BUTTON:
|
||||
@@ -159,10 +147,11 @@ static void pollJoystickEvents(void)
|
||||
|
||||
// Initialize joystick interface
|
||||
//
|
||||
int _glfwInitJoysticks(void)
|
||||
void _glfwInitJoysticks(void)
|
||||
{
|
||||
#ifdef __linux__
|
||||
int i, joy = 0;
|
||||
int joy = 0;
|
||||
size_t i;
|
||||
regex_t regex;
|
||||
DIR* dir;
|
||||
const char* dirs[] =
|
||||
@@ -174,7 +163,7 @@ int _glfwInitJoysticks(void)
|
||||
if (regcomp(®ex, "^js[0-9]\\+$", 0) != 0)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to compile regex");
|
||||
return GL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++)
|
||||
@@ -203,8 +192,6 @@ int _glfwInitJoysticks(void)
|
||||
|
||||
regfree(®ex);
|
||||
#endif // __linux__
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
// Close all opened joystick handles
|
||||
|
||||
+15
-9
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11 (Unix)
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -114,7 +111,11 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
}
|
||||
}
|
||||
|
||||
monitor->x11.oldMode = ci->mode;
|
||||
if (bestMode == ci->mode)
|
||||
return;
|
||||
|
||||
if (monitor->x11.oldMode == None)
|
||||
monitor->x11.oldMode = ci->mode;
|
||||
|
||||
XRRSetCrtcConfig(_glfw.x11.display,
|
||||
sr, monitor->x11.crtc,
|
||||
@@ -140,6 +141,9 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
if (monitor->x11.oldMode == None)
|
||||
return;
|
||||
|
||||
sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
@@ -154,6 +158,8 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||
|
||||
XRRFreeCrtcInfo(ci);
|
||||
XRRFreeScreenResources(sr);
|
||||
|
||||
monitor->x11.oldMode = None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +183,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root);
|
||||
primary = XRRGetOutputPrimary(_glfw.x11.display, _glfw.x11.root);
|
||||
|
||||
monitors = (_GLFWmonitor**) calloc(sr->ncrtc, sizeof(_GLFWmonitor*));
|
||||
monitors = calloc(sr->ncrtc, sizeof(_GLFWmonitor*));
|
||||
|
||||
for (i = 0; i < sr->ncrtc; i++)
|
||||
{
|
||||
@@ -247,7 +253,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||
}
|
||||
else
|
||||
{
|
||||
monitors = (_GLFWmonitor**) calloc(1, sizeof(_GLFWmonitor*));
|
||||
monitors = calloc(1, sizeof(_GLFWmonitor*));
|
||||
monitors[0] = _glfwCreateMonitor("Display",
|
||||
DisplayWidthMM(_glfw.x11.display,
|
||||
_glfw.x11.screen),
|
||||
@@ -312,7 +318,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||
sr = XRRGetScreenResources(_glfw.x11.display, _glfw.x11.root);
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
|
||||
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode) * oi->nmode);
|
||||
result = calloc(oi->nmode, sizeof(GLFWvidmode));
|
||||
|
||||
for (i = 0; i < oi->nmode; i++)
|
||||
{
|
||||
@@ -354,7 +360,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
||||
{
|
||||
*found = 1;
|
||||
|
||||
result = (GLFWvidmode*) malloc(sizeof(GLFWvidmode));
|
||||
result = calloc(1, sizeof(GLFWvidmode));
|
||||
|
||||
result[0].width = DisplayWidth(_glfw.x11.display, _glfw.x11.screen);
|
||||
result[0].height = DisplayHeight(_glfw.x11.display, _glfw.x11.screen);
|
||||
|
||||
+16
-6
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -86,6 +83,10 @@ typedef struct _GLFWwindowX11
|
||||
GLboolean cursorGrabbed; // True if cursor is currently grabbed
|
||||
GLboolean cursorHidden; // True if cursor is currently hidden
|
||||
|
||||
// Cached position and size used to filter out duplicate events
|
||||
int width, height;
|
||||
int xpos, ypos;
|
||||
|
||||
// The last received cursor position, regardless of source
|
||||
double cursorPosX, cursorPosY;
|
||||
// The last position the cursor was warped to by GLFW
|
||||
@@ -116,6 +117,7 @@ typedef struct _GLFWlibraryX11
|
||||
Atom NET_WM_PING;
|
||||
Atom NET_WM_STATE;
|
||||
Atom NET_WM_STATE_FULLSCREEN;
|
||||
Atom NET_WM_BYPASS_COMPOSITOR;
|
||||
Atom NET_ACTIVE_WINDOW;
|
||||
Atom MOTIF_WM_HINTS;
|
||||
|
||||
@@ -133,6 +135,9 @@ typedef struct _GLFWlibraryX11
|
||||
// True if window manager supports EWMH
|
||||
GLboolean hasEWMH;
|
||||
|
||||
// Error code received by the X error handler
|
||||
int errorCode;
|
||||
|
||||
struct {
|
||||
GLboolean available;
|
||||
int eventBase;
|
||||
@@ -169,7 +174,7 @@ typedef struct _GLFWlibraryX11
|
||||
int keyCodeLUT[256];
|
||||
|
||||
struct {
|
||||
GLboolean changed;
|
||||
int count;
|
||||
int timeout;
|
||||
int interval;
|
||||
int blanking;
|
||||
@@ -234,7 +239,7 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||
|
||||
// Joystick input
|
||||
int _glfwInitJoysticks(void);
|
||||
void _glfwInitJoysticks(void);
|
||||
void _glfwTerminateJoysticks(void);
|
||||
|
||||
// Unicode support
|
||||
@@ -252,4 +257,9 @@ unsigned long _glfwGetWindowProperty(Window window,
|
||||
Atom type,
|
||||
unsigned char** value);
|
||||
|
||||
// X11 error handler
|
||||
void _glfwGrabXErrorHandler(void);
|
||||
void _glfwReleaseXErrorHandler(void);
|
||||
void _glfwInputXError(int error, const char* message);
|
||||
|
||||
#endif // _x11_platform_h_
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
|
||||
+154
-79
@@ -1,8 +1,5 @@
|
||||
//========================================================================
|
||||
// GLFW - An OpenGL library
|
||||
// Platform: X11
|
||||
// API version: 3.0
|
||||
// WWW: http://www.glfw.org/
|
||||
// GLFW 3.0 X11 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
@@ -132,13 +129,15 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
if (wndconfig->monitor == NULL)
|
||||
{
|
||||
// HACK: This is a workaround for windows without a background pixel
|
||||
// not getting any decorations on certain older versions of Compiz
|
||||
// running on Intel hardware
|
||||
// not getting any decorations on certain older versions of
|
||||
// Compiz running on Intel hardware
|
||||
wa.background_pixel = BlackPixel(_glfw.x11.display,
|
||||
_glfw.x11.screen);
|
||||
wamask |= CWBackPixel;
|
||||
}
|
||||
|
||||
_glfwGrabXErrorHandler();
|
||||
|
||||
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
||||
_glfw.x11.root,
|
||||
0, 0,
|
||||
@@ -150,12 +149,12 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
wamask,
|
||||
&wa);
|
||||
|
||||
_glfwReleaseXErrorHandler();
|
||||
|
||||
if (!window->x11.handle)
|
||||
{
|
||||
// TODO: Handle all the various error codes here and translate them
|
||||
// to GLFW errors
|
||||
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create window");
|
||||
_glfwInputXError(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create window");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -206,13 +205,13 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
|
||||
// The WM_DELETE_WINDOW ICCCM protocol
|
||||
// Basic window close notification protocol
|
||||
if (_glfw.x11.WM_DELETE_WINDOW != None)
|
||||
if (_glfw.x11.WM_DELETE_WINDOW)
|
||||
protocols[count++] = _glfw.x11.WM_DELETE_WINDOW;
|
||||
|
||||
// The _NET_WM_PING EWMH protocol
|
||||
// Tells the WM to ping the GLFW window and flag the application as
|
||||
// unresponsive if the WM doesn't get a reply within a few seconds
|
||||
if (_glfw.x11.NET_WM_PING != None)
|
||||
if (_glfw.x11.NET_WM_PING)
|
||||
protocols[count++] = _glfw.x11.NET_WM_PING;
|
||||
|
||||
if (count > 0)
|
||||
@@ -222,7 +221,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
}
|
||||
}
|
||||
|
||||
if (_glfw.x11.NET_WM_PID != None)
|
||||
if (_glfw.x11.NET_WM_PID)
|
||||
{
|
||||
const pid_t pid = getpid();
|
||||
|
||||
@@ -259,6 +258,14 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
hints->flags |= PPosition;
|
||||
_glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
|
||||
}
|
||||
else
|
||||
{
|
||||
// HACK: Explicitly setting PPosition to any value causes some WMs,
|
||||
// notably Compiz and Metacity, to honor the position of
|
||||
// unmapped windows set by XMoveWindow
|
||||
hints->flags |= PPosition;
|
||||
hints->x = hints->y = 0;
|
||||
}
|
||||
|
||||
if (!wndconfig->resizable)
|
||||
{
|
||||
@@ -271,6 +278,19 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
// Set ICCCM WM_CLASS property
|
||||
// HACK: Until a mechanism for specifying the application name is added, the
|
||||
// initial window title is used as the window class name
|
||||
if (strlen(wndconfig->title))
|
||||
{
|
||||
XClassHint* hint = XAllocClassHint();
|
||||
hint->res_name = (char*) wndconfig->title;
|
||||
hint->res_class = (char*) wndconfig->title;
|
||||
|
||||
XSetClassHint(_glfw.x11.display, window->x11.handle, hint);
|
||||
XFree(hint);
|
||||
}
|
||||
|
||||
if (_glfw.x11.xi.available)
|
||||
{
|
||||
// Select for XInput2 events
|
||||
@@ -291,6 +311,9 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
XRRSelectInput(_glfw.x11.display, window->x11.handle,
|
||||
RRScreenChangeNotifyMask);
|
||||
|
||||
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
|
||||
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -358,7 +381,7 @@ static void showCursor(_GLFWwindow* window)
|
||||
//
|
||||
static void enterFullscreenMode(_GLFWwindow* window)
|
||||
{
|
||||
if (!_glfw.x11.saver.changed)
|
||||
if (_glfw.x11.saver.count == 0)
|
||||
{
|
||||
// Remember old screen saver settings
|
||||
XGetScreenSaver(_glfw.x11.display,
|
||||
@@ -370,21 +393,28 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
||||
// Disable screen saver
|
||||
XSetScreenSaver(_glfw.x11.display, 0, 0, DontPreferBlanking,
|
||||
DefaultExposures);
|
||||
|
||||
_glfw.x11.saver.changed = GL_TRUE;
|
||||
}
|
||||
|
||||
_glfw.x11.saver.count++;
|
||||
|
||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||
|
||||
if (_glfw.x11.hasEWMH &&
|
||||
_glfw.x11.NET_WM_STATE != None &&
|
||||
_glfw.x11.NET_WM_STATE_FULLSCREEN != None)
|
||||
if (_glfw.x11.NET_WM_BYPASS_COMPOSITOR)
|
||||
{
|
||||
const unsigned long value = 1;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char*) &value, 1);
|
||||
}
|
||||
|
||||
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN)
|
||||
{
|
||||
int x, y;
|
||||
_glfwPlatformGetMonitorPos(window->monitor, &x, &y);
|
||||
_glfwPlatformSetWindowPos(window, x, y);
|
||||
|
||||
if (_glfw.x11.NET_ACTIVE_WINDOW != None)
|
||||
if (_glfw.x11.NET_ACTIVE_WINDOW)
|
||||
{
|
||||
// Ask the window manager to raise and focus the GLFW window
|
||||
// Only focused windows with the _NET_WM_STATE_FULLSCREEN state end
|
||||
@@ -452,7 +482,9 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
||||
{
|
||||
_glfwRestoreVideoMode(window->monitor);
|
||||
|
||||
if (_glfw.x11.saver.changed)
|
||||
_glfw.x11.saver.count--;
|
||||
|
||||
if (_glfw.x11.saver.count == 0)
|
||||
{
|
||||
// Restore old screen saver settings
|
||||
XSetScreenSaver(_glfw.x11.display,
|
||||
@@ -460,13 +492,18 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
||||
_glfw.x11.saver.interval,
|
||||
_glfw.x11.saver.blanking,
|
||||
_glfw.x11.saver.exposure);
|
||||
|
||||
_glfw.x11.saver.changed = GL_FALSE;
|
||||
}
|
||||
|
||||
if (_glfw.x11.hasEWMH &&
|
||||
_glfw.x11.NET_WM_STATE != None &&
|
||||
_glfw.x11.NET_WM_STATE_FULLSCREEN != None)
|
||||
if (_glfw.x11.NET_WM_BYPASS_COMPOSITOR)
|
||||
{
|
||||
const unsigned long value = 0;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char*) &value, 1);
|
||||
}
|
||||
|
||||
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN)
|
||||
{
|
||||
// Ask the window manager to make the GLFW window a normal window
|
||||
// Normal windows usually have frames and other decorations
|
||||
@@ -502,8 +539,7 @@ static void processEvent(XEvent *event)
|
||||
window = _glfwFindWindowByHandle(event->xany.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
// This is either an event for a destroyed GLFW window or an event
|
||||
// of a type not currently supported by GLFW
|
||||
// This is an event for a window that has already been destroyed
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -514,11 +550,12 @@ static void processEvent(XEvent *event)
|
||||
{
|
||||
const int key = translateKey(event->xkey.keycode);
|
||||
const int mods = translateState(event->xkey.state);
|
||||
const int character = translateChar(&event->xkey);
|
||||
|
||||
_glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods);
|
||||
|
||||
if (!(mods & GLFW_MOD_CONTROL) && !(mods & GLFW_MOD_ALT))
|
||||
_glfwInputChar(window, translateChar(&event->xkey));
|
||||
if (character != -1)
|
||||
_glfwInputChar(window, character);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -553,6 +590,16 @@ static void processEvent(XEvent *event)
|
||||
else if (event->xbutton.button == Button7)
|
||||
_glfwInputScroll(window, 1.0, 0.0);
|
||||
|
||||
else
|
||||
{
|
||||
// Additional buttons after 7 are treated as regular buttons
|
||||
// We subtract 4 to fill the gap left by scroll input above
|
||||
_glfwInputMouseClick(window,
|
||||
event->xbutton.button - 4,
|
||||
GLFW_PRESS,
|
||||
mods);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -581,6 +628,15 @@ static void processEvent(XEvent *event)
|
||||
GLFW_RELEASE,
|
||||
mods);
|
||||
}
|
||||
else if (event->xbutton.button > Button7)
|
||||
{
|
||||
// Additional buttons after 7 are treated as regular buttons
|
||||
// We subtract 4 to fill the gap left by scroll input above
|
||||
_glfwInputMouseClick(window,
|
||||
event->xbutton.button - 4,
|
||||
GLFW_RELEASE,
|
||||
mods);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -635,17 +691,31 @@ static void processEvent(XEvent *event)
|
||||
|
||||
case ConfigureNotify:
|
||||
{
|
||||
_glfwInputFramebufferSize(window,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height);
|
||||
if (event->xconfigure.width != window->x11.width ||
|
||||
event->xconfigure.height != window->x11.height)
|
||||
{
|
||||
_glfwInputFramebufferSize(window,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height);
|
||||
|
||||
_glfwInputWindowSize(window,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height);
|
||||
_glfwInputWindowSize(window,
|
||||
event->xconfigure.width,
|
||||
event->xconfigure.height);
|
||||
|
||||
_glfwInputWindowPos(window,
|
||||
event->xconfigure.x,
|
||||
event->xconfigure.y);
|
||||
window->x11.width = event->xconfigure.width;
|
||||
window->x11.height = event->xconfigure.height;
|
||||
}
|
||||
|
||||
if (event->xconfigure.x != window->x11.xpos ||
|
||||
event->xconfigure.y != window->x11.ypos)
|
||||
{
|
||||
_glfwInputWindowPos(window,
|
||||
event->xconfigure.x,
|
||||
event->xconfigure.y);
|
||||
|
||||
window->x11.xpos = event->xconfigure.x;
|
||||
window->x11.ypos = event->xconfigure.y;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -661,7 +731,7 @@ static void processEvent(XEvent *event)
|
||||
|
||||
_glfwInputWindowCloseRequest(window);
|
||||
}
|
||||
else if (_glfw.x11.NET_WM_PING != None &&
|
||||
else if (_glfw.x11.NET_WM_PING &&
|
||||
(Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING)
|
||||
{
|
||||
// The window manager is pinging the application to ensure it's
|
||||
@@ -943,7 +1013,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
NULL, NULL, NULL);
|
||||
#endif
|
||||
|
||||
if (_glfw.x11.NET_WM_NAME != None)
|
||||
if (_glfw.x11.NET_WM_NAME)
|
||||
{
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_NAME, _glfw.x11.UTF8_STRING, 8,
|
||||
@@ -951,7 +1021,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
(unsigned char*) title, strlen(title));
|
||||
}
|
||||
|
||||
if (_glfw.x11.NET_WM_ICON_NAME != None)
|
||||
if (_glfw.x11.NET_WM_ICON_NAME)
|
||||
{
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_ICON_NAME, _glfw.x11.UTF8_STRING, 8,
|
||||
@@ -968,6 +1038,17 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
||||
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root,
|
||||
0, 0, &x, &y, &child);
|
||||
|
||||
if (child)
|
||||
{
|
||||
int left, top;
|
||||
|
||||
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child,
|
||||
0, 0, &left, &top, &child);
|
||||
|
||||
x -= left;
|
||||
y -= top;
|
||||
}
|
||||
|
||||
if (xpos)
|
||||
*xpos = x;
|
||||
if (ypos)
|
||||
@@ -993,34 +1074,36 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
||||
|
||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
if (!window->resizable)
|
||||
{
|
||||
// Update window size restrictions to match new window size
|
||||
|
||||
XSizeHints* hints = XAllocSizeHints();
|
||||
|
||||
hints->flags |= (PMinSize | PMaxSize);
|
||||
hints->min_width = hints->max_width = width;
|
||||
hints->min_height = hints->max_height = height;
|
||||
|
||||
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
if (window->monitor)
|
||||
{
|
||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||
|
||||
if (window->x11.overrideRedirect)
|
||||
{
|
||||
GLFWvidmode mode;
|
||||
_glfwPlatformGetVideoMode(window->monitor, &mode);
|
||||
XResizeWindow(_glfw.x11.display, window->x11.handle,
|
||||
window->videoMode.width, window->videoMode.height);
|
||||
mode.width, mode.height);
|
||||
}
|
||||
|
||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!window->resizable)
|
||||
{
|
||||
// Update window size restrictions to match new window size
|
||||
|
||||
XSizeHints* hints = XAllocSizeHints();
|
||||
|
||||
hints->flags |= (PMinSize | PMaxSize);
|
||||
hints->min_width = hints->max_width = width;
|
||||
hints->min_height = hints->max_height = height;
|
||||
|
||||
XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
|
||||
XResizeWindow(_glfw.x11.display, window->x11.handle, width, height);
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
}
|
||||
@@ -1036,6 +1119,9 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||
{
|
||||
// Override-redirect windows cannot be iconified or restored, as those
|
||||
// tasks are performed by the window manager
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"X11: Iconification of full screen windows requires "
|
||||
"a WM that supports EWMH");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1048,6 +1134,9 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||
{
|
||||
// Override-redirect windows cannot be iconified or restored, as those
|
||||
// tasks are performed by the window manager
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"X11: Iconification of full screen windows requires "
|
||||
"a WM that supports EWMH");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1076,24 +1165,12 @@ void _glfwPlatformPollEvents(void)
|
||||
processEvent(&event);
|
||||
}
|
||||
|
||||
// Check whether the cursor has moved inside an focused window that has
|
||||
// captured the cursor (because then it needs to be re-centered)
|
||||
|
||||
_GLFWwindow* window;
|
||||
window = _glfw.focusedWindow;
|
||||
if (window)
|
||||
_GLFWwindow* window = _glfw.focusedWindow;
|
||||
if (window && window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
int width, height;
|
||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||
_glfwPlatformSetCursorPos(window, width / 2, height / 2);
|
||||
|
||||
// NOTE: This is a temporary fix. It works as long as you use
|
||||
// offsets accumulated over the course of a frame, instead of
|
||||
// performing the necessary actions per callback call.
|
||||
XFlush(_glfw.x11.display);
|
||||
}
|
||||
int width, height;
|
||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||
_glfwPlatformSetCursorPos(window, width / 2, height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1101,10 +1178,8 @@ void _glfwPlatformWaitEvents(void)
|
||||
{
|
||||
if (!XPending(_glfw.x11.display))
|
||||
{
|
||||
int fd;
|
||||
fd_set fds;
|
||||
|
||||
fd = ConnectionNumber(_glfw.x11.display);
|
||||
const int fd = ConnectionNumber(_glfw.x11.display);
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
|
||||
@@ -11,10 +11,6 @@ endif()
|
||||
include_directories(${GLFW_SOURCE_DIR}/include
|
||||
${GLFW_SOURCE_DIR}/deps)
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if (NOT APPLE)
|
||||
# HACK: This is NOTFOUND on OS X 10.8
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
@@ -27,7 +23,7 @@ set(TINYCTHREAD ${GLFW_SOURCE_DIR}/deps/tinycthread.h
|
||||
|
||||
add_executable(clipboard clipboard.c ${GETOPT})
|
||||
add_executable(defaults defaults.c)
|
||||
add_executable(events events.c)
|
||||
add_executable(events events.c ${GETOPT})
|
||||
add_executable(fsaa fsaa.c ${GETOPT})
|
||||
add_executable(gamma gamma.c ${GETOPT})
|
||||
add_executable(glfwinfo glfwinfo.c ${GETOPT})
|
||||
|
||||
+21
-8
@@ -39,6 +39,8 @@
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
// These must match the input mode defaults
|
||||
static GLboolean closeable = GL_TRUE;
|
||||
|
||||
@@ -226,12 +228,12 @@ static const char* get_mods_name(int mods)
|
||||
return name;
|
||||
}
|
||||
|
||||
static const char* get_character_string(int character)
|
||||
static const char* get_character_string(int codepoint)
|
||||
{
|
||||
// This assumes UTF-8, which is stupid
|
||||
static char result[6 + 1];
|
||||
|
||||
int length = wctomb(result, character);
|
||||
int length = wctomb(result, codepoint);
|
||||
if (length == -1)
|
||||
length = 0;
|
||||
|
||||
@@ -370,13 +372,13 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
||||
}
|
||||
}
|
||||
|
||||
static void char_callback(GLFWwindow* window, unsigned int character)
|
||||
static void char_callback(GLFWwindow* window, unsigned int codepoint)
|
||||
{
|
||||
printf("%08x at %0.3f: Character 0x%08x (%s) input\n",
|
||||
counter++,
|
||||
glfwGetTime(),
|
||||
character,
|
||||
get_character_string(character));
|
||||
codepoint,
|
||||
get_character_string(codepoint));
|
||||
}
|
||||
|
||||
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
@@ -406,10 +408,11 @@ void monitor_callback(GLFWmonitor* monitor, int event)
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GLFWwindow* window;
|
||||
int width, height;
|
||||
GLFWmonitor* monitor = NULL;
|
||||
int ch, width, height;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
@@ -420,7 +423,17 @@ int main(void)
|
||||
|
||||
printf("Library initialized\n");
|
||||
|
||||
window = glfwCreateWindow(640, 480, "Event Linter", NULL, NULL);
|
||||
while ((ch = getopt(argc, argv, "f")) != -1)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case 'f':
|
||||
monitor = glfwGetPrimaryMonitor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(640, 480, "Event Linter", monitor, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
+13
-9
@@ -54,9 +54,16 @@
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-r STRATEGY]\n");
|
||||
printf("available APIs: " API_OPENGL " " API_OPENGL_ES "\n");
|
||||
printf("available profiles: " PROFILE_NAME_CORE " " PROFILE_NAME_COMPAT "\n");
|
||||
printf("available strategies: " STRATEGY_NAME_NONE " " STRATEGY_NAME_LOSE "\n");
|
||||
printf("Options:\n");
|
||||
printf(" -a the client API to use (" API_OPENGL " or " API_OPENGL_ES ")\n");
|
||||
printf(" -d request a debug context\n");
|
||||
printf(" -f require a forward-compatible context\n");
|
||||
printf(" -h show this help\n");
|
||||
printf(" -l list all client API extensions after context creation\n");
|
||||
printf(" -m the major number of the requred client API version\n");
|
||||
printf(" -n the minor number of the requred client API version\n");
|
||||
printf(" -p the OpenGL profile to use (" PROFILE_NAME_CORE " or " PROFILE_NAME_COMPAT ")\n");
|
||||
printf(" -r the robustness strategy to use (" STRATEGY_NAME_NONE " or " STRATEGY_NAME_LOSE ")\n");
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
@@ -186,9 +193,6 @@ int main(int argc, char** argv)
|
||||
GLint flags, mask;
|
||||
GLFWwindow* window;
|
||||
|
||||
if (!valid_version())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((ch = getopt(argc, argv, "a:dfhlm:n:p:r:")) != -1)
|
||||
{
|
||||
switch (ch)
|
||||
@@ -249,11 +253,11 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
// Initialize GLFW and create window
|
||||
|
||||
if (!valid_version())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
|
||||
+33
-29
@@ -64,43 +64,47 @@ static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
static void draw_joystick(Joystick* j, int x, int y, int width, int height)
|
||||
{
|
||||
int i;
|
||||
int axis_width, axis_height;
|
||||
int button_width, button_height;
|
||||
const int axis_height = 3 * height / 4;
|
||||
const int button_height = height / 4;
|
||||
|
||||
axis_width = width / j->axis_count;
|
||||
axis_height = 3 * height / 4;
|
||||
|
||||
button_width = width / j->button_count;
|
||||
button_height = height / 4;
|
||||
|
||||
for (i = 0; i < j->axis_count; i++)
|
||||
if (j->axis_count)
|
||||
{
|
||||
float value = j->axes[i] / 2.f + 0.5f;
|
||||
const int axis_width = width / j->axis_count;
|
||||
|
||||
glColor3f(0.3f, 0.3f, 0.3f);
|
||||
glRecti(x + i * axis_width,
|
||||
y,
|
||||
x + (i + 1) * axis_width,
|
||||
y + axis_height);
|
||||
for (i = 0; i < j->axis_count; i++)
|
||||
{
|
||||
float value = j->axes[i] / 2.f + 0.5f;
|
||||
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
glRecti(x + i * axis_width,
|
||||
y + (int) (value * (axis_height - 5)),
|
||||
x + (i + 1) * axis_width,
|
||||
y + 5 + (int) (value * (axis_height - 5)));
|
||||
glColor3f(0.3f, 0.3f, 0.3f);
|
||||
glRecti(x + i * axis_width,
|
||||
y,
|
||||
x + (i + 1) * axis_width,
|
||||
y + axis_height);
|
||||
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
glRecti(x + i * axis_width,
|
||||
y + (int) (value * (axis_height - 5)),
|
||||
x + (i + 1) * axis_width,
|
||||
y + 5 + (int) (value * (axis_height - 5)));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < j->button_count; i++)
|
||||
if (j->button_count)
|
||||
{
|
||||
if (j->buttons[i])
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
else
|
||||
glColor3f(0.3f, 0.3f, 0.3f);
|
||||
const int button_width = width / j->button_count;
|
||||
|
||||
glRecti(x + i * button_width,
|
||||
y + axis_height,
|
||||
x + (i + 1) * button_width,
|
||||
y + axis_height + button_height);
|
||||
for (i = 0; i < j->button_count; i++)
|
||||
{
|
||||
if (j->buttons[i])
|
||||
glColor3f(1.f, 1.f, 1.f);
|
||||
else
|
||||
glColor3f(0.3f, 0.3f, 0.3f);
|
||||
|
||||
glRecti(x + i * button_width,
|
||||
y + axis_height,
|
||||
x + (i + 1) * button_width,
|
||||
y + axis_height + button_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,9 +218,6 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -57,8 +56,6 @@ static int thread_main(void* data)
|
||||
const Thread* thread = (const Thread*) data;
|
||||
|
||||
glfwMakeContextCurrent(thread->window);
|
||||
assert(glfwGetCurrentContext() == thread->window);
|
||||
|
||||
glfwSwapInterval(1);
|
||||
|
||||
while (running)
|
||||
@@ -118,8 +115,6 @@ int main(void)
|
||||
|
||||
while (running)
|
||||
{
|
||||
assert(glfwGetCurrentContext() == NULL);
|
||||
|
||||
glfwWaitEvents();
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
|
||||
Reference in New Issue
Block a user