mirror of
https://github.com/glfw/glfw.git
synced 2025-10-03 13:20:58 +00:00
commit
172b31d169
1
.gitignore
vendored
1
.gitignore
vendored
@ -44,6 +44,7 @@ examples/*.exe
|
|||||||
examples/boing
|
examples/boing
|
||||||
examples/gears
|
examples/gears
|
||||||
examples/heightmap
|
examples/heightmap
|
||||||
|
examples/particles
|
||||||
examples/splitview
|
examples/splitview
|
||||||
examples/simple
|
examples/simple
|
||||||
examples/wave
|
examples/wave
|
||||||
|
@ -3,8 +3,8 @@ project(GLFW C)
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
set(GLFW_VERSION_MAJOR "3")
|
set(GLFW_VERSION_MAJOR "3")
|
||||||
set(GLFW_VERSION_MINOR "0")
|
set(GLFW_VERSION_MINOR "1")
|
||||||
set(GLFW_VERSION_PATCH "4")
|
set(GLFW_VERSION_PATCH "0")
|
||||||
set(GLFW_VERSION_EXTRA "")
|
set(GLFW_VERSION_EXTRA "")
|
||||||
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
||||||
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
||||||
@ -13,6 +13,7 @@ set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib
|
|||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||||
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||||
option(GLFW_INSTALL "Generate installation target" ON)
|
option(GLFW_INSTALL "Generate installation target" ON)
|
||||||
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
|
||||||
|
|
||||||
@ -73,11 +74,13 @@ endif()
|
|||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
set(DOXYGEN_SKIP_DOT TRUE)
|
if (GLFW_BUILD_DOCS)
|
||||||
find_package(Doxygen)
|
set(DOXYGEN_SKIP_DOT TRUE)
|
||||||
|
find_package(Doxygen)
|
||||||
|
|
||||||
if (GLFW_DOCUMENT_INTERNALS)
|
if (GLFW_DOCUMENT_INTERNALS)
|
||||||
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@ -407,7 +410,7 @@ if (GLFW_BUILD_TESTS)
|
|||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DOXYGEN_FOUND)
|
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
|
||||||
add_subdirectory(docs)
|
add_subdirectory(docs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
255
README.md
255
README.md
@ -6,8 +6,7 @@ GLFW is a free, Open Source, portable library for OpenGL and OpenGL ES
|
|||||||
application development. It provides a simple, platform-independent API for
|
application development. It provides a simple, platform-independent API for
|
||||||
creating windows and contexts, reading input, handling events, etc.
|
creating windows and contexts, reading input, handling events, etc.
|
||||||
|
|
||||||
Version 3.0.4 is *not yet described*. As this is a patch release, there are no
|
Version 3.1 is *not yet described*.
|
||||||
API changes.
|
|
||||||
|
|
||||||
If you are new to GLFW, you may find the
|
If you are new to GLFW, you may find the
|
||||||
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
|
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
|
||||||
@ -16,234 +15,45 @@ If you are new to GLFW, you may find the
|
|||||||
the GLFW 3 API.
|
the GLFW 3 API.
|
||||||
|
|
||||||
|
|
||||||
## Building GLFW
|
## Compiling GLFW
|
||||||
|
|
||||||
These are the build instructions for the GLFW library itself. For information
|
See the [Compiling GLFW](http://www.glfw.org/docs/latest/compile.html) guide in
|
||||||
on how to build programs that use GLFW, see the [Building programs using
|
the GLFW documentation.
|
||||||
GLFW](http://www.glfw.org/docs/latest/build.html) guide.
|
|
||||||
|
|
||||||
|
|
||||||
### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
### 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 source directory 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### Generating files with the CMake command-line tool
|
|
||||||
|
|
||||||
To make an in-tree build, enter the root directory of the GLFW source tree 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 ..
|
|
||||||
|
|
||||||
|
|
||||||
#### 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*.
|
|
||||||
|
|
||||||
|
|
||||||
### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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 `$PREFIX/lib`. If it is set to
|
|
||||||
`64`, it is installed to `$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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
|
|
||||||
## Installing GLFW
|
|
||||||
|
|
||||||
A rudimentary installation target is provided for all supported platforms via
|
|
||||||
CMake. If you are building from the command-line, use the `install` target.
|
|
||||||
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
If you are using an IDE, run the generated install target from the IDE.
|
|
||||||
|
|
||||||
|
|
||||||
## Using GLFW
|
## Using GLFW
|
||||||
|
|
||||||
See the [GLFW documentation](http://www.glfw.org/docs/latest/).
|
See the
|
||||||
|
[Building programs that use GLFW](http://www.glfw.org/docs/latest/build.html)
|
||||||
|
guide in the GLFW documentation.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
GLFW bundles a number of dependencies in the `deps/` directory.
|
||||||
|
|
||||||
|
The following dependencies are needed by GLFW:
|
||||||
|
|
||||||
|
- [Khronos extension headers](https://www.opengl.org/registry/)
|
||||||
|
|
||||||
|
The following dependencies are needed by the examples and test programs:
|
||||||
|
|
||||||
|
- [getopt\_port](https://github.com/kimgr/getopt_port/) for getopt
|
||||||
|
- [TinyCThread](https://gitorious.org/tinythread/tinycthread/) for threading
|
||||||
|
- An OpenGL loader generated by [glad](https://github.com/Dav1dde/glad)
|
||||||
|
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Renamed configuration header to `glfw_config.h` to avoid conflicts
|
- Added native monitor handle access to native API
|
||||||
- Bugfix: The `glfw3.pc` file did not respect the `LIB_SUFFIX` CMake option
|
- Added `glfwSetDropCallback` and `GLFWdropfun` for receiving dropped files
|
||||||
- [Win32] Bugfix: Removed joystick axis value negation left over from GLFW 2
|
- [Cocoa] Bugfix: Using a 1x1 cursor for hidden mode caused some screen
|
||||||
- [Win32] Bugfix: Restoring windows using the Win+D hot key did not trigger the
|
recorders to fail
|
||||||
focus callback
|
- [Win32] Bugfix: Failure to load winmm or its functions was not reported to
|
||||||
- [Win32] Bugfix: The disabled cursor mode clip rectangle was updated for
|
the error callback
|
||||||
unfocused windows
|
- [X11] Bugfix: The case of finding no usable CRTCs was not detected
|
||||||
- [Cocoa] Added dependency on CoreVideo framework for refresh rate retrieval
|
- [X11] Bugfix: Detection of broken Nvidia RandR gamma support did not verify
|
||||||
- [Cocoa] Enabled Lion full screen for resizable windowed mode windows
|
that at least one CRTC was present
|
||||||
- [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
|
|
||||||
- [X11] Added setting of the `WM_CLASS` property to the initial window title
|
|
||||||
- [X11] Bugfix: Removed joystick axis value negation left over from GLFW 2
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
@ -289,6 +99,7 @@ skills.
|
|||||||
- Paul R. Deppe
|
- Paul R. Deppe
|
||||||
- Jonathan Dummer
|
- Jonathan Dummer
|
||||||
- Ralph Eastwood
|
- Ralph Eastwood
|
||||||
|
- Michael Fogleman
|
||||||
- Gerald Franz
|
- Gerald Franz
|
||||||
- GeO4d
|
- GeO4d
|
||||||
- Marcus Geelnard
|
- Marcus Geelnard
|
||||||
@ -313,10 +124,12 @@ skills.
|
|||||||
- Marcel Metz
|
- Marcel Metz
|
||||||
- Kenneth Miller
|
- Kenneth Miller
|
||||||
- Bruce Mitchener
|
- Bruce Mitchener
|
||||||
|
- Jack Moffitt
|
||||||
- Jeff Molofee
|
- Jeff Molofee
|
||||||
- Jon Morton
|
- Jon Morton
|
||||||
- Pierre Moulon
|
- Pierre Moulon
|
||||||
- Julian Møller
|
- Julian Møller
|
||||||
|
- Kamil Nowakowski
|
||||||
- Ozzy
|
- Ozzy
|
||||||
- Andri Pálsson
|
- Andri Pálsson
|
||||||
- Peoro
|
- Peoro
|
||||||
|
877
deps/GL/glext.h
vendored
877
deps/GL/glext.h
vendored
File diff suppressed because it is too large
Load Diff
4
deps/GL/glxext.h
vendored
4
deps/GL/glxext.h
vendored
@ -33,10 +33,10 @@ extern "C" {
|
|||||||
** used to make the header, and the header can be found at
|
** used to make the header, and the header can be found at
|
||||||
** http://www.opengl.org/registry/
|
** http://www.opengl.org/registry/
|
||||||
**
|
**
|
||||||
** Khronos $Revision$ on $Date$
|
** Khronos $Revision: 23649 $ on $Date: 2013-10-23 00:21:49 -0700 (Wed, 23 Oct 2013) $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GLX_GLXEXT_VERSION 20130710
|
#define GLX_GLXEXT_VERSION 20131008
|
||||||
|
|
||||||
/* Generated C header for:
|
/* Generated C header for:
|
||||||
* API: glx
|
* API: glx
|
||||||
|
12
deps/GL/wglext.h
vendored
12
deps/GL/wglext.h
vendored
@ -33,7 +33,7 @@ extern "C" {
|
|||||||
** used to make the header, and the header can be found at
|
** used to make the header, and the header can be found at
|
||||||
** http://www.opengl.org/registry/
|
** http://www.opengl.org/registry/
|
||||||
**
|
**
|
||||||
** Khronos $Revision$ on $Date$
|
** Khronos $Revision: 23649 $ on $Date: 2013-10-23 00:21:49 -0700 (Wed, 23 Oct 2013) $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||||
@ -41,7 +41,7 @@ extern "C" {
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WGL_WGLEXT_VERSION 20130710
|
#define WGL_WGLEXT_VERSION 20130916
|
||||||
|
|
||||||
/* Generated C header for:
|
/* Generated C header for:
|
||||||
* API: wgl
|
* API: wgl
|
||||||
@ -645,6 +645,14 @@ BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarge
|
|||||||
#endif
|
#endif
|
||||||
#endif /* WGL_NV_copy_image */
|
#endif /* WGL_NV_copy_image */
|
||||||
|
|
||||||
|
#ifndef WGL_NV_delay_before_swap
|
||||||
|
#define WGL_NV_delay_before_swap 1
|
||||||
|
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
|
||||||
|
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||||
|
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
|
||||||
|
#endif
|
||||||
|
#endif /* WGL_NV_delay_before_swap */
|
||||||
|
|
||||||
#ifndef WGL_NV_float_buffer
|
#ifndef WGL_NV_float_buffer
|
||||||
#define WGL_NV_float_buffer 1
|
#define WGL_NV_float_buffer 1
|
||||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||||
|
282
deps/KHR/khrplatform.h
vendored
Normal file
282
deps/KHR/khrplatform.h
vendored
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
#ifndef __khrplatform_h_
|
||||||
|
#define __khrplatform_h_
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
** copy of this software and/or associated documentation files (the
|
||||||
|
** "Materials"), to deal in the Materials without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||||
|
** permit persons to whom the Materials are furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be included
|
||||||
|
** in all copies or substantial portions of the Materials.
|
||||||
|
**
|
||||||
|
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Khronos platform-specific types and definitions.
|
||||||
|
*
|
||||||
|
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||||
|
*
|
||||||
|
* Adopters may modify this file to suit their platform. Adopters are
|
||||||
|
* encouraged to submit platform specific modifications to the Khronos
|
||||||
|
* group so that they can be included in future versions of this file.
|
||||||
|
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||||
|
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||||
|
* "Khronos (general)" component "Registry".
|
||||||
|
*
|
||||||
|
* A predefined template which fills in some of the bug fields can be
|
||||||
|
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||||
|
* must create a Bugzilla login first.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* See the Implementer's Guidelines for information about where this file
|
||||||
|
* should be located on your system and for more details of its use:
|
||||||
|
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||||
|
*
|
||||||
|
* This file should be included as
|
||||||
|
* #include <KHR/khrplatform.h>
|
||||||
|
* by Khronos client API header files that use its types and defines.
|
||||||
|
*
|
||||||
|
* The types in khrplatform.h should only be used to define API-specific types.
|
||||||
|
*
|
||||||
|
* Types defined in khrplatform.h:
|
||||||
|
* khronos_int8_t signed 8 bit
|
||||||
|
* khronos_uint8_t unsigned 8 bit
|
||||||
|
* khronos_int16_t signed 16 bit
|
||||||
|
* khronos_uint16_t unsigned 16 bit
|
||||||
|
* khronos_int32_t signed 32 bit
|
||||||
|
* khronos_uint32_t unsigned 32 bit
|
||||||
|
* khronos_int64_t signed 64 bit
|
||||||
|
* khronos_uint64_t unsigned 64 bit
|
||||||
|
* khronos_intptr_t signed same number of bits as a pointer
|
||||||
|
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||||
|
* khronos_ssize_t signed size
|
||||||
|
* khronos_usize_t unsigned size
|
||||||
|
* khronos_float_t signed 32 bit floating point
|
||||||
|
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||||
|
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||||
|
* nanoseconds
|
||||||
|
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||||
|
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||||
|
* only be used as a base type when a client API's boolean type is
|
||||||
|
* an enum. Client APIs which use an integer or other type for
|
||||||
|
* booleans cannot use this as the base type for their boolean.
|
||||||
|
*
|
||||||
|
* Tokens defined in khrplatform.h:
|
||||||
|
*
|
||||||
|
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||||
|
*
|
||||||
|
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||||
|
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||||
|
*
|
||||||
|
* Calling convention macros defined in this file:
|
||||||
|
* KHRONOS_APICALL
|
||||||
|
* KHRONOS_APIENTRY
|
||||||
|
* KHRONOS_APIATTRIBUTES
|
||||||
|
*
|
||||||
|
* These may be used in function prototypes as:
|
||||||
|
*
|
||||||
|
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||||
|
* int arg1,
|
||||||
|
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* Definition of KHRONOS_APICALL
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
* This precedes the return type of the function in the function prototype.
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||||
|
# define KHRONOS_APICALL __declspec(dllimport)
|
||||||
|
#elif defined (__SYMBIAN32__)
|
||||||
|
# define KHRONOS_APICALL IMPORT_C
|
||||||
|
#else
|
||||||
|
# define KHRONOS_APICALL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* Definition of KHRONOS_APIENTRY
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
* This follows the return type of the function and precedes the function
|
||||||
|
* name in the function prototype.
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||||
|
/* Win32 but not WinCE */
|
||||||
|
# define KHRONOS_APIENTRY __stdcall
|
||||||
|
#else
|
||||||
|
# define KHRONOS_APIENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* Definition of KHRONOS_APIATTRIBUTES
|
||||||
|
*-------------------------------------------------------------------------
|
||||||
|
* This follows the closing parenthesis of the function prototype arguments.
|
||||||
|
*/
|
||||||
|
#if defined (__ARMCC_2__)
|
||||||
|
#define KHRONOS_APIATTRIBUTES __softfp
|
||||||
|
#else
|
||||||
|
#define KHRONOS_APIATTRIBUTES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
* basic type definitions
|
||||||
|
*-----------------------------------------------------------------------*/
|
||||||
|
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using <stdint.h>
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef int32_t khronos_int32_t;
|
||||||
|
typedef uint32_t khronos_uint32_t;
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif defined(__VMS ) || defined(__sgi)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using <inttypes.h>
|
||||||
|
*/
|
||||||
|
#include <inttypes.h>
|
||||||
|
typedef int32_t khronos_int32_t;
|
||||||
|
typedef uint32_t khronos_uint32_t;
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Win32
|
||||||
|
*/
|
||||||
|
typedef __int32 khronos_int32_t;
|
||||||
|
typedef unsigned __int32 khronos_uint32_t;
|
||||||
|
typedef __int64 khronos_int64_t;
|
||||||
|
typedef unsigned __int64 khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif defined(__sun__) || defined(__digital__)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sun or Digital
|
||||||
|
*/
|
||||||
|
typedef int khronos_int32_t;
|
||||||
|
typedef unsigned int khronos_uint32_t;
|
||||||
|
#if defined(__arch64__) || defined(_LP64)
|
||||||
|
typedef long int khronos_int64_t;
|
||||||
|
typedef unsigned long int khronos_uint64_t;
|
||||||
|
#else
|
||||||
|
typedef long long int khronos_int64_t;
|
||||||
|
typedef unsigned long long int khronos_uint64_t;
|
||||||
|
#endif /* __arch64__ */
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#elif 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hypothetical platform with no float or int64 support
|
||||||
|
*/
|
||||||
|
typedef int khronos_int32_t;
|
||||||
|
typedef unsigned int khronos_uint32_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 0
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 0
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic fallback
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
typedef int32_t khronos_int32_t;
|
||||||
|
typedef uint32_t khronos_uint32_t;
|
||||||
|
typedef int64_t khronos_int64_t;
|
||||||
|
typedef uint64_t khronos_uint64_t;
|
||||||
|
#define KHRONOS_SUPPORT_INT64 1
|
||||||
|
#define KHRONOS_SUPPORT_FLOAT 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Types that are (so far) the same on all platforms
|
||||||
|
*/
|
||||||
|
typedef signed char khronos_int8_t;
|
||||||
|
typedef unsigned char khronos_uint8_t;
|
||||||
|
typedef signed short int khronos_int16_t;
|
||||||
|
typedef unsigned short int khronos_uint16_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||||
|
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||||
|
* to be the only LLP64 architecture in current use.
|
||||||
|
*/
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef signed long long int khronos_intptr_t;
|
||||||
|
typedef unsigned long long int khronos_uintptr_t;
|
||||||
|
typedef signed long long int khronos_ssize_t;
|
||||||
|
typedef unsigned long long int khronos_usize_t;
|
||||||
|
#else
|
||||||
|
typedef signed long int khronos_intptr_t;
|
||||||
|
typedef unsigned long int khronos_uintptr_t;
|
||||||
|
typedef signed long int khronos_ssize_t;
|
||||||
|
typedef unsigned long int khronos_usize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if KHRONOS_SUPPORT_FLOAT
|
||||||
|
/*
|
||||||
|
* Float type
|
||||||
|
*/
|
||||||
|
typedef float khronos_float_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if KHRONOS_SUPPORT_INT64
|
||||||
|
/* Time types
|
||||||
|
*
|
||||||
|
* These types can be used to represent a time interval in nanoseconds or
|
||||||
|
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||||
|
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||||
|
* time the system booted). The Unadjusted System Time is an unsigned
|
||||||
|
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||||
|
* may be either signed or unsigned.
|
||||||
|
*/
|
||||||
|
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||||
|
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy value used to pad enum types to 32 bits.
|
||||||
|
*/
|
||||||
|
#ifndef KHRONOS_MAX_ENUM
|
||||||
|
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enumerated boolean type
|
||||||
|
*
|
||||||
|
* Values other than zero should be considered to be true. Therefore
|
||||||
|
* comparisons should not be made against KHRONOS_TRUE.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
KHRONOS_FALSE = 0,
|
||||||
|
KHRONOS_TRUE = 1,
|
||||||
|
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||||
|
} khronos_boolean_enum_t;
|
||||||
|
|
||||||
|
#endif /* __khrplatform_h_ */
|
439
deps/getopt.c
vendored
439
deps/getopt.c
vendored
@ -1,267 +1,230 @@
|
|||||||
/*****************************************************************************
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
* getopt.c - competent and free getopt library.
|
* All rights reserved.
|
||||||
* $Header: /cvsroot/freegetopt/freegetopt/getopt.c,v 1.2 2003/10/26 03:10:20 vindaci Exp $
|
*
|
||||||
*
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* Copyright (c)2002-2003 Mark K. Kim
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* All rights reserved.
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
*
|
* this list of conditions and the following disclaimer.
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* modification, are permitted provided that the following conditions
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* are met:
|
* and/or other materials provided with the distribution.
|
||||||
*
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
* * Redistributions of source code must retain the above copyright
|
* to endorse or promote products derived from this software without specific
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* prior written permission.
|
||||||
*
|
*
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* the documentation and/or other materials provided with the
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* distribution.
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
*
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* * Neither the original author of this software nor the names of its
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* contributors may be used to endorse or promote products derived
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* from this software without specific prior written permission.
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
*
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
*/
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
||||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
* DAMAGE.
|
|
||||||
*/
|
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
/* 2013-01-06 Camilla Berglund <elmindreda@elmindreda.org>
|
#include <stddef.h>
|
||||||
*
|
#include <string.h>
|
||||||
* Only define _CRT_SECURE_NO_WARNINGS if not already defined.
|
|
||||||
*/
|
|
||||||
/* 2012-08-12 Lambert Clara <lambert.clara@yahoo.fr>
|
|
||||||
*
|
|
||||||
* Constify third argument of getopt.
|
|
||||||
*/
|
|
||||||
/* 2011-07-27 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
*
|
|
||||||
* Added _CRT_SECURE_NO_WARNINGS macro.
|
|
||||||
*/
|
|
||||||
/* 2009-10-12 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
*
|
|
||||||
* Removed unused global static variable 'ID'.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char* optarg = NULL;
|
const int no_argument = 0;
|
||||||
int optind = 0;
|
const int required_argument = 1;
|
||||||
int opterr = 1;
|
const int optional_argument = 2;
|
||||||
int optopt = '?';
|
|
||||||
|
|
||||||
|
char* optarg;
|
||||||
|
int optopt;
|
||||||
|
/* The variable optind [...] shall be initialized to 1 by the system. */
|
||||||
|
int optind = 1;
|
||||||
|
int opterr;
|
||||||
|
|
||||||
static char** prev_argv = NULL; /* Keep a copy of argv and argc to */
|
static char* optcursor = NULL;
|
||||||
static int prev_argc = 0; /* tell if getopt params change */
|
|
||||||
static int argv_index = 0; /* Option we're checking */
|
|
||||||
static int argv_index2 = 0; /* Option argument we're checking */
|
|
||||||
static int opt_offset = 0; /* Index into compounded "-option" */
|
|
||||||
static int dashdash = 0; /* True if "--" option reached */
|
|
||||||
static int nonopt = 0; /* How many nonopts we've found */
|
|
||||||
|
|
||||||
static void increment_index()
|
/* Implemented based on [1] and [2] for optional arguments.
|
||||||
{
|
optopt is handled FreeBSD-style, per [3].
|
||||||
/* Move onto the next option */
|
Other GNU and FreeBSD extensions are purely accidental.
|
||||||
if(argv_index < argv_index2)
|
|
||||||
{
|
|
||||||
while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-'
|
|
||||||
&& argv_index < argv_index2+1);
|
|
||||||
}
|
|
||||||
else argv_index++;
|
|
||||||
opt_offset = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html
|
||||||
/*
|
[2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
* Permutes argv[] so that the argument currently being processed is moved
|
[3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE
|
||||||
* to the end.
|
|
||||||
*/
|
*/
|
||||||
static int permute_argv_once()
|
int getopt(int argc, char* const argv[], const char* optstring) {
|
||||||
{
|
int optchar = -1;
|
||||||
/* Movability check */
|
const char* optdecl = NULL;
|
||||||
if(argv_index + nonopt >= prev_argc) return 1;
|
|
||||||
/* Move the current option to the end, bring the others to front */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char* tmp = prev_argv[argv_index];
|
|
||||||
|
|
||||||
/* Move the data */
|
|
||||||
memmove(&prev_argv[argv_index], &prev_argv[argv_index+1],
|
|
||||||
sizeof(char**) * (prev_argc - argv_index - 1));
|
|
||||||
prev_argv[prev_argc - 1] = tmp;
|
|
||||||
|
|
||||||
nonopt++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int getopt(int argc, char** argv, const char* optstr)
|
|
||||||
{
|
|
||||||
int c = 0;
|
|
||||||
|
|
||||||
/* If we have new argv, reinitialize */
|
|
||||||
if(prev_argv != argv || prev_argc != argc)
|
|
||||||
{
|
|
||||||
/* Initialize variables */
|
|
||||||
prev_argv = argv;
|
|
||||||
prev_argc = argc;
|
|
||||||
argv_index = 1;
|
|
||||||
argv_index2 = 1;
|
|
||||||
opt_offset = 1;
|
|
||||||
dashdash = 0;
|
|
||||||
nonopt = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Jump point in case we want to ignore the current argv_index */
|
|
||||||
getopt_top:
|
|
||||||
|
|
||||||
/* Misc. initializations */
|
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
|
opterr = 0;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
/* Dash-dash check */
|
/* Unspecified, but we need it to avoid overrunning the argv bounds. */
|
||||||
if(argv[argv_index] && !strcmp(argv[argv_index], "--"))
|
if (optind >= argc)
|
||||||
{
|
goto no_more_optchars;
|
||||||
dashdash = 1;
|
|
||||||
increment_index();
|
/* If, when getopt() is called argv[optind] is a null pointer, getopt()
|
||||||
|
shall return -1 without changing optind. */
|
||||||
|
if (argv[optind] == NULL)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called *argv[optind] is not the character '-',
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (*argv[optind] != '-')
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "-",
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (strcmp(argv[optind], "-") == 0)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "--",
|
||||||
|
getopt() shall return -1 after incrementing optind. */
|
||||||
|
if (strcmp(argv[optind], "--") == 0) {
|
||||||
|
++optind;
|
||||||
|
goto no_more_optchars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're at the end of argv, that's it. */
|
if (optcursor == NULL || *optcursor == '\0')
|
||||||
if(argv[argv_index] == NULL)
|
optcursor = argv[optind] + 1;
|
||||||
{
|
|
||||||
c = -1;
|
|
||||||
}
|
|
||||||
/* Are we looking at a string? Single dash is also a string */
|
|
||||||
else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-"))
|
|
||||||
{
|
|
||||||
/* If we want a string... */
|
|
||||||
if(optstr[0] == '-')
|
|
||||||
{
|
|
||||||
c = 1;
|
|
||||||
optarg = argv[argv_index];
|
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
/* If we really don't want it (we're in POSIX mode), we're done */
|
|
||||||
else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT"))
|
|
||||||
{
|
|
||||||
c = -1;
|
|
||||||
|
|
||||||
/* Everything else is a non-opt argument */
|
optchar = *optcursor;
|
||||||
nonopt = argc - argv_index;
|
|
||||||
}
|
|
||||||
/* If we mildly don't want it, then move it back */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!permute_argv_once()) goto getopt_top;
|
|
||||||
else c = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Otherwise we're looking at an option */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char* opt_ptr = NULL;
|
|
||||||
|
|
||||||
/* Grab the option */
|
/* FreeBSD: The variable optopt saves the last known option character
|
||||||
c = argv[argv_index][opt_offset++];
|
returned by getopt(). */
|
||||||
|
optopt = optchar;
|
||||||
|
|
||||||
/* Is the option in the optstr? */
|
/* The getopt() function shall return the next option character (if one is
|
||||||
if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c);
|
found) from argv that matches a character in optstring, if there is
|
||||||
else opt_ptr = strchr(optstr, c);
|
one that matches. */
|
||||||
/* Invalid argument */
|
optdecl = strchr(optstring, optchar);
|
||||||
if(!opt_ptr)
|
if (optdecl) {
|
||||||
{
|
/* [I]f a character is followed by a colon, the option takes an
|
||||||
if(opterr)
|
argument. */
|
||||||
{
|
if (optdecl[1] == ':') {
|
||||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
optarg = ++optcursor;
|
||||||
}
|
if (*optarg == '\0') {
|
||||||
|
/* GNU extension: Two colons mean an option takes an
|
||||||
|
optional arg; if there is text in the current argv-element
|
||||||
|
(i.e., in the same word as the option name itself, for example,
|
||||||
|
"-oarg"), then it is returned in optarg, otherwise optarg is set
|
||||||
|
to zero. */
|
||||||
|
if (optdecl[2] != ':') {
|
||||||
|
/* If the option was the last character in the string pointed to by
|
||||||
|
an element of argv, then optarg shall contain the next element
|
||||||
|
of argv, and optind shall be incremented by 2. If the resulting
|
||||||
|
value of optind is greater than argc, this indicates a missing
|
||||||
|
option-argument, and getopt() shall return an error indication.
|
||||||
|
|
||||||
optopt = c;
|
Otherwise, optarg shall point to the string following the
|
||||||
c = '?';
|
option character in that element of argv, and optind shall be
|
||||||
|
incremented by 1.
|
||||||
/* Move onto the next option */
|
*/
|
||||||
increment_index();
|
if (++optind < argc) {
|
||||||
}
|
optarg = argv[optind];
|
||||||
/* Option takes argument */
|
} else {
|
||||||
else if(opt_ptr[1] == ':')
|
/* If it detects a missing option-argument, it shall return the
|
||||||
{
|
colon character ( ':' ) if the first character of optstring
|
||||||
/* ie, -oARGUMENT, -xxxoARGUMENT, etc. */
|
was a colon, or a question-mark character ( '?' ) otherwise.
|
||||||
if(argv[argv_index][opt_offset] != '\0')
|
*/
|
||||||
{
|
optarg = NULL;
|
||||||
optarg = &argv[argv_index][opt_offset];
|
optchar = (optstring[0] == ':') ? ':' : '?';
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
/* ie, -o ARGUMENT (only if it's a required argument) */
|
|
||||||
else if(opt_ptr[2] != ':')
|
|
||||||
{
|
|
||||||
/* One of those "you're not expected to understand this" moment */
|
|
||||||
if(argv_index2 < argv_index) argv_index2 = argv_index;
|
|
||||||
while(argv[++argv_index2] && argv[argv_index2][0] == '-');
|
|
||||||
optarg = argv[argv_index2];
|
|
||||||
|
|
||||||
/* Don't cross into the non-option argument list */
|
|
||||||
if(argv_index2 + nonopt >= prev_argc) optarg = NULL;
|
|
||||||
|
|
||||||
/* Move onto the next option */
|
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Move onto the next option */
|
|
||||||
increment_index();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* In case we got no argument for an option with required argument */
|
|
||||||
if(optarg == NULL && opt_ptr[2] != ':')
|
|
||||||
{
|
|
||||||
optopt = c;
|
|
||||||
c = '?';
|
|
||||||
|
|
||||||
if(opterr)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"%s: option requires an argument -- %c\n",
|
|
||||||
argv[0], optopt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Option does not take argument */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Next argv_index */
|
|
||||||
if(argv[argv_index][opt_offset] == '\0')
|
|
||||||
{
|
|
||||||
increment_index();
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
optarg = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate optind */
|
optcursor = NULL;
|
||||||
if(c == -1)
|
|
||||||
{
|
|
||||||
optind = argc - nonopt;
|
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
/* If getopt() encounters an option character that is not contained in
|
||||||
optind = argv_index;
|
optstring, it shall return the question-mark ( '?' ) character. */
|
||||||
|
optchar = '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
if (optcursor == NULL || *++optcursor == '\0')
|
||||||
|
++optind;
|
||||||
|
|
||||||
|
return optchar;
|
||||||
|
|
||||||
|
no_more_optchars:
|
||||||
|
optcursor = NULL;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implementation based on [1].
|
||||||
|
|
||||||
/* vim:ts=3
|
[1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
*/
|
*/
|
||||||
|
int getopt_long(int argc, char* const argv[], const char* optstring,
|
||||||
|
const struct option* longopts, int* longindex) {
|
||||||
|
const struct option* o = longopts;
|
||||||
|
const struct option* match = NULL;
|
||||||
|
int num_matches = 0;
|
||||||
|
size_t argument_name_length = 0;
|
||||||
|
const char* current_argument = NULL;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
|
if (optind >= argc)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (strlen(argv[optind]) < 3 || strncmp(argv[optind], "--", 2) != 0)
|
||||||
|
return getopt(argc, argv, optstring);
|
||||||
|
|
||||||
|
/* It's an option; starts with -- and is longer than two chars. */
|
||||||
|
current_argument = argv[optind] + 2;
|
||||||
|
argument_name_length = strcspn(current_argument, "=");
|
||||||
|
for (; o->name; ++o) {
|
||||||
|
if (strncmp(o->name, current_argument, argument_name_length) == 0) {
|
||||||
|
match = o;
|
||||||
|
++num_matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_matches == 1) {
|
||||||
|
/* If longindex is not NULL, it points to a variable which is set to the
|
||||||
|
index of the long option relative to longopts. */
|
||||||
|
if (longindex)
|
||||||
|
*longindex = (match - longopts);
|
||||||
|
|
||||||
|
/* If flag is NULL, then getopt_long() shall return val.
|
||||||
|
Otherwise, getopt_long() returns 0, and flag shall point to a variable
|
||||||
|
which shall be set to val if the option is found, but left unchanged if
|
||||||
|
the option is not found. */
|
||||||
|
if (match->flag)
|
||||||
|
*(match->flag) = match->val;
|
||||||
|
|
||||||
|
retval = match->flag ? 0 : match->val;
|
||||||
|
|
||||||
|
if (match->has_arg != no_argument) {
|
||||||
|
optarg = strchr(argv[optind], '=');
|
||||||
|
if (optarg != NULL)
|
||||||
|
++optarg;
|
||||||
|
|
||||||
|
if (match->has_arg == required_argument) {
|
||||||
|
/* Only scan the next argv for required arguments. Behavior is not
|
||||||
|
specified, but has been observed with Ubuntu and Mac OSX. */
|
||||||
|
if (optarg == NULL && ++optind < argc) {
|
||||||
|
optarg = argv[optind];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optarg == NULL)
|
||||||
|
retval = ':';
|
||||||
|
}
|
||||||
|
} else if (strchr(argv[optind], '=')) {
|
||||||
|
/* An argument was provided to a non-argument option.
|
||||||
|
I haven't seen this specified explicitly, but both GNU and BSD-based
|
||||||
|
implementations show this behavior.
|
||||||
|
*/
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Unknown option or ambiguous match. */
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
++optind;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
94
deps/getopt.h
vendored
94
deps/getopt.h
vendored
@ -1,63 +1,57 @@
|
|||||||
/*****************************************************************************
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
* getopt.h - competent and free getopt library.
|
* All rights reserved.
|
||||||
* $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $
|
*
|
||||||
*
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* Copyright (c)2002-2003 Mark K. Kim
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* All rights reserved.
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
*
|
* this list of conditions and the following disclaimer.
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* modification, are permitted provided that the following conditions
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* are met:
|
* and/or other materials provided with the distribution.
|
||||||
*
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
* * Redistributions of source code must retain the above copyright
|
* to endorse or promote products derived from this software without specific
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* prior written permission.
|
||||||
*
|
*
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* the documentation and/or other materials provided with the
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* distribution.
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
*
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* * Neither the original author of this software nor the names of its
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* contributors may be used to endorse or promote products derived
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* from this software without specific prior written permission.
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
*
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
*/
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
||||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
* DAMAGE.
|
|
||||||
*/
|
|
||||||
#ifndef GETOPT_H_
|
|
||||||
#define GETOPT_H_
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GETOPT_PORT_H
|
||||||
|
#define INCLUDED_GETOPT_PORT_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern const int no_argument;
|
||||||
|
extern const int required_argument;
|
||||||
|
extern const int optional_argument;
|
||||||
|
|
||||||
extern char* optarg;
|
extern char* optarg;
|
||||||
extern int optind;
|
extern int optind, opterr, optopt;
|
||||||
extern int opterr;
|
|
||||||
extern int optopt;
|
|
||||||
|
|
||||||
int getopt(int argc, char** argv, const char* optstr);
|
struct option {
|
||||||
|
const char* name;
|
||||||
|
int has_arg;
|
||||||
|
int* flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
int getopt(int argc, char* const argv[], const char* optstring);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
int getopt_long(int argc, char* const argv[],
|
||||||
|
const char* optstring, const struct option* longopts, int* longindex);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // INCLUDED_GETOPT_PORT_H
|
||||||
#endif /* GETOPT_H_ */
|
|
||||||
|
|
||||||
|
|
||||||
/* vim:ts=3
|
|
||||||
*/
|
|
||||||
|
722
deps/glad.c
vendored
Normal file
722
deps/glad.c
vendored
Normal file
@ -0,0 +1,722 @@
|
|||||||
|
#include <string.h>
|
||||||
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
int GLAD_GL_VERSION_1_0;
|
||||||
|
int GLAD_GL_VERSION_1_1;
|
||||||
|
int GLAD_GL_VERSION_1_2;
|
||||||
|
int GLAD_GL_VERSION_1_3;
|
||||||
|
int GLAD_GL_VERSION_1_4;
|
||||||
|
int GLAD_GL_VERSION_1_5;
|
||||||
|
int GLAD_GL_VERSION_2_0;
|
||||||
|
int GLAD_GL_VERSION_2_1;
|
||||||
|
int GLAD_GL_VERSION_3_0;
|
||||||
|
int GLAD_GL_VERSION_3_1;
|
||||||
|
int GLAD_GL_VERSION_3_2;
|
||||||
|
PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays;
|
||||||
|
PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;
|
||||||
|
PFNGLFLUSHPROC glad_glFlush;
|
||||||
|
PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D;
|
||||||
|
PFNGLCLEARCOLORPROC glad_glClearColor;
|
||||||
|
PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui;
|
||||||
|
PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex;
|
||||||
|
PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv;
|
||||||
|
PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv;
|
||||||
|
PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;
|
||||||
|
PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;
|
||||||
|
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;
|
||||||
|
PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation;
|
||||||
|
PFNGLLINKPROGRAMPROC glad_glLinkProgram;
|
||||||
|
PFNGLBINDTEXTUREPROC glad_glBindTexture;
|
||||||
|
PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName;
|
||||||
|
PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv;
|
||||||
|
PFNGLFENCESYNCPROC glad_glFenceSync;
|
||||||
|
PFNGLUNIFORM3UIPROC glad_glUniform3ui;
|
||||||
|
PFNGLUNIFORM2UIVPROC glad_glUniform2uiv;
|
||||||
|
PFNGLGETSTRINGPROC glad_glGetString;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D;
|
||||||
|
PFNGLDETACHSHADERPROC glad_glDetachShader;
|
||||||
|
PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv;
|
||||||
|
PFNGLGENBUFFERSPROC glad_glGenBuffers;
|
||||||
|
PFNGLENDQUERYPROC glad_glEndQuery;
|
||||||
|
PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv;
|
||||||
|
PFNGLLINEWIDTHPROC glad_glLineWidth;
|
||||||
|
PFNGLUNIFORM2FVPROC glad_glUniform2fv;
|
||||||
|
PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced;
|
||||||
|
PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v;
|
||||||
|
PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;
|
||||||
|
PFNGLCOMPILESHADERPROC glad_glCompileShader;
|
||||||
|
PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying;
|
||||||
|
PFNGLDELETETEXTURESPROC glad_glDeleteTextures;
|
||||||
|
PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;
|
||||||
|
PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;
|
||||||
|
PFNGLPOLYGONMODEPROC glad_glPolygonMode;
|
||||||
|
PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange;
|
||||||
|
PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;
|
||||||
|
PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;
|
||||||
|
PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d;
|
||||||
|
PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;
|
||||||
|
PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v;
|
||||||
|
PFNGLISSYNCPROC glad_glIsSync;
|
||||||
|
PFNGLCLAMPCOLORPROC glad_glClampColor;
|
||||||
|
PFNGLUNIFORM4IVPROC glad_glUniform4iv;
|
||||||
|
PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;
|
||||||
|
PFNGLCLEARSTENCILPROC glad_glClearStencil;
|
||||||
|
PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture;
|
||||||
|
PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv;
|
||||||
|
PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s;
|
||||||
|
PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex;
|
||||||
|
PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv;
|
||||||
|
PFNGLENABLEIPROC glad_glEnablei;
|
||||||
|
PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;
|
||||||
|
PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv;
|
||||||
|
PFNGLGENTEXTURESPROC glad_glGenTextures;
|
||||||
|
PFNGLDEPTHFUNCPROC glad_glDepthFunc;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;
|
||||||
|
PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;
|
||||||
|
PFNGLUNIFORM1FPROC glad_glUniform1f;
|
||||||
|
PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;
|
||||||
|
PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv;
|
||||||
|
PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv;
|
||||||
|
PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;
|
||||||
|
PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage;
|
||||||
|
PFNGLISVERTEXARRAYPROC glad_glIsVertexArray;
|
||||||
|
PFNGLCREATESHADERPROC glad_glCreateShader;
|
||||||
|
PFNGLISBUFFERPROC glad_glIsBuffer;
|
||||||
|
PFNGLUNIFORM1IPROC glad_glUniform1i;
|
||||||
|
PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s;
|
||||||
|
PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;
|
||||||
|
PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv;
|
||||||
|
PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;
|
||||||
|
PFNGLDISABLEPROC glad_glDisable;
|
||||||
|
PFNGLUNIFORM2IPROC glad_glUniform2i;
|
||||||
|
PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;
|
||||||
|
PFNGLLOGICOPPROC glad_glLogicOp;
|
||||||
|
PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv;
|
||||||
|
PFNGLGETPROGRAMIVPROC glad_glGetProgramiv;
|
||||||
|
PFNGLCOLORMASKPROC glad_glColorMask;
|
||||||
|
PFNGLHINTPROC glad_glHint;
|
||||||
|
PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer;
|
||||||
|
PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv;
|
||||||
|
PFNGLBLENDEQUATIONPROC glad_glBlendEquation;
|
||||||
|
PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;
|
||||||
|
PFNGLSAMPLEMASKIPROC glad_glSampleMaski;
|
||||||
|
PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;
|
||||||
|
PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;
|
||||||
|
PFNGLCULLFACEPROC glad_glCullFace;
|
||||||
|
PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv;
|
||||||
|
PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv;
|
||||||
|
PFNGLUNIFORM4FVPROC glad_glUniform4fv;
|
||||||
|
PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv;
|
||||||
|
PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;
|
||||||
|
PFNGLUNIFORM1UIVPROC glad_glUniform1uiv;
|
||||||
|
PFNGLPOINTSIZEPROC glad_glPointSize;
|
||||||
|
PFNGLGETSTRINGIPROC glad_glGetStringi;
|
||||||
|
PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv;
|
||||||
|
PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv;
|
||||||
|
PFNGLDELETEPROGRAMPROC glad_glDeleteProgram;
|
||||||
|
PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv;
|
||||||
|
PFNGLGENQUERIESPROC glad_glGenQueries;
|
||||||
|
PFNGLWAITSYNCPROC glad_glWaitSync;
|
||||||
|
PFNGLATTACHSHADERPROC glad_glAttachShader;
|
||||||
|
PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;
|
||||||
|
PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;
|
||||||
|
PFNGLUNIFORM3IPROC glad_glUniform3i;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D;
|
||||||
|
PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex;
|
||||||
|
PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;
|
||||||
|
PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D;
|
||||||
|
PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v;
|
||||||
|
PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex;
|
||||||
|
PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv;
|
||||||
|
PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;
|
||||||
|
PFNGLUNIFORM3FPROC glad_glUniform3f;
|
||||||
|
PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv;
|
||||||
|
PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;
|
||||||
|
PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv;
|
||||||
|
PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;
|
||||||
|
PFNGLDRAWELEMENTSPROC glad_glDrawElements;
|
||||||
|
PFNGLCOLORMASKIPROC glad_glColorMaski;
|
||||||
|
PFNGLISENABLEDIPROC glad_glIsEnabledi;
|
||||||
|
PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv;
|
||||||
|
PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements;
|
||||||
|
PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv;
|
||||||
|
PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays;
|
||||||
|
PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase;
|
||||||
|
PFNGLBUFFERSUBDATAPROC glad_glBufferSubData;
|
||||||
|
PFNGLUNIFORM1IVPROC glad_glUniform1iv;
|
||||||
|
PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv;
|
||||||
|
PFNGLUNIFORM4UIVPROC glad_glUniform4uiv;
|
||||||
|
PFNGLREADBUFFERPROC glad_glReadBuffer;
|
||||||
|
PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData;
|
||||||
|
PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray;
|
||||||
|
PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync;
|
||||||
|
PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;
|
||||||
|
PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv;
|
||||||
|
PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui;
|
||||||
|
PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;
|
||||||
|
PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D;
|
||||||
|
PFNGLGETSHADERIVPROC glad_glGetShaderiv;
|
||||||
|
PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv;
|
||||||
|
PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv;
|
||||||
|
PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;
|
||||||
|
PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv;
|
||||||
|
PFNGLPOINTPARAMETERIPROC glad_glPointParameteri;
|
||||||
|
PFNGLBLENDCOLORPROC glad_glBlendColor;
|
||||||
|
PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;
|
||||||
|
PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer;
|
||||||
|
PFNGLDEPTHMASKPROC glad_glDepthMask;
|
||||||
|
PFNGLPOINTPARAMETERFPROC glad_glPointParameterf;
|
||||||
|
PFNGLDISABLEIPROC glad_glDisablei;
|
||||||
|
PFNGLGETDOUBLEVPROC glad_glGetDoublev;
|
||||||
|
PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv;
|
||||||
|
PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv;
|
||||||
|
PFNGLSHADERSOURCEPROC glad_glShaderSource;
|
||||||
|
PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;
|
||||||
|
PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv;
|
||||||
|
PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv;
|
||||||
|
PFNGLDRAWARRAYSPROC glad_glDrawArrays;
|
||||||
|
PFNGLUNIFORM1UIPROC glad_glUniform1ui;
|
||||||
|
PFNGLISPROGRAMPROC glad_glIsProgram;
|
||||||
|
PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;
|
||||||
|
PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation;
|
||||||
|
PFNGLGETSYNCIVPROC glad_glGetSynciv;
|
||||||
|
PFNGLGETUNIFORMIVPROC glad_glGetUniformiv;
|
||||||
|
PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i;
|
||||||
|
PFNGLUNIFORM4IPROC glad_glUniform4i;
|
||||||
|
PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d;
|
||||||
|
PFNGLCLEARPROC glad_glClear;
|
||||||
|
PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;
|
||||||
|
PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName;
|
||||||
|
PFNGLUNIFORM2FPROC glad_glUniform2f;
|
||||||
|
PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample;
|
||||||
|
PFNGLACTIVETEXTUREPROC glad_glActiveTexture;
|
||||||
|
PFNGLBEGINQUERYPROC glad_glBeginQuery;
|
||||||
|
PFNGLUNIFORM2IVPROC glad_glUniform2iv;
|
||||||
|
PFNGLBINDBUFFERPROC glad_glBindBuffer;
|
||||||
|
PFNGLISENABLEDPROC glad_glIsEnabled;
|
||||||
|
PFNGLSTENCILOPPROC glad_glStencilOp;
|
||||||
|
PFNGLREADPIXELSPROC glad_glReadPixels;
|
||||||
|
PFNGLCLEARDEPTHPROC glad_glClearDepth;
|
||||||
|
PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv;
|
||||||
|
PFNGLUNIFORM4FPROC glad_glUniform4f;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;
|
||||||
|
PFNGLMAPBUFFERPROC glad_glMapBuffer;
|
||||||
|
PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d;
|
||||||
|
PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub;
|
||||||
|
PFNGLUNIFORM3FVPROC glad_glUniform3fv;
|
||||||
|
PFNGLGETUNIFORMFVPROC glad_glGetUniformfv;
|
||||||
|
PFNGLBUFFERDATAPROC glad_glBufferData;
|
||||||
|
PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D;
|
||||||
|
PFNGLTEXIMAGE1DPROC glad_glTexImage1D;
|
||||||
|
PFNGLDELETESYNCPROC glad_glDeleteSync;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D;
|
||||||
|
PFNGLGETERRORPROC glad_glGetError;
|
||||||
|
PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;
|
||||||
|
PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;
|
||||||
|
PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;
|
||||||
|
PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements;
|
||||||
|
PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;
|
||||||
|
PFNGLGETFLOATVPROC glad_glGetFloatv;
|
||||||
|
PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D;
|
||||||
|
PFNGLUNIFORM3IVPROC glad_glUniform3iv;
|
||||||
|
PFNGLGETTEXIMAGEPROC glad_glGetTexImage;
|
||||||
|
PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;
|
||||||
|
PFNGLUSEPROGRAMPROC glad_glUseProgram;
|
||||||
|
PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv;
|
||||||
|
PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;
|
||||||
|
PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i;
|
||||||
|
PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;
|
||||||
|
PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;
|
||||||
|
PFNGLDRAWBUFFERSPROC glad_glDrawBuffers;
|
||||||
|
PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv;
|
||||||
|
PFNGLSTENCILFUNCPROC glad_glStencilFunc;
|
||||||
|
PFNGLGETINTEGERVPROC glad_glGetIntegerv;
|
||||||
|
PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;
|
||||||
|
PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding;
|
||||||
|
PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;
|
||||||
|
PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv;
|
||||||
|
PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv;
|
||||||
|
PFNGLDRAWBUFFERPROC glad_glDrawBuffer;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D;
|
||||||
|
PFNGLUNIFORM1FVPROC glad_glUniform1fv;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample;
|
||||||
|
PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange;
|
||||||
|
PFNGLISQUERYPROC glad_glIsQuery;
|
||||||
|
PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv;
|
||||||
|
PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;
|
||||||
|
PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;
|
||||||
|
PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv;
|
||||||
|
PFNGLGETQUERYIVPROC glad_glGetQueryiv;
|
||||||
|
PFNGLTEXIMAGE2DPROC glad_glTexImage2D;
|
||||||
|
PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;
|
||||||
|
PFNGLSTENCILMASKPROC glad_glStencilMask;
|
||||||
|
PFNGLUNIFORM4UIPROC glad_glUniform4ui;
|
||||||
|
PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv;
|
||||||
|
PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;
|
||||||
|
PFNGLISTEXTUREPROC glad_glIsTexture;
|
||||||
|
PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices;
|
||||||
|
PFNGLISSHADERPROC glad_glIsShader;
|
||||||
|
PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;
|
||||||
|
PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv;
|
||||||
|
PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv;
|
||||||
|
PFNGLGETINTEGER64VPROC glad_glGetInteger64v;
|
||||||
|
PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;
|
||||||
|
PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;
|
||||||
|
PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData;
|
||||||
|
PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;
|
||||||
|
PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv;
|
||||||
|
PFNGLENABLEPROC glad_glEnable;
|
||||||
|
PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv;
|
||||||
|
PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced;
|
||||||
|
PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i;
|
||||||
|
PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;
|
||||||
|
PFNGLDELETEQUERIESPROC glad_glDeleteQueries;
|
||||||
|
PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv;
|
||||||
|
PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;
|
||||||
|
PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D;
|
||||||
|
PFNGLFINISHPROC glad_glFinish;
|
||||||
|
PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;
|
||||||
|
PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv;
|
||||||
|
PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv;
|
||||||
|
PFNGLDELETESHADERPROC glad_glDeleteShader;
|
||||||
|
PFNGLBLENDFUNCPROC glad_glBlendFunc;
|
||||||
|
PFNGLCREATEPROGRAMPROC glad_glCreateProgram;
|
||||||
|
PFNGLTEXIMAGE3DPROC glad_glTexImage3D;
|
||||||
|
PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv;
|
||||||
|
PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;
|
||||||
|
PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui;
|
||||||
|
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange;
|
||||||
|
PFNGLVIEWPORTPROC glad_glViewport;
|
||||||
|
PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv;
|
||||||
|
PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d;
|
||||||
|
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings;
|
||||||
|
PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;
|
||||||
|
PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv;
|
||||||
|
PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex;
|
||||||
|
PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex;
|
||||||
|
PFNGLUNIFORM2UIPROC glad_glUniform2ui;
|
||||||
|
PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;
|
||||||
|
PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv;
|
||||||
|
PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i;
|
||||||
|
PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s;
|
||||||
|
PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample;
|
||||||
|
PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;
|
||||||
|
PFNGLDEPTHRANGEPROC glad_glDepthRange;
|
||||||
|
PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;
|
||||||
|
PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv;
|
||||||
|
PFNGLTEXPARAMETERFPROC glad_glTexParameterf;
|
||||||
|
PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi;
|
||||||
|
PFNGLTEXPARAMETERIPROC glad_glTexParameteri;
|
||||||
|
PFNGLFRONTFACEPROC glad_glFrontFace;
|
||||||
|
PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;
|
||||||
|
PFNGLSCISSORPROC glad_glScissor;
|
||||||
|
PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex;
|
||||||
|
PFNGLGETBOOLEANVPROC glad_glGetBooleanv;
|
||||||
|
PFNGLTEXBUFFERPROC glad_glTexBuffer;
|
||||||
|
PFNGLPIXELSTOREIPROC glad_glPixelStorei;
|
||||||
|
PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;
|
||||||
|
PFNGLPIXELSTOREFPROC glad_glPixelStoref;
|
||||||
|
PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;
|
||||||
|
PFNGLUNIFORM3UIVPROC glad_glUniform3uiv;
|
||||||
|
PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;
|
||||||
|
PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer;
|
||||||
|
static void load_GL_VERSION_1_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_0) return;
|
||||||
|
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
|
||||||
|
glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace");
|
||||||
|
glad_glHint = (PFNGLHINTPROC)load("glHint");
|
||||||
|
glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth");
|
||||||
|
glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize");
|
||||||
|
glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode");
|
||||||
|
glad_glScissor = (PFNGLSCISSORPROC)load("glScissor");
|
||||||
|
glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf");
|
||||||
|
glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv");
|
||||||
|
glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri");
|
||||||
|
glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv");
|
||||||
|
glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D");
|
||||||
|
glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D");
|
||||||
|
glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer");
|
||||||
|
glad_glClear = (PFNGLCLEARPROC)load("glClear");
|
||||||
|
glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor");
|
||||||
|
glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil");
|
||||||
|
glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth");
|
||||||
|
glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask");
|
||||||
|
glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask");
|
||||||
|
glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask");
|
||||||
|
glad_glDisable = (PFNGLDISABLEPROC)load("glDisable");
|
||||||
|
glad_glEnable = (PFNGLENABLEPROC)load("glEnable");
|
||||||
|
glad_glFinish = (PFNGLFINISHPROC)load("glFinish");
|
||||||
|
glad_glFlush = (PFNGLFLUSHPROC)load("glFlush");
|
||||||
|
glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc");
|
||||||
|
glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp");
|
||||||
|
glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc");
|
||||||
|
glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp");
|
||||||
|
glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc");
|
||||||
|
glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref");
|
||||||
|
glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei");
|
||||||
|
glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer");
|
||||||
|
glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels");
|
||||||
|
glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv");
|
||||||
|
glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev");
|
||||||
|
glad_glGetError = (PFNGLGETERRORPROC)load("glGetError");
|
||||||
|
glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv");
|
||||||
|
glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv");
|
||||||
|
glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
|
||||||
|
glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage");
|
||||||
|
glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv");
|
||||||
|
glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv");
|
||||||
|
glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv");
|
||||||
|
glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv");
|
||||||
|
glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled");
|
||||||
|
glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange");
|
||||||
|
glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_1) return;
|
||||||
|
glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays");
|
||||||
|
glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements");
|
||||||
|
glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset");
|
||||||
|
glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D");
|
||||||
|
glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D");
|
||||||
|
glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D");
|
||||||
|
glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D");
|
||||||
|
glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D");
|
||||||
|
glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D");
|
||||||
|
glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture");
|
||||||
|
glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures");
|
||||||
|
glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures");
|
||||||
|
glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_2(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_2) return;
|
||||||
|
glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements");
|
||||||
|
glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D");
|
||||||
|
glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D");
|
||||||
|
glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_3(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_3) return;
|
||||||
|
glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture");
|
||||||
|
glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage");
|
||||||
|
glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D");
|
||||||
|
glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D");
|
||||||
|
glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D");
|
||||||
|
glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D");
|
||||||
|
glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D");
|
||||||
|
glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D");
|
||||||
|
glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_4(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_4) return;
|
||||||
|
glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate");
|
||||||
|
glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays");
|
||||||
|
glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements");
|
||||||
|
glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf");
|
||||||
|
glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv");
|
||||||
|
glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri");
|
||||||
|
glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv");
|
||||||
|
glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor");
|
||||||
|
glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_5(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_5) return;
|
||||||
|
glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries");
|
||||||
|
glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries");
|
||||||
|
glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery");
|
||||||
|
glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery");
|
||||||
|
glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery");
|
||||||
|
glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv");
|
||||||
|
glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv");
|
||||||
|
glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv");
|
||||||
|
glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer");
|
||||||
|
glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers");
|
||||||
|
glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers");
|
||||||
|
glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer");
|
||||||
|
glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData");
|
||||||
|
glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData");
|
||||||
|
glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData");
|
||||||
|
glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer");
|
||||||
|
glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer");
|
||||||
|
glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv");
|
||||||
|
glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_2_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_2_0) return;
|
||||||
|
glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate");
|
||||||
|
glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers");
|
||||||
|
glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate");
|
||||||
|
glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate");
|
||||||
|
glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate");
|
||||||
|
glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader");
|
||||||
|
glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation");
|
||||||
|
glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader");
|
||||||
|
glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram");
|
||||||
|
glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader");
|
||||||
|
glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram");
|
||||||
|
glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader");
|
||||||
|
glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader");
|
||||||
|
glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray");
|
||||||
|
glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray");
|
||||||
|
glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib");
|
||||||
|
glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform");
|
||||||
|
glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders");
|
||||||
|
glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation");
|
||||||
|
glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv");
|
||||||
|
glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog");
|
||||||
|
glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv");
|
||||||
|
glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog");
|
||||||
|
glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource");
|
||||||
|
glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation");
|
||||||
|
glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv");
|
||||||
|
glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv");
|
||||||
|
glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv");
|
||||||
|
glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv");
|
||||||
|
glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv");
|
||||||
|
glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv");
|
||||||
|
glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram");
|
||||||
|
glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader");
|
||||||
|
glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram");
|
||||||
|
glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource");
|
||||||
|
glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram");
|
||||||
|
glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f");
|
||||||
|
glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f");
|
||||||
|
glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f");
|
||||||
|
glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f");
|
||||||
|
glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i");
|
||||||
|
glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i");
|
||||||
|
glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i");
|
||||||
|
glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i");
|
||||||
|
glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv");
|
||||||
|
glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv");
|
||||||
|
glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv");
|
||||||
|
glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv");
|
||||||
|
glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv");
|
||||||
|
glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv");
|
||||||
|
glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv");
|
||||||
|
glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv");
|
||||||
|
glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv");
|
||||||
|
glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv");
|
||||||
|
glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv");
|
||||||
|
glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram");
|
||||||
|
glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d");
|
||||||
|
glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv");
|
||||||
|
glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f");
|
||||||
|
glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv");
|
||||||
|
glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s");
|
||||||
|
glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv");
|
||||||
|
glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d");
|
||||||
|
glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv");
|
||||||
|
glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f");
|
||||||
|
glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv");
|
||||||
|
glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s");
|
||||||
|
glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv");
|
||||||
|
glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d");
|
||||||
|
glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv");
|
||||||
|
glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f");
|
||||||
|
glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv");
|
||||||
|
glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s");
|
||||||
|
glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv");
|
||||||
|
glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv");
|
||||||
|
glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv");
|
||||||
|
glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv");
|
||||||
|
glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub");
|
||||||
|
glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv");
|
||||||
|
glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv");
|
||||||
|
glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv");
|
||||||
|
glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv");
|
||||||
|
glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d");
|
||||||
|
glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv");
|
||||||
|
glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f");
|
||||||
|
glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv");
|
||||||
|
glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv");
|
||||||
|
glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s");
|
||||||
|
glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv");
|
||||||
|
glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv");
|
||||||
|
glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv");
|
||||||
|
glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv");
|
||||||
|
glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_2_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_2_1) return;
|
||||||
|
glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv");
|
||||||
|
glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv");
|
||||||
|
glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv");
|
||||||
|
glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv");
|
||||||
|
glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv");
|
||||||
|
glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_0) return;
|
||||||
|
glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski");
|
||||||
|
glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v");
|
||||||
|
glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v");
|
||||||
|
glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei");
|
||||||
|
glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei");
|
||||||
|
glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi");
|
||||||
|
glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback");
|
||||||
|
glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback");
|
||||||
|
glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange");
|
||||||
|
glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase");
|
||||||
|
glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings");
|
||||||
|
glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying");
|
||||||
|
glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor");
|
||||||
|
glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender");
|
||||||
|
glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender");
|
||||||
|
glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer");
|
||||||
|
glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv");
|
||||||
|
glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv");
|
||||||
|
glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i");
|
||||||
|
glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i");
|
||||||
|
glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i");
|
||||||
|
glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i");
|
||||||
|
glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui");
|
||||||
|
glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui");
|
||||||
|
glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui");
|
||||||
|
glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui");
|
||||||
|
glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv");
|
||||||
|
glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv");
|
||||||
|
glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv");
|
||||||
|
glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv");
|
||||||
|
glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv");
|
||||||
|
glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv");
|
||||||
|
glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv");
|
||||||
|
glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv");
|
||||||
|
glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv");
|
||||||
|
glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv");
|
||||||
|
glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv");
|
||||||
|
glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv");
|
||||||
|
glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv");
|
||||||
|
glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation");
|
||||||
|
glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation");
|
||||||
|
glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui");
|
||||||
|
glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui");
|
||||||
|
glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui");
|
||||||
|
glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui");
|
||||||
|
glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv");
|
||||||
|
glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv");
|
||||||
|
glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv");
|
||||||
|
glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv");
|
||||||
|
glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv");
|
||||||
|
glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv");
|
||||||
|
glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv");
|
||||||
|
glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv");
|
||||||
|
glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv");
|
||||||
|
glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv");
|
||||||
|
glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv");
|
||||||
|
glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi");
|
||||||
|
glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi");
|
||||||
|
glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer");
|
||||||
|
glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer");
|
||||||
|
glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers");
|
||||||
|
glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers");
|
||||||
|
glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage");
|
||||||
|
glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv");
|
||||||
|
glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer");
|
||||||
|
glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer");
|
||||||
|
glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers");
|
||||||
|
glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers");
|
||||||
|
glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus");
|
||||||
|
glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D");
|
||||||
|
glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D");
|
||||||
|
glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D");
|
||||||
|
glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer");
|
||||||
|
glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv");
|
||||||
|
glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap");
|
||||||
|
glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer");
|
||||||
|
glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample");
|
||||||
|
glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer");
|
||||||
|
glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange");
|
||||||
|
glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange");
|
||||||
|
glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray");
|
||||||
|
glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays");
|
||||||
|
glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays");
|
||||||
|
glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_1) return;
|
||||||
|
glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced");
|
||||||
|
glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced");
|
||||||
|
glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer");
|
||||||
|
glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex");
|
||||||
|
glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData");
|
||||||
|
glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices");
|
||||||
|
glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv");
|
||||||
|
glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName");
|
||||||
|
glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex");
|
||||||
|
glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv");
|
||||||
|
glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName");
|
||||||
|
glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_2(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_2) return;
|
||||||
|
glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex");
|
||||||
|
glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex");
|
||||||
|
glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex");
|
||||||
|
glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex");
|
||||||
|
glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex");
|
||||||
|
glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync");
|
||||||
|
glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync");
|
||||||
|
glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync");
|
||||||
|
glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync");
|
||||||
|
glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync");
|
||||||
|
glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v");
|
||||||
|
glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv");
|
||||||
|
glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v");
|
||||||
|
glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v");
|
||||||
|
glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture");
|
||||||
|
glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample");
|
||||||
|
glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample");
|
||||||
|
glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv");
|
||||||
|
glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski");
|
||||||
|
}
|
||||||
|
static void find_extensionsGL(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void find_coreGL(void) {
|
||||||
|
const char *v = (const char *)glGetString(GL_VERSION);
|
||||||
|
int major = v[0] - '0';
|
||||||
|
int minor = v[2] - '0';
|
||||||
|
GLVersion.major = major; GLVersion.minor = minor;
|
||||||
|
GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
|
||||||
|
GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
|
||||||
|
GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2;
|
||||||
|
GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3;
|
||||||
|
GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3;
|
||||||
|
GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gladLoadGLLoader(GLADloadproc load) {
|
||||||
|
GLVersion.major = 0; GLVersion.minor = 0;
|
||||||
|
glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
|
||||||
|
if(glGetString == NULL) return;
|
||||||
|
find_coreGL();
|
||||||
|
load_GL_VERSION_1_0(load);
|
||||||
|
load_GL_VERSION_1_1(load);
|
||||||
|
load_GL_VERSION_1_2(load);
|
||||||
|
load_GL_VERSION_1_3(load);
|
||||||
|
load_GL_VERSION_1_4(load);
|
||||||
|
load_GL_VERSION_1_5(load);
|
||||||
|
load_GL_VERSION_2_0(load);
|
||||||
|
load_GL_VERSION_2_1(load);
|
||||||
|
load_GL_VERSION_3_0(load);
|
||||||
|
load_GL_VERSION_3_1(load);
|
||||||
|
load_GL_VERSION_3_2(load);
|
||||||
|
|
||||||
|
find_extensionsGL();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
1898
deps/glad/glad.h
vendored
Normal file
1898
deps/glad/glad.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
deps/tinycthread.h
vendored
1
deps/tinycthread.h
vendored
@ -122,6 +122,7 @@ typedef int _tthread_clockid_t;
|
|||||||
/* Emulate clock_gettime */
|
/* Emulate clock_gettime */
|
||||||
int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts);
|
int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts);
|
||||||
#define clock_gettime _tthread_clock_gettime
|
#define clock_gettime _tthread_clock_gettime
|
||||||
|
#define CLOCK_REALTIME 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -659,6 +659,7 @@ INPUT = @GLFW_INTERNAL_DOCS@ \
|
|||||||
@GLFW_SOURCE_DIR@/docs/news.dox \
|
@GLFW_SOURCE_DIR@/docs/news.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/quick.dox \
|
@GLFW_SOURCE_DIR@/docs/quick.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/moving.dox \
|
@GLFW_SOURCE_DIR@/docs/moving.dox \
|
||||||
|
@GLFW_SOURCE_DIR@/docs/compile.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/build.dox \
|
@GLFW_SOURCE_DIR@/docs/build.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/context.dox \
|
@GLFW_SOURCE_DIR@/docs/context.dox \
|
||||||
@GLFW_SOURCE_DIR@/docs/monitor.dox \
|
@GLFW_SOURCE_DIR@/docs/monitor.dox \
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
@page build Building programs using GLFW
|
@page build Building programs that use GLFW
|
||||||
|
|
||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
This is about compiling and linking programs that use GLFW. For information on
|
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 build the GLFW library itself, see the
|
For information on how to compile the GLFW library itself, see the @ref compile
|
||||||
[Building GLFW](https://github.com/glfw/glfw#building-glfw) guide.
|
guide.
|
||||||
|
|
||||||
|
|
||||||
@section build_include Including the GLFW header file
|
@section build_include Including the GLFW header file
|
||||||
@ -50,7 +50,9 @@ header that the GLFW header includes and GLEW will work as expected.
|
|||||||
@subsection build_macros GLFW header option macros
|
@subsection build_macros GLFW header option macros
|
||||||
|
|
||||||
These macros may be defined before the inclusion of the GLFW header and affect
|
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`
|
`GLFW_INCLUDE_GLCOREARB` makes the header include the modern `GL/glcorearb.h`
|
||||||
header (`OpenGL/gl3.h` on OS X) instead of the regular OpenGL header.
|
header (`OpenGL/gl3.h` on OS X) instead of the regular OpenGL header.
|
||||||
@ -83,8 +85,10 @@ 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.
|
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
|
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
|
must link with `opengl32`. On some versions of MinGW, you must also explicitly
|
||||||
`glu32`.
|
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
|
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
|
that uses the DLL version of GLFW, you need to define the `GLFW_DLL` macro
|
||||||
|
@ -14,7 +14,7 @@ specification but merely list some of the preconditions for certain parts of the
|
|||||||
API to function on a given machine. As such, any part of it may change in
|
API to function on a given machine. As such, any part of it may change in
|
||||||
future versions without this being considered a breaking API change.
|
future versions without this being considered a breaking API change.
|
||||||
|
|
||||||
@section compat_wm ICCCM and EWMH conformance
|
@section compat_x11 X11 extensions, protocols and IPC standards
|
||||||
|
|
||||||
As GLFW uses Xlib, directly, without any intervening toolkit
|
As GLFW uses Xlib, directly, without any intervening toolkit
|
||||||
library, it has sole responsibility for interacting well with the many and
|
library, it has sole responsibility for interacting well with the many and
|
||||||
@ -27,6 +27,10 @@ X11 API; most importantly the
|
|||||||
[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
|
[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
|
||||||
(EWMH) standards.
|
(EWMH) standards.
|
||||||
|
|
||||||
|
GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows.
|
||||||
|
If the running window manager does not support this property, the
|
||||||
|
`GLFW_DECORATED` hint will have no effect.
|
||||||
|
|
||||||
GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
|
GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
|
||||||
attempting to close the GLFW window. If the running window manager does not
|
attempting to close the GLFW window. If the running window manager does not
|
||||||
support this protocol, the close callback will never be called.
|
support this protocol, the close callback will never be called.
|
||||||
@ -36,11 +40,16 @@ the user when the application has stopped responding, i.e. when it has ceased to
|
|||||||
process events. If the running window manager does not support this protocol,
|
process events. If the running window manager does not support this protocol,
|
||||||
the user will not be notified if the application locks up.
|
the user will not be notified if the application locks up.
|
||||||
|
|
||||||
GLFW uses the EWMH `_NET_WM_STATE` protocol to tell the window manager to make
|
GLFW uses the EWMH `_NET_WM_STATE_FULLSCREEN` window state to tell the window
|
||||||
the GLFW window full screen. If the running window manager does not support this
|
manager to make the GLFW window full screen. If the running window manager does
|
||||||
protocol, full screen windows may not work properly. GLFW has a fallback code
|
not support this state, full screen windows may not work properly. GLFW has
|
||||||
path in case this protocol is unavailable, but every window manager behaves
|
a fallback code path in case this state is unavailable, but every window manager
|
||||||
slightly differently in this regard.
|
behaves slightly differently in this regard.
|
||||||
|
|
||||||
|
GLFW uses the EWMH `_NET_WM_BYPASS_COMPOSITOR` window property to tell a
|
||||||
|
compositing window manager to un-redirect full screen GLFW windows. If the
|
||||||
|
running window manager uses compositing but does not support this property then
|
||||||
|
additional copying may be performed for each buffer swap of full screen windows.
|
||||||
|
|
||||||
GLFW uses the
|
GLFW uses the
|
||||||
[clipboard manager protocol](http://www.freedesktop.org/wiki/ClipboardManager/)
|
[clipboard manager protocol](http://www.freedesktop.org/wiki/ClipboardManager/)
|
||||||
@ -48,6 +57,28 @@ to push a clipboard string (i.e. selection) owned by a GLFW window about to be
|
|||||||
destroyed to the clipboard manager. If there is no running clipboard manager,
|
destroyed to the clipboard manager. If there is no running clipboard manager,
|
||||||
the clipboard string will be unavailable once the window has been destroyed.
|
the clipboard string will be unavailable once the window has been destroyed.
|
||||||
|
|
||||||
|
GLFW uses the
|
||||||
|
[X drag-and-drop protocol](http://www.freedesktop.org/wiki/Specifications/XDND/)
|
||||||
|
to provide file drop events. If the application originating the drag does not
|
||||||
|
support this protocol, drag and drop will not work.
|
||||||
|
|
||||||
|
GLFW uses the XInput 2 extension to provide sub-pixel cursor motion events. If
|
||||||
|
the running X server does not support this version of this extension, cursor
|
||||||
|
motion will be snapped to the pixel grid.
|
||||||
|
|
||||||
|
GLFW uses the XRandR 1.3 extension to provide multi-monitor support. If the
|
||||||
|
running X server does not support this version of this extension, multi-monitor
|
||||||
|
support will not function and only a single, desktop-spanning monitor will be
|
||||||
|
reported.
|
||||||
|
|
||||||
|
GLFW uses the XRandR 1.3 and Xf86vidmode extensions to provide gamma ramp
|
||||||
|
support. If the running X server does not support either or both of these
|
||||||
|
extensions, gamma ramp support will not function.
|
||||||
|
|
||||||
|
GLFW requires the Xkb extension with detectable auto-repeat to provide keyboard
|
||||||
|
input. If the running X server does not support this extension and detectable
|
||||||
|
auto-repeat, `glfwInit` will fail.
|
||||||
|
|
||||||
@section compat_glx GLX extensions
|
@section compat_glx GLX extensions
|
||||||
|
|
||||||
The GLX API is the default API used to create OpenGL contexts on Unix-like
|
The GLX API is the default API used to create OpenGL contexts on Unix-like
|
||||||
@ -123,15 +154,15 @@ version 2.1.
|
|||||||
|
|
||||||
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
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
|
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
|
||||||
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` is required for
|
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
|
||||||
creating contexts for OpenGL 3.2 and later, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
non-zero and the `GLFW_OPENGL_PROFILE` hint must be set to
|
||||||
is ignored and setting the `GLFW_OPENGL_PROFILE` hint to anything except
|
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts and the
|
||||||
`GLFW_OPENGL_CORE_PROFILE` will cause @ref glfwCreateWindow to fail.
|
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
|
||||||
|
|
||||||
Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
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_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1,
|
||||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the
|
setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to
|
||||||
`GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value
|
a non-default value will cause @ref glfwCreateWindow to fail and the
|
||||||
will cause @ref glfwCreateWindow to fail.
|
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
261
docs/compile.dox
Normal file
261
docs/compile.dox
Normal file
@ -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.
|
[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
|
@section context_current Current context
|
||||||
|
|
||||||
Before you can use the OpenGL or OpenGL ES APIs, you need to have a current
|
Before you can use the OpenGL or OpenGL ES APIs, you need to have a current
|
||||||
|
@ -11,8 +11,9 @@ 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).
|
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
|
There is a [quick tutorial](@ref quick) for people new to GLFW, which shows how
|
||||||
to write a small but complete program, and a
|
to write a small but complete program, and guides for
|
||||||
[guide for building](@ref build) programs that use GLFW.
|
[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
|
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
|
[transition guide](@ref moving) that explains what has changed and how to update
|
||||||
|
@ -174,15 +174,37 @@ window to use. There is @ref glfwGetPrimaryMonitor that provides behaviour
|
|||||||
similar to that of GLFW 2.
|
similar to that of GLFW 2.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection moving_hidpi Separation of window and framebuffer sizes
|
||||||
|
|
||||||
|
Window positions and sizes now use screen coordinates, which may not be the same
|
||||||
|
as pixels on machines with high-DPI monitors. This is important as OpenGL uses
|
||||||
|
pixels, not screen coordinates. Most commonly, the rectangle specified with
|
||||||
|
`glViewport` needs to use pixels. Therefore, framebuffer size functions have
|
||||||
|
been added. You can retrieve the size of the framebuffer of a window with @ref
|
||||||
|
glfwGetFramebufferSize function. A framebuffer size callback has been added,
|
||||||
|
which can be set with @ref glfwSetFramebufferSizeCallback.
|
||||||
|
|
||||||
|
|
||||||
@subsection moving_window_close Window closing
|
@subsection moving_window_close Window closing
|
||||||
|
|
||||||
Window closing is now just an event like any other. GLFW 3 windows won't
|
Window closing initiated by the user is now just an event like any other.
|
||||||
disappear from underfoot even when no close callback is set; instead the
|
Unlike GLFW 2, windows and contexts created with GLFW 3 will not disappear from
|
||||||
window's close flag is set. You can query this flag using @ref
|
underfoot. Each window now has a close flag, which is set when the user
|
||||||
glfwWindowShouldClose, or capture close events by setting a close callback. The
|
attempts to close it. By default, nothing else happens and the window stays
|
||||||
close flag can be modified from any point in your program using @ref
|
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.
|
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
|
@subsection moving_context Explicit context management
|
||||||
|
|
||||||
|
@ -5,6 +5,14 @@
|
|||||||
@tableofcontents
|
@tableofcontents
|
||||||
|
|
||||||
|
|
||||||
|
@section news_31 New features in version 3.1
|
||||||
|
|
||||||
|
@subsection news_31_drop Drop event support
|
||||||
|
|
||||||
|
GLFW now provides a callback for receiving the paths of files dropped onto GLFW
|
||||||
|
windows. The callback is set with the @ref glfwSetDropCallback function.
|
||||||
|
|
||||||
|
|
||||||
@section news_30 New features in version 3.0
|
@section news_30 New features in version 3.0
|
||||||
|
|
||||||
@subsection news_30_cmake CMake build system
|
@subsection news_30_cmake CMake build system
|
||||||
@ -18,7 +26,7 @@ For more information on how to use CMake, see the
|
|||||||
[CMake manual](http://cmake.org/cmake/help/documentation.html).
|
[CMake manual](http://cmake.org/cmake/help/documentation.html).
|
||||||
|
|
||||||
|
|
||||||
@subsection new_30_multiwnd Multi-window support
|
@subsection news_30_multiwnd Multi-window support
|
||||||
|
|
||||||
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
||||||
or OpenGL ES context, and all window functions now take a window handle. Event
|
or OpenGL ES context, and all window functions now take a window handle. Event
|
||||||
@ -79,8 +87,8 @@ through CMake options.
|
|||||||
GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full
|
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,
|
resolution framebuffers where other UI elements are scaled up. To achieve this,
|
||||||
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
|
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
|
||||||
added. These work with pixels, while the rest of the GLFW API work with screen
|
added. These work with pixels, while the rest of the GLFW API works with screen
|
||||||
coordinates.
|
coordinates. This is important as OpenGL uses pixels, not screen coordinates.
|
||||||
|
|
||||||
|
|
||||||
@subsection news_30_error Error callback
|
@subsection news_30_error Error callback
|
||||||
|
@ -448,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
|
The `GLFW_OPENGL_PROFILE` attribute indicates the OpenGL profile used by the
|
||||||
context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`
|
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
|
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
|
The `GLFW_CONTEXT_ROBUSTNESS` attribute indicates the robustness strategy
|
||||||
used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or
|
used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or
|
||||||
@ -485,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
|
measure the time it takes to wait for the vertical retrace. However, a swap
|
||||||
interval of one lets you avoid tearing.
|
interval of one lets you avoid tearing.
|
||||||
|
|
||||||
Note that not all OpenGL implementations properly implement this function, in
|
Note that this may not work on all machines, as some drivers have
|
||||||
which case @ref glfwSwapInterval will have no effect. Some drivers also have
|
user-controlled settings that override any swap interval the application
|
||||||
user settings that override requests by GLFW.
|
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.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -16,19 +16,25 @@ if (NOT APPLE)
|
|||||||
include_directories(${OPENGL_INCLUDE_DIR})
|
include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(GLAD ${GLFW_SOURCE_DIR}/deps/glad/glad.h
|
||||||
|
${GLFW_SOURCE_DIR}/deps/glad.c)
|
||||||
set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h
|
set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h
|
||||||
${GLFW_SOURCE_DIR}/deps/getopt.c)
|
${GLFW_SOURCE_DIR}/deps/getopt.c)
|
||||||
|
set(TINYCTHREAD ${GLFW_SOURCE_DIR}/deps/tinycthread.h
|
||||||
|
${GLFW_SOURCE_DIR}/deps/tinycthread.c)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# Set fancy names for bundles
|
# Set fancy names for bundles
|
||||||
add_executable(Boing MACOSX_BUNDLE boing.c)
|
add_executable(Boing MACOSX_BUNDLE boing.c)
|
||||||
add_executable(Gears MACOSX_BUNDLE gears.c)
|
add_executable(Gears MACOSX_BUNDLE gears.c)
|
||||||
|
add_executable(Particles MACOSX_BUNDLE particles.c ${TINYCTHREAD})
|
||||||
add_executable(Simple MACOSX_BUNDLE simple.c)
|
add_executable(Simple MACOSX_BUNDLE simple.c)
|
||||||
add_executable("Split View" MACOSX_BUNDLE splitview.c)
|
add_executable("Split View" MACOSX_BUNDLE splitview.c)
|
||||||
add_executable(Wave MACOSX_BUNDLE wave.c)
|
add_executable(Wave MACOSX_BUNDLE wave.c)
|
||||||
|
|
||||||
set_target_properties(Boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
|
set_target_properties(Boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
|
||||||
set_target_properties(Gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
|
set_target_properties(Gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
|
||||||
|
set_target_properties(Particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
|
||||||
set_target_properties(Simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
|
set_target_properties(Simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
|
||||||
set_target_properties("Split View" PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View")
|
set_target_properties("Split View" PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View")
|
||||||
set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
||||||
@ -36,14 +42,15 @@ else()
|
|||||||
# Set boring names for executables
|
# Set boring names for executables
|
||||||
add_executable(boing WIN32 boing.c)
|
add_executable(boing WIN32 boing.c)
|
||||||
add_executable(gears WIN32 gears.c)
|
add_executable(gears WIN32 gears.c)
|
||||||
add_executable(heightmap WIN32 heightmap.c ${GETOPT})
|
add_executable(heightmap WIN32 heightmap.c ${GETOPT} ${GLAD})
|
||||||
|
add_executable(particles WIN32 particles.c ${TINYCTHREAD} ${GETOPT})
|
||||||
add_executable(simple WIN32 simple.c)
|
add_executable(simple WIN32 simple.c)
|
||||||
add_executable(splitview WIN32 splitview.c)
|
add_executable(splitview WIN32 splitview.c)
|
||||||
add_executable(wave WIN32 wave.c)
|
add_executable(wave WIN32 wave.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(WINDOWS_BINARIES boing gears heightmap simple splitview wave)
|
set(WINDOWS_BINARIES boing gears heightmap particles simple splitview wave)
|
||||||
|
|
||||||
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
||||||
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
|
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
|
||||||
@ -51,7 +58,7 @@ if (MSVC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(BUNDLE_BINARIES Boing Gears Simple "Split View" Wave)
|
set(BUNDLE_BINARIES Boing Gears Particles Simple "Split View" Wave)
|
||||||
|
|
||||||
set_target_properties(${BUNDLE_BINARIES} PROPERTIES
|
set_target_properties(${BUNDLE_BINARIES} PROPERTIES
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
||||||
|
@ -30,35 +30,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
|
#include <glad/glad.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <GL/glext.h>
|
|
||||||
|
|
||||||
/* OpenGL function pointers */
|
|
||||||
static PFNGLGENBUFFERSPROC pglGenBuffers = NULL;
|
|
||||||
static PFNGLGENVERTEXARRAYSPROC pglGenVertexArrays = NULL;
|
|
||||||
static PFNGLDELETEVERTEXARRAYSPROC pglDeleteVertexArrays = NULL;
|
|
||||||
static PFNGLCREATESHADERPROC pglCreateShader = NULL;
|
|
||||||
static PFNGLSHADERSOURCEPROC pglShaderSource = NULL;
|
|
||||||
static PFNGLCOMPILESHADERPROC pglCompileShader = NULL;
|
|
||||||
static PFNGLGETSHADERIVPROC pglGetShaderiv = NULL;
|
|
||||||
static PFNGLGETSHADERINFOLOGPROC pglGetShaderInfoLog = NULL;
|
|
||||||
static PFNGLDELETESHADERPROC pglDeleteShader = NULL;
|
|
||||||
static PFNGLCREATEPROGRAMPROC pglCreateProgram = NULL;
|
|
||||||
static PFNGLATTACHSHADERPROC pglAttachShader = NULL;
|
|
||||||
static PFNGLLINKPROGRAMPROC pglLinkProgram = NULL;
|
|
||||||
static PFNGLUSEPROGRAMPROC pglUseProgram = NULL;
|
|
||||||
static PFNGLGETPROGRAMIVPROC pglGetProgramiv = NULL;
|
|
||||||
static PFNGLGETPROGRAMINFOLOGPROC pglGetProgramInfoLog = NULL;
|
|
||||||
static PFNGLDELETEPROGRAMPROC pglDeleteProgram = NULL;
|
|
||||||
static PFNGLGETUNIFORMLOCATIONPROC pglGetUniformLocation = NULL;
|
|
||||||
static PFNGLUNIFORMMATRIX4FVPROC pglUniformMatrix4fv = NULL;
|
|
||||||
static PFNGLGETATTRIBLOCATIONPROC pglGetAttribLocation = NULL;
|
|
||||||
static PFNGLBINDVERTEXARRAYPROC pglBindVertexArray = NULL;
|
|
||||||
static PFNGLBUFFERDATAPROC pglBufferData = NULL;
|
|
||||||
static PFNGLBINDBUFFERPROC pglBindBuffer = NULL;
|
|
||||||
static PFNGLBUFFERSUBDATAPROC pglBufferSubData = NULL;
|
|
||||||
static PFNGLENABLEVERTEXATTRIBARRAYPROC pglEnableVertexAttribArray = NULL;
|
|
||||||
static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL;
|
|
||||||
|
|
||||||
/* Map height updates */
|
/* Map height updates */
|
||||||
#define MAX_CIRCLE_SIZE (5.0f)
|
#define MAX_CIRCLE_SIZE (5.0f)
|
||||||
@ -75,49 +48,6 @@ static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL;
|
|||||||
2 * (MAP_NUM_VERTICES - 1))
|
2 * (MAP_NUM_VERTICES - 1))
|
||||||
|
|
||||||
|
|
||||||
/* OpenGL function pointers */
|
|
||||||
|
|
||||||
#define RESOLVE_GL_FCN(type, var, name) \
|
|
||||||
if (status == GL_TRUE) \
|
|
||||||
{\
|
|
||||||
var = (type) glfwGetProcAddress((name));\
|
|
||||||
if ((var) == NULL)\
|
|
||||||
{\
|
|
||||||
status = GL_FALSE;\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static GLboolean init_opengl(void)
|
|
||||||
{
|
|
||||||
GLboolean status = GL_TRUE;
|
|
||||||
RESOLVE_GL_FCN(PFNGLCREATESHADERPROC, pglCreateShader, "glCreateShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLSHADERSOURCEPROC, pglShaderSource, "glShaderSource");
|
|
||||||
RESOLVE_GL_FCN(PFNGLCOMPILESHADERPROC, pglCompileShader, "glCompileShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETSHADERIVPROC, pglGetShaderiv, "glGetShaderiv");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETSHADERINFOLOGPROC, pglGetShaderInfoLog, "glGetShaderInfoLog");
|
|
||||||
RESOLVE_GL_FCN(PFNGLDELETESHADERPROC, pglDeleteShader, "glDeleteShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLCREATEPROGRAMPROC, pglCreateProgram, "glCreateProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLATTACHSHADERPROC, pglAttachShader, "glAttachShader");
|
|
||||||
RESOLVE_GL_FCN(PFNGLLINKPROGRAMPROC, pglLinkProgram, "glLinkProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLUSEPROGRAMPROC, pglUseProgram, "glUseProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETPROGRAMIVPROC, pglGetProgramiv, "glGetProgramiv");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETPROGRAMINFOLOGPROC, pglGetProgramInfoLog, "glGetProgramInfoLog");
|
|
||||||
RESOLVE_GL_FCN(PFNGLDELETEPROGRAMPROC, pglDeleteProgram, "glDeleteProgram");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETUNIFORMLOCATIONPROC, pglGetUniformLocation, "glGetUniformLocation");
|
|
||||||
RESOLVE_GL_FCN(PFNGLUNIFORMMATRIX4FVPROC, pglUniformMatrix4fv, "glUniformMatrix4fv");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGETATTRIBLOCATIONPROC, pglGetAttribLocation, "glGetAttribLocation");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGENVERTEXARRAYSPROC, pglGenVertexArrays, "glGenVertexArrays");
|
|
||||||
RESOLVE_GL_FCN(PFNGLDELETEVERTEXARRAYSPROC, pglDeleteVertexArrays, "glDeleteVertexArrays");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBINDVERTEXARRAYPROC, pglBindVertexArray, "glBindVertexArray");
|
|
||||||
RESOLVE_GL_FCN(PFNGLGENBUFFERSPROC, pglGenBuffers, "glGenBuffers");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBINDBUFFERPROC, pglBindBuffer, "glBindBuffer");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBUFFERDATAPROC, pglBufferData, "glBufferData");
|
|
||||||
RESOLVE_GL_FCN(PFNGLBUFFERSUBDATAPROC, pglBufferSubData, "glBufferSubData");
|
|
||||||
RESOLVE_GL_FCN(PFNGLENABLEVERTEXATTRIBARRAYPROC, pglEnableVertexAttribArray, "glEnableVertexAttribArray");
|
|
||||||
RESOLVE_GL_FCN(PFNGLVERTEXATTRIBPOINTERPROC, pglVertexAttribPointer, "glVertexAttribPointer");
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Default shader programs
|
* Default shader programs
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
@ -223,18 +153,18 @@ static GLuint make_shader(GLenum type, const char* shader_src)
|
|||||||
GLsizei log_length;
|
GLsizei log_length;
|
||||||
char info_log[8192];
|
char info_log[8192];
|
||||||
|
|
||||||
shader = pglCreateShader(type);
|
shader = glCreateShader(type);
|
||||||
if (shader != 0)
|
if (shader != 0)
|
||||||
{
|
{
|
||||||
pglShaderSource(shader, 1, (const GLchar**)&shader_src, NULL);
|
glShaderSource(shader, 1, (const GLchar**)&shader_src, NULL);
|
||||||
pglCompileShader(shader);
|
glCompileShader(shader);
|
||||||
pglGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok);
|
glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok);
|
||||||
if (shader_ok != GL_TRUE)
|
if (shader_ok != GL_TRUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" );
|
fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" );
|
||||||
pglGetShaderInfoLog(shader, 8192, &log_length,info_log);
|
glGetShaderInfoLog(shader, 8192, &log_length,info_log);
|
||||||
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
||||||
pglDeleteShader(shader);
|
glDeleteShader(shader);
|
||||||
shader = 0;
|
shader = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,23 +189,23 @@ static GLuint make_shader_program(const char* vertex_shader_src, const char* fra
|
|||||||
if (fragment_shader != 0u)
|
if (fragment_shader != 0u)
|
||||||
{
|
{
|
||||||
/* make the program that connect the two shader and link it */
|
/* make the program that connect the two shader and link it */
|
||||||
program = pglCreateProgram();
|
program = glCreateProgram();
|
||||||
if (program != 0u)
|
if (program != 0u)
|
||||||
{
|
{
|
||||||
/* attach both shader and link */
|
/* attach both shader and link */
|
||||||
pglAttachShader(program, vertex_shader);
|
glAttachShader(program, vertex_shader);
|
||||||
pglAttachShader(program, fragment_shader);
|
glAttachShader(program, fragment_shader);
|
||||||
pglLinkProgram(program);
|
glLinkProgram(program);
|
||||||
pglGetProgramiv(program, GL_LINK_STATUS, &program_ok);
|
glGetProgramiv(program, GL_LINK_STATUS, &program_ok);
|
||||||
|
|
||||||
if (program_ok != GL_TRUE)
|
if (program_ok != GL_TRUE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR, failed to link shader program\n");
|
fprintf(stderr, "ERROR, failed to link shader program\n");
|
||||||
pglGetProgramInfoLog(program, 8192, &log_length, info_log);
|
glGetProgramInfoLog(program, 8192, &log_length, info_log);
|
||||||
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
|
||||||
pglDeleteProgram(program);
|
glDeleteProgram(program);
|
||||||
pglDeleteShader(fragment_shader);
|
glDeleteShader(fragment_shader);
|
||||||
pglDeleteShader(vertex_shader);
|
glDeleteShader(vertex_shader);
|
||||||
program = 0u;
|
program = 0u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +213,7 @@ static GLuint make_shader_program(const char* vertex_shader_src, const char* fra
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Unable to load fragment shader\n");
|
fprintf(stderr, "ERROR: Unable to load fragment shader\n");
|
||||||
pglDeleteShader(vertex_shader);
|
glDeleteShader(vertex_shader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -439,38 +369,38 @@ static void make_mesh(GLuint program)
|
|||||||
{
|
{
|
||||||
GLuint attrloc;
|
GLuint attrloc;
|
||||||
|
|
||||||
pglGenVertexArrays(1, &mesh);
|
glGenVertexArrays(1, &mesh);
|
||||||
pglGenBuffers(4, mesh_vbo);
|
glGenBuffers(4, mesh_vbo);
|
||||||
pglBindVertexArray(mesh);
|
glBindVertexArray(mesh);
|
||||||
/* Prepare the data for drawing through a buffer inidices */
|
/* Prepare the data for drawing through a buffer inidices */
|
||||||
pglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]);
|
||||||
pglBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW);
|
||||||
|
|
||||||
/* Prepare the attributes for rendering */
|
/* Prepare the attributes for rendering */
|
||||||
attrloc = pglGetAttribLocation(program, "x");
|
attrloc = glGetAttribLocation(program, "x");
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW);
|
||||||
pglEnableVertexAttribArray(attrloc);
|
glEnableVertexAttribArray(attrloc);
|
||||||
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
|
||||||
attrloc = pglGetAttribLocation(program, "z");
|
attrloc = glGetAttribLocation(program, "z");
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW);
|
||||||
pglEnableVertexAttribArray(attrloc);
|
glEnableVertexAttribArray(attrloc);
|
||||||
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
|
||||||
attrloc = pglGetAttribLocation(program, "y");
|
attrloc = glGetAttribLocation(program, "y");
|
||||||
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]);
|
||||||
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW);
|
||||||
pglEnableVertexAttribArray(attrloc);
|
glEnableVertexAttribArray(attrloc);
|
||||||
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
glVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update VBO vertices from source data
|
/* Update VBO vertices from source data
|
||||||
*/
|
*/
|
||||||
static void update_mesh(void)
|
static void update_mesh(void)
|
||||||
{
|
{
|
||||||
pglBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]);
|
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
@ -588,15 +518,8 @@ int main(int argc, char** argv)
|
|||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
if (GL_TRUE != init_opengl())
|
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: unable to resolve OpenGL function pointers\n");
|
|
||||||
free(vertex_shader_src);
|
|
||||||
free(fragment_shader_src);
|
|
||||||
|
|
||||||
glfwTerminate();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
/* Prepare opengl resources for rendering */
|
/* Prepare opengl resources for rendering */
|
||||||
shader_program = make_shader_program(vertex_shader_src , fragment_shader_src);
|
shader_program = make_shader_program(vertex_shader_src , fragment_shader_src);
|
||||||
free(vertex_shader_src);
|
free(vertex_shader_src);
|
||||||
@ -611,9 +534,9 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pglUseProgram(shader_program);
|
glUseProgram(shader_program);
|
||||||
uloc_project = pglGetUniformLocation(shader_program, "project");
|
uloc_project = glGetUniformLocation(shader_program, "project");
|
||||||
uloc_modelview = pglGetUniformLocation(shader_program, "modelview");
|
uloc_modelview = glGetUniformLocation(shader_program, "modelview");
|
||||||
|
|
||||||
/* Compute the projection matrix */
|
/* Compute the projection matrix */
|
||||||
f = 1.0f / tanf(view_angle / 2.0f);
|
f = 1.0f / tanf(view_angle / 2.0f);
|
||||||
@ -622,13 +545,13 @@ int main(int argc, char** argv)
|
|||||||
projection_matrix[10] = (z_far + z_near)/ (z_near - z_far);
|
projection_matrix[10] = (z_far + z_near)/ (z_near - z_far);
|
||||||
projection_matrix[11] = -1.0f;
|
projection_matrix[11] = -1.0f;
|
||||||
projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far);
|
projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far);
|
||||||
pglUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix);
|
glUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix);
|
||||||
|
|
||||||
/* Set the camera position */
|
/* Set the camera position */
|
||||||
modelview_matrix[12] = -5.0f;
|
modelview_matrix[12] = -5.0f;
|
||||||
modelview_matrix[13] = -5.0f;
|
modelview_matrix[13] = -5.0f;
|
||||||
modelview_matrix[14] = -20.0f;
|
modelview_matrix[14] = -20.0f;
|
||||||
pglUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix);
|
glUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix);
|
||||||
|
|
||||||
/* Create mesh data */
|
/* Create mesh data */
|
||||||
init_map();
|
init_map();
|
||||||
@ -644,7 +567,7 @@ int main(int argc, char** argv)
|
|||||||
/* main loop */
|
/* main loop */
|
||||||
frame = 0;
|
frame = 0;
|
||||||
iter = 0;
|
iter = 0;
|
||||||
dt = last_update_time = glfwGetTime();
|
last_update_time = glfwGetTime();
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
|
1061
examples/particles.c
Normal file
1061
examples/particles.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW 3.0 - www.glfw.org
|
* GLFW 3.1 - www.glfw.org
|
||||||
* A library for OpenGL, window and input
|
* A library for OpenGL, window and input
|
||||||
*------------------------------------------------------------------------
|
*------------------------------------------------------------------------
|
||||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
@ -220,14 +220,14 @@ extern "C" {
|
|||||||
* backward-compatible.
|
* backward-compatible.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_MINOR 0
|
#define GLFW_VERSION_MINOR 1
|
||||||
/*! @brief The revision number of the GLFW library.
|
/*! @brief The revision number of the GLFW library.
|
||||||
*
|
*
|
||||||
* This is incremented when a bug fix release is made that does not contain any
|
* This is incremented when a bug fix release is made that does not contain any
|
||||||
* API changes.
|
* API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 4
|
#define GLFW_VERSION_REVISION 0
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @name Key and button actions
|
/*! @name Key and button actions
|
||||||
@ -773,6 +773,21 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
|||||||
*/
|
*/
|
||||||
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
||||||
|
|
||||||
|
|
||||||
|
/*! @brief The function signature for drop callbacks.
|
||||||
|
*
|
||||||
|
* This is the function signature for drop callbacks.
|
||||||
|
*
|
||||||
|
* @param[in] window The window that received the event.
|
||||||
|
* @param[in] count The number of dropped objects.
|
||||||
|
* @param[in] names The UTF-8 encoded names of the dropped objects.
|
||||||
|
*
|
||||||
|
* @sa glfwSetDropCallback
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
|
||||||
|
|
||||||
/*! @brief The function signature for monitor configuration callbacks.
|
/*! @brief The function signature for monitor configuration callbacks.
|
||||||
*
|
*
|
||||||
* This is the function signature for monitor configuration callback functions.
|
* This is the function signature for monitor configuration callback functions.
|
||||||
@ -863,9 +878,6 @@ typedef struct GLFWgammaramp
|
|||||||
*
|
*
|
||||||
* @note This function may only be called from the main thread.
|
* @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 **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
|
* application to the `Contents/Resources` subdirectory of the application's
|
||||||
* bundle, if present.
|
* bundle, if present.
|
||||||
@ -1246,6 +1258,8 @@ GLFWAPI void glfwWindowHint(int target, int hint);
|
|||||||
* information from the application's bundle. For more information on bundles,
|
* information from the application's bundle. For more information on bundles,
|
||||||
* see the Bundle Programming Guide provided by Apple.
|
* 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
|
* @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
|
* the default value for that platform. For more information, see @ref
|
||||||
* glfwSwapInterval.
|
* glfwSwapInterval.
|
||||||
@ -1361,10 +1375,6 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
|||||||
*
|
*
|
||||||
* @note The window manager may put limits on what positions are allowed.
|
* @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
|
* @sa glfwGetWindowPos
|
||||||
*
|
*
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
@ -1600,6 +1610,9 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
|
|||||||
* @return The previously set callback, or `NULL` if no callback was set or an
|
* @return The previously set callback, or `NULL` if no callback was set or an
|
||||||
* error occurred.
|
* error occurred.
|
||||||
*
|
*
|
||||||
|
* @par New in GLFW 3
|
||||||
|
* The close callback no longer returns a value.
|
||||||
|
*
|
||||||
* @remarks **OS X:** Selecting Quit from the application menu will
|
* @remarks **OS X:** Selecting Quit from the application menu will
|
||||||
* trigger the close callback for all windows.
|
* trigger the close callback for all windows.
|
||||||
*
|
*
|
||||||
@ -1693,6 +1706,12 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window
|
|||||||
* This function is no longer called by @ref glfwSwapBuffers. You need to call
|
* This function is no longer called by @ref glfwSwapBuffers. You need to call
|
||||||
* it or @ref glfwWaitEvents yourself.
|
* 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 only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @note This function may not be called from a callback.
|
* @note This function may not be called from a callback.
|
||||||
@ -1720,6 +1739,12 @@ GLFWAPI void glfwPollEvents(void);
|
|||||||
*
|
*
|
||||||
* This function is not required for joystick input to work.
|
* 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 only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @note This function may not be called from a callback.
|
* @note This function may not be called from a callback.
|
||||||
@ -1755,9 +1780,12 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
|
|||||||
* modes:
|
* modes:
|
||||||
* - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
|
* - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
|
||||||
* - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
|
* - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
|
||||||
* area of the window.
|
* area of the window but does not restrict the cursor from leaving. This is
|
||||||
* - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on
|
* useful if you wish to render your own cursor or have no visible cursor at
|
||||||
* cursor movement.
|
* 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
|
* 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
|
* enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
|
||||||
@ -2001,6 +2029,22 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcu
|
|||||||
*/
|
*/
|
||||||
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
|
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
|
||||||
|
|
||||||
|
/*! @brief Sets the drop callback.
|
||||||
|
*
|
||||||
|
* This function sets the drop callback of the specified window, which is
|
||||||
|
* called when an object is dropped over the window.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param[in] window The window whose callback to set.
|
||||||
|
* @param[in] cbfun The new drop callback, or `NULL` to remove the currently
|
||||||
|
* set callback.
|
||||||
|
* @return The previously set callback, or `NULL` if no callback was set or an
|
||||||
|
* error occurred.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
|
||||||
|
|
||||||
/*! @brief Returns whether the specified joystick is present.
|
/*! @brief Returns whether the specified joystick is present.
|
||||||
*
|
*
|
||||||
* This function returns whether the specified joystick is present.
|
* This function returns whether the specified joystick is present.
|
||||||
|
@ -102,6 +102,12 @@ extern "C" {
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
||||||
|
/*! @brief Returns the device name of the specified monitor.
|
||||||
|
* @return The the device name of the specified monitor.
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI const WCHAR* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `HWND` of the specified window.
|
/*! @brief Returns the `HWND` of the specified window.
|
||||||
* @return The `HWND` of the specified window.
|
* @return The `HWND` of the specified window.
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
@ -118,6 +124,12 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
||||||
|
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
|
||||||
|
* @return The the `CGDirectDisplayID` of the specified monitor.
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `NSWindow` of the specified window.
|
/*! @brief Returns the `NSWindow` of the specified window.
|
||||||
* @return The `NSWindow` of the specified window.
|
* @return The `NSWindow` of the specified window.
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
@ -139,6 +151,13 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
|||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI Display* glfwGetX11Display(void);
|
GLFWAPI Display* glfwGetX11Display(void);
|
||||||
|
|
||||||
|
/*! @brief Returns the `RRCrtc` of the specified monitor.
|
||||||
|
* @return The the `RRCrtc` of the specified monitor.
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI RRCrtc glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `Window` of the specified window.
|
/*! @brief Returns the `Window` of the specified window.
|
||||||
* @return The `Window` of the specified window.
|
* @return The `Window` of the specified window.
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
@ -160,11 +179,13 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
|||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
||||||
|
|
||||||
/*! @brief Returns the `EGLContext` of the specified window.
|
/*! @brief Returns the `EGLContext` of the specified window.
|
||||||
* @return The `EGLContext` of the specified window.
|
* @return The `EGLContext` of the specified window.
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||||
|
|
||||||
/*! @brief Returns the `EGLSurface` of the specified window.
|
/*! @brief Returns the `EGLSurface` of the specified window.
|
||||||
* @return The `EGLSurface` of the specified window.
|
* @return The `EGLSurface` of the specified window.
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
|
@ -3,6 +3,8 @@ include_directories(${GLFW_SOURCE_DIR}/src
|
|||||||
${GLFW_BINARY_DIR}/src
|
${GLFW_BINARY_DIR}/src
|
||||||
${glfw_INCLUDE_DIRS})
|
${glfw_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
add_definitions(-D_GLFW_USE_CONFIG_H)
|
||||||
|
|
||||||
set(common_HEADERS ${GLFW_BINARY_DIR}/src/glfw_config.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/glfw3.h
|
||||||
${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h)
|
${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@ -122,7 +122,7 @@ void _glfwPlatformTerminate(void)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
{
|
{
|
||||||
const char* version = _GLFW_VERSION_FULL " Cocoa"
|
const char* version = _GLFW_VERSION_NUMBER " Cocoa"
|
||||||
#if defined(_GLFW_NSGL)
|
#if defined(_GLFW_NSGL)
|
||||||
" NSGL"
|
" NSGL"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
||||||
@ -251,9 +251,6 @@ static void pollJoystickEvents(void)
|
|||||||
joystick->axes[i] = value;
|
joystick->axes[i] = value;
|
||||||
else
|
else
|
||||||
joystick->axes[i] = (2.f * (value - axis->minReport) / readScale) - 1.f;
|
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++)
|
for (i = 0; i < CFArrayGetCount(joystick->hatElements); i++)
|
||||||
@ -319,8 +316,9 @@ void _glfwInitJoysticks(void)
|
|||||||
|
|
||||||
while ((ioHIDDeviceObject = IOIteratorNext(objectIterator)))
|
while ((ioHIDDeviceObject = IOIteratorNext(objectIterator)))
|
||||||
{
|
{
|
||||||
|
CFMutableDictionaryRef propsRef = NULL;
|
||||||
|
CFTypeRef valueRef = NULL;
|
||||||
kern_return_t result;
|
kern_return_t result;
|
||||||
CFTypeRef valueRef = 0;
|
|
||||||
|
|
||||||
IOCFPlugInInterface** ppPlugInInterface = NULL;
|
IOCFPlugInInterface** ppPlugInInterface = NULL;
|
||||||
HRESULT plugInResult = S_OK;
|
HRESULT plugInResult = S_OK;
|
||||||
@ -329,26 +327,29 @@ void _glfwInitJoysticks(void)
|
|||||||
long usagePage, usage;
|
long usagePage, usage;
|
||||||
|
|
||||||
// Check device type
|
// Check device type
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
result = IORegistryEntryCreateCFProperties(ioHIDDeviceObject,
|
||||||
CFSTR(kIOHIDPrimaryUsagePageKey),
|
&propsRef,
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault,
|
||||||
kNilOptions);
|
kNilOptions);
|
||||||
|
|
||||||
|
if (result != kIOReturnSuccess)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsagePageKey));
|
||||||
if (valueRef)
|
if (valueRef)
|
||||||
{
|
{
|
||||||
CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage);
|
CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage);
|
||||||
if (usagePage != kHIDPage_GenericDesktop)
|
if (usagePage != kHIDPage_GenericDesktop)
|
||||||
{
|
{
|
||||||
// This device is not relevant to GLFW
|
// This device is not relevant to GLFW
|
||||||
|
CFRelease(valueRef);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(valueRef);
|
CFRelease(valueRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsageKey));
|
||||||
CFSTR(kIOHIDPrimaryUsageKey),
|
|
||||||
kCFAllocatorDefault,
|
|
||||||
kNilOptions);
|
|
||||||
if (valueRef)
|
if (valueRef)
|
||||||
{
|
{
|
||||||
CFNumberGetValue(valueRef, kCFNumberLongType, &usage);
|
CFNumberGetValue(valueRef, kCFNumberLongType, &usage);
|
||||||
@ -358,6 +359,7 @@ void _glfwInitJoysticks(void)
|
|||||||
usage != kHIDUsage_GD_MultiAxisController))
|
usage != kHIDUsage_GD_MultiAxisController))
|
||||||
{
|
{
|
||||||
// This device is not relevant to GLFW
|
// This device is not relevant to GLFW
|
||||||
|
CFRelease(valueRef);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,10 +395,7 @@ void _glfwInitJoysticks(void)
|
|||||||
joystick);
|
joystick);
|
||||||
|
|
||||||
// Get product string
|
// Get product string
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDProductKey));
|
||||||
CFSTR(kIOHIDProductKey),
|
|
||||||
kCFAllocatorDefault,
|
|
||||||
kNilOptions);
|
|
||||||
if (valueRef)
|
if (valueRef)
|
||||||
{
|
{
|
||||||
CFStringGetCString(valueRef,
|
CFStringGetCString(valueRef,
|
||||||
@ -410,10 +409,7 @@ void _glfwInitJoysticks(void)
|
|||||||
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
|
||||||
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
|
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDElementKey));
|
||||||
CFSTR(kIOHIDElementKey),
|
|
||||||
kCFAllocatorDefault,
|
|
||||||
kNilOptions);
|
|
||||||
if (CFGetTypeID(valueRef) == CFArrayGetTypeID())
|
if (CFGetTypeID(valueRef) == CFArrayGetTypeID())
|
||||||
{
|
{
|
||||||
CFRange range = { 0, CFArrayGetCount(valueRef) };
|
CFRange range = { 0, CFArrayGetCount(valueRef) };
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -49,9 +49,12 @@ static const char* getDisplayName(CGDirectDisplayID displayID)
|
|||||||
kIODisplayOnlyPreferredName);
|
kIODisplayOnlyPreferredName);
|
||||||
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
||||||
|
|
||||||
if (!CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
||||||
(const void**) &value))
|
(const void**) &value))
|
||||||
{
|
{
|
||||||
|
// This may happen if a desktop Mac is running headless
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
|
||||||
|
|
||||||
CFRelease(info);
|
CFRelease(info);
|
||||||
return strdup("Unknown");
|
return strdup("Unknown");
|
||||||
}
|
}
|
||||||
@ -250,48 +253,30 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
|||||||
|
|
||||||
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||||
{
|
{
|
||||||
uint32_t i, found = 0, monitorCount;
|
uint32_t i, found = 0, displayCount;
|
||||||
_GLFWmonitor** monitors;
|
_GLFWmonitor** monitors;
|
||||||
CGDirectDisplayID* displays;
|
CGDirectDisplayID* displays;
|
||||||
|
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
CGGetActiveDisplayList(0, NULL, &monitorCount);
|
CGGetActiveDisplayList(0, NULL, &displayCount);
|
||||||
|
|
||||||
displays = calloc(monitorCount, sizeof(CGDirectDisplayID));
|
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||||
monitors = calloc(monitorCount, sizeof(_GLFWmonitor*));
|
monitors = calloc(displayCount, sizeof(_GLFWmonitor*));
|
||||||
|
|
||||||
CGGetActiveDisplayList(monitorCount, displays, &monitorCount);
|
CGGetActiveDisplayList(displayCount, displays, &displayCount);
|
||||||
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
|
||||||
{
|
|
||||||
const CGSize size = CGDisplayScreenSize(displays[i]);
|
|
||||||
|
|
||||||
monitors[found] = _glfwCreateMonitor(getDisplayName(displays[i]),
|
|
||||||
size.width, size.height);
|
|
||||||
|
|
||||||
monitors[found]->ns.displayID = displays[i];
|
|
||||||
found++;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(displays);
|
|
||||||
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
|
||||||
{
|
|
||||||
if (CGDisplayIsMain(monitors[i]->ns.displayID))
|
|
||||||
{
|
|
||||||
_GLFWmonitor* temp = monitors[0];
|
|
||||||
monitors[0] = monitors[i];
|
|
||||||
monitors[i] = temp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSArray* screens = [NSScreen screens];
|
NSArray* screens = [NSScreen screens];
|
||||||
|
|
||||||
for (i = 0; i < monitorCount; i++)
|
for (i = 0; i < displayCount; i++)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
|
|
||||||
|
monitors[found] = _glfwAllocMonitor(getDisplayName(displays[i]),
|
||||||
|
size.width, size.height);
|
||||||
|
|
||||||
|
monitors[found]->ns.displayID = displays[i];
|
||||||
|
|
||||||
for (j = 0; j < [screens count]; j++)
|
for (j = 0; j < [screens count]; j++)
|
||||||
{
|
{
|
||||||
@ -299,26 +284,29 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
NSDictionary* dictionary = [screen deviceDescription];
|
NSDictionary* dictionary = [screen deviceDescription];
|
||||||
NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
|
NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
|
||||||
|
|
||||||
if (monitors[i]->ns.displayID == [number unsignedIntegerValue])
|
if (monitors[found]->ns.displayID == [number unsignedIntegerValue])
|
||||||
{
|
{
|
||||||
monitors[i]->ns.screen = screen;
|
monitors[found]->ns.screen = screen;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitors[i]->ns.screen == nil)
|
if (monitors[found]->ns.screen)
|
||||||
|
found++;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_glfwDestroyMonitors(monitors, monitorCount);
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Cocoa: Failed to find NSScreen for CGDisplay %s",
|
"Cocoa: Failed to find NSScreen for CGDisplay %s",
|
||||||
monitors[i]->name);
|
monitors[found]->name);
|
||||||
|
|
||||||
free(monitors);
|
_glfwFreeMonitor(monitors[found]);
|
||||||
return NULL;
|
monitors[found] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*count = monitorCount;
|
free(displays);
|
||||||
|
|
||||||
|
*count = found;
|
||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,3 +372,15 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
|||||||
CVDisplayLinkRelease(link);
|
CVDisplayLinkRelease(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
|
return monitor->ns.displayID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@ -138,12 +138,4 @@ void _glfwTerminateJoysticks(void);
|
|||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
// OpenGL support
|
|
||||||
int _glfwInitContextAPI(void);
|
|
||||||
void _glfwTerminateContextAPI(void);
|
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window);
|
|
||||||
|
|
||||||
#endif // _cocoa_platform_h_
|
#endif // _cocoa_platform_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@ -41,9 +41,9 @@ static void centerCursor(_GLFWwindow *window)
|
|||||||
|
|
||||||
// Update the cursor to match the specified cursor mode
|
// Update the cursor to match the specified cursor mode
|
||||||
//
|
//
|
||||||
static void setModeCursor(_GLFWwindow* window, int mode)
|
static void setModeCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (mode == GLFW_CURSOR_NORMAL)
|
if (window->cursorMode == GLFW_CURSOR_NORMAL)
|
||||||
[[NSCursor arrowCursor] set];
|
[[NSCursor arrowCursor] set];
|
||||||
else
|
else
|
||||||
[(NSCursor*) _glfw.ns.cursor set];
|
[(NSCursor*) _glfw.ns.cursor set];
|
||||||
@ -186,13 +186,14 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
|
|||||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
_glfwInputWindowFocus(window, GL_TRUE);
|
_glfwInputWindowFocus(window, GL_TRUE);
|
||||||
_glfwPlatformSetCursorMode(window, window->cursorMode);
|
_glfwPlatformApplyCursorMode(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResignKey:(NSNotification *)notification
|
- (void)windowDidResignKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
_glfwInputWindowFocus(window, GL_FALSE);
|
_glfwInputWindowFocus(window, GL_FALSE);
|
||||||
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
|
_glfwPlatformApplyCursorMode(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -266,7 +267,6 @@ static int translateFlags(NSUInteger flags)
|
|||||||
static int translateKey(unsigned int key)
|
static int translateKey(unsigned int key)
|
||||||
{
|
{
|
||||||
// Keyboard symbol translation table
|
// Keyboard symbol translation table
|
||||||
// TODO: Need to find mappings for F13-F15, volume down/up/mute, and eject.
|
|
||||||
static const unsigned int table[128] =
|
static const unsigned int table[128] =
|
||||||
{
|
{
|
||||||
/* 00 */ GLFW_KEY_A,
|
/* 00 */ GLFW_KEY_A,
|
||||||
@ -428,7 +428,7 @@ static int translateKey(unsigned int key)
|
|||||||
{
|
{
|
||||||
if (_glfw.ns.cursor == nil)
|
if (_glfw.ns.cursor == nil)
|
||||||
{
|
{
|
||||||
NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
|
NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(16, 16)];
|
||||||
_glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
|
_glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
|
||||||
hotSpot:NSZeroPoint];
|
hotSpot:NSZeroPoint];
|
||||||
[data release];
|
[data release];
|
||||||
@ -445,6 +445,8 @@ static int translateKey(unsigned int key)
|
|||||||
trackingArea = nil;
|
trackingArea = nil;
|
||||||
|
|
||||||
[self updateTrackingAreas];
|
[self updateTrackingAreas];
|
||||||
|
[self registerForDraggedTypes:[NSArray arrayWithObjects:
|
||||||
|
NSFilenamesPboardType, nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -473,7 +475,7 @@ static int translateKey(unsigned int key)
|
|||||||
|
|
||||||
- (void)cursorUpdate:(NSEvent *)event
|
- (void)cursorUpdate:(NSEvent *)event
|
||||||
{
|
{
|
||||||
setModeCursor(window, window->cursorMode);
|
setModeCursor(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent *)event
|
- (void)mouseDown:(NSEvent *)event
|
||||||
@ -657,6 +659,67 @@ static int translateKey(unsigned int key)
|
|||||||
_glfwInputScroll(window, deltaX, deltaY);
|
_glfwInputScroll(window, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)resetCursorRects
|
||||||
|
{
|
||||||
|
// This makes the cursor dissapear when the window is
|
||||||
|
// resized or received a drag operation
|
||||||
|
[self discardCursorRects];
|
||||||
|
[self addCursorRect:[self bounds] cursor:_glfw.ns.cursor];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||||
|
{
|
||||||
|
if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
|
||||||
|
== NSDragOperationGeneric)
|
||||||
|
{
|
||||||
|
[self setNeedsDisplay:YES];
|
||||||
|
return NSDragOperationGeneric;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NSDragOperationNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
|
||||||
|
{
|
||||||
|
[self setNeedsDisplay:YES];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
||||||
|
{
|
||||||
|
NSPasteboard* pasteboard = [sender draggingPasteboard];
|
||||||
|
NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType];
|
||||||
|
|
||||||
|
int height;
|
||||||
|
_glfwPlatformGetWindowSize(window, NULL, &height);
|
||||||
|
_glfwInputCursorMotion(window,
|
||||||
|
[sender draggingLocation].x,
|
||||||
|
height - [sender draggingLocation].y);
|
||||||
|
|
||||||
|
const int count = [files count];
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
|
NSEnumerator* e = [files objectEnumerator];
|
||||||
|
char** names = calloc(count, sizeof(char*));
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
names[i] = strdup([[e nextObject] UTF8String]);
|
||||||
|
|
||||||
|
_glfwInputDrop(window, count, (const char**) names);
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
free(names[i]);
|
||||||
|
free(names);
|
||||||
|
}
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
|
||||||
|
{
|
||||||
|
[self setNeedsDisplay:YES];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@ -796,6 +859,19 @@ static void createMenuBar(void)
|
|||||||
action:@selector(arrangeInFront:)
|
action:@selector(arrangeInFront:)
|
||||||
keyEquivalent:@""];
|
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
|
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
|
||||||
// to get the application menu working properly.
|
// to get the application menu working properly.
|
||||||
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
|
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
|
||||||
@ -814,13 +890,8 @@ static GLboolean initializeAppKit(void)
|
|||||||
// Implicitly create shared NSApplication instance
|
// Implicitly create shared NSApplication instance
|
||||||
[GLFWApplication sharedApplication];
|
[GLFWApplication sharedApplication];
|
||||||
|
|
||||||
// If we get here, the application is unbundled
|
// In case we are unbundled, make us a proper UI application
|
||||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
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);
|
|
||||||
|
|
||||||
#if defined(_GLFW_USE_MENUBAR)
|
#if defined(_GLFW_USE_MENUBAR)
|
||||||
// Menu bar setup must go between sharedApplication above and
|
// Menu bar setup must go between sharedApplication above and
|
||||||
@ -1027,6 +1098,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
|
|
||||||
void _glfwPlatformShowWindow(_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];
|
[window->ns.object makeKeyAndOrderFront:nil];
|
||||||
_glfwInputWindowVisibility(window, GL_TRUE);
|
_glfwInputWindowVisibility(window, GL_TRUE);
|
||||||
}
|
}
|
||||||
@ -1071,7 +1148,7 @@ void _glfwPlatformWaitEvents(void)
|
|||||||
|
|
||||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
||||||
{
|
{
|
||||||
setModeCursor(window, window->cursorMode);
|
setModeCursor(window);
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
@ -1089,11 +1166,11 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
setModeCursor(window, mode);
|
setModeCursor(window);
|
||||||
|
|
||||||
if (mode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
centerCursor(window);
|
centerCursor(window);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -98,7 +98,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
|
|||||||
|
|
||||||
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
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 == 1 && wndconfig->glMinor > 5) ||
|
||||||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 1) ||
|
(wndconfig->glMajor == 2 && wndconfig->glMinor > 1) ||
|
||||||
(wndconfig->glMajor == 3 && wndconfig->glMinor > 3))
|
(wndconfig->glMajor == 3 && wndconfig->glMinor > 3))
|
||||||
@ -402,8 +402,8 @@ GLboolean _glfwRefreshContextAttribs(void)
|
|||||||
else if (glfwExtensionSupported("GL_ARB_debug_output"))
|
else if (glfwExtensionSupported("GL_ARB_debug_output"))
|
||||||
{
|
{
|
||||||
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
||||||
// not setting the debug bit in the context flags for debug
|
// not setting the debug bit in the context flags for
|
||||||
// contexts
|
// debug contexts
|
||||||
window->glDebug = GL_TRUE;
|
window->glDebug = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,6 +419,14 @@ GLboolean _glfwRefreshContextAttribs(void)
|
|||||||
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
|
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||||
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
||||||
window->glProfile = GLFW_OPENGL_CORE_PROFILE;
|
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
|
// Read back robustness strategy
|
||||||
@ -566,7 +574,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension == NULL || *extension == '\0')
|
if (!extension || *extension == '\0')
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
_glfwInputError(GLFW_INVALID_VALUE, NULL);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@ -577,12 +585,16 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
// Check if extension is in the old style OpenGL extensions string
|
// Check if extension is in the old style OpenGL extensions string
|
||||||
|
|
||||||
extensions = glGetString(GL_EXTENSIONS);
|
extensions = glGetString(GL_EXTENSIONS);
|
||||||
if (extensions != NULL)
|
if (!extensions)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Failed to retrieve extension string");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfwStringInExtensionString(extension, extensions))
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -595,11 +607,16 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (strcmp((const char*) window->GetStringi(GL_EXTENSIONS, i),
|
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
|
||||||
extension) == 0)
|
if (!en)
|
||||||
{
|
{
|
||||||
return GL_TRUE;
|
_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
|
#endif // _GLFW_USE_OPENGL
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 EGL - www.glfw.org
|
// GLFW 3.1 EGL - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 EGL - www.glfw.org
|
// GLFW 3.1 EGL - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -77,4 +77,18 @@ typedef struct _GLFWlibraryEGL
|
|||||||
} _GLFWlibraryEGL;
|
} _GLFWlibraryEGL;
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Prototypes for platform specific internal functions
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
|
||||||
#endif // _egl_platform_h_
|
#endif // _egl_platform_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -81,6 +81,3 @@
|
|||||||
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
||||||
#cmakedefine _GLFW_USE_GLESV2
|
#cmakedefine _GLFW_USE_GLESV2
|
||||||
|
|
||||||
// The GLFW version as used by glfwGetVersionString
|
|
||||||
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 GLX - www.glfw.org
|
// GLFW 3.1 GLX - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -30,7 +30,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
|
|
||||||
// This is the only glXGetProcAddress variant not declared by glxext.h
|
// This is the only glXGetProcAddress variant not declared by glxext.h
|
||||||
@ -457,8 +456,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
||||||
{
|
{
|
||||||
// NOTE: Only request an explicitly versioned context when
|
// NOTE: Only request an explicitly versioned context when
|
||||||
// necessary, as explicitly requesting version 1.0 does not always
|
// necessary, as explicitly requesting version 1.0 does not
|
||||||
// return the highest available version
|
// always return the highest available version
|
||||||
|
|
||||||
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
|
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
|
||||||
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
|
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
|
||||||
@ -485,8 +484,9 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (window->glx.context == NULL)
|
if (window->glx.context == NULL)
|
||||||
{
|
{
|
||||||
// HACK: This is a fallback for the broken Mesa implementation of
|
// HACK: This is a fallback for the broken Mesa implementation of
|
||||||
// GLX_ARB_create_context_profile, which fails default 1.0 context
|
// GLX_ARB_create_context_profile, which fails default 1.0
|
||||||
// creation with a GLXBadProfileARB error in violation of the spec
|
// context creation with a GLXBadProfileARB error in violation
|
||||||
|
// of the extension spec
|
||||||
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
||||||
wndconfig->clientAPI == GLFW_OPENGL_API &&
|
wndconfig->clientAPI == GLFW_OPENGL_API &&
|
||||||
wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE &&
|
wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE &&
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 GLX - www.glfw.org
|
// GLFW 3.1 GLX - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -41,6 +41,8 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
// We support four different ways for getting addresses for GL/GLX
|
// We support four different ways for getting addresses for GL/GLX
|
||||||
// extension functions: glXGetProcAddress, glXGetProcAddressARB,
|
// extension functions: glXGetProcAddress, glXGetProcAddressARB,
|
||||||
// glXGetProcAddressEXT, and dlsym
|
// glXGetProcAddressEXT, and dlsym
|
||||||
@ -120,4 +122,15 @@ typedef struct _GLFWlibraryGLX
|
|||||||
} _GLFWlibraryGLX;
|
} _GLFWlibraryGLX;
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Prototypes for platform specific internal functions
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
|
||||||
#endif // _glx_platform_h_
|
#endif // _glx_platform_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -163,7 +163,7 @@ GLFWAPI void glfwTerminate(void)
|
|||||||
_glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
|
_glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwDestroyMonitors(_glfw.monitors, _glfw.monitorCount);
|
_glfwFreeMonitors(_glfw.monitors, _glfw.monitorCount);
|
||||||
_glfw.monitors = NULL;
|
_glfw.monitors = NULL;
|
||||||
_glfw.monitorCount = 0;
|
_glfw.monitorCount = 0;
|
||||||
|
|
||||||
|
18
src/input.c
18
src/input.c
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -70,7 +70,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
|||||||
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformSetCursorMode(window, newMode);
|
_glfwPlatformApplyCursorMode(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +211,12 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
|
|||||||
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
|
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names)
|
||||||
|
{
|
||||||
|
if (window->callbacks.drop)
|
||||||
|
window->callbacks.drop((GLFWwindow*) window, count, names);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW public API //////
|
////// GLFW public API //////
|
||||||
@ -394,3 +400,11 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
|
|||||||
return cbfun;
|
return cbfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -29,7 +29,11 @@
|
|||||||
#define _internal_h_
|
#define _internal_h_
|
||||||
|
|
||||||
|
|
||||||
#include "glfw_config.h"
|
#if defined(_GLFW_USE_CONFIG_H)
|
||||||
|
#include "glfw_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _GLFW_VERSION_NUMBER "3.1.0"
|
||||||
|
|
||||||
#if defined(_GLFW_USE_OPENGL)
|
#if defined(_GLFW_USE_OPENGL)
|
||||||
// This is the default for glfw3.h
|
// This is the default for glfw3.h
|
||||||
@ -235,6 +239,7 @@ struct _GLFWwindow
|
|||||||
GLFWscrollfun scroll;
|
GLFWscrollfun scroll;
|
||||||
GLFWkeyfun key;
|
GLFWkeyfun key;
|
||||||
GLFWcharfun character;
|
GLFWcharfun character;
|
||||||
|
GLFWdropfun drop;
|
||||||
} callbacks;
|
} callbacks;
|
||||||
|
|
||||||
// This is defined in the window API's platform.h
|
// This is defined in the window API's platform.h
|
||||||
@ -360,12 +365,11 @@ const char* _glfwPlatformGetVersionString(void);
|
|||||||
*/
|
*/
|
||||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
|
||||||
|
|
||||||
/*! @brief Sets up the specified cursor mode for the specified window.
|
/*! @brief Applies the cursor mode of the specified window to the system.
|
||||||
* @param[in] window The window whose cursor mode to change.
|
* @param[in] window The window whose cursor mode to apply.
|
||||||
* @param[in] mode The desired cursor mode.
|
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
*/
|
*/
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window);
|
||||||
|
|
||||||
/*! @copydoc glfwGetMonitors
|
/*! @copydoc glfwGetMonitors
|
||||||
* @ingroup platform
|
* @ingroup platform
|
||||||
@ -675,6 +679,14 @@ void _glfwInputMonitorChange(void);
|
|||||||
*/
|
*/
|
||||||
void _glfwInputError(int error, const char* format, ...);
|
void _glfwInputError(int error, const char* format, ...);
|
||||||
|
|
||||||
|
/*! @brief Notifies dropped object over window.
|
||||||
|
* @param[in] window The window that received the event.
|
||||||
|
* @param[in] count The number of dropped objects.
|
||||||
|
* @param[in] names The names of the dropped objects.
|
||||||
|
* @ingroup event
|
||||||
|
*/
|
||||||
|
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names);
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Utility functions
|
// Utility functions
|
||||||
@ -750,16 +762,23 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
|
|||||||
*/
|
*/
|
||||||
void _glfwFreeGammaArrays(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);
|
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
|
||||||
|
|
||||||
|
/*! @brief Frees a monitor object and any data associated with it.
|
||||||
|
* @ingroup utility
|
||||||
|
*/
|
||||||
|
void _glfwFreeMonitor(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @ingroup utility
|
/*! @ingroup utility
|
||||||
*/
|
*/
|
||||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor);
|
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count);
|
||||||
|
|
||||||
/*! @ingroup utility
|
|
||||||
*/
|
|
||||||
void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count);
|
|
||||||
|
|
||||||
#endif // _internal_h_
|
#endif // _internal_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -113,7 +113,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
{
|
{
|
||||||
if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j]))
|
if (_glfwPlatformIsSameMonitor(_glfw.monitors[i], monitors[j]))
|
||||||
{
|
{
|
||||||
_glfwDestroyMonitor(_glfw.monitors[i]);
|
_glfwFreeMonitor(_glfw.monitors[i]);
|
||||||
_glfw.monitors[i] = monitors[j];
|
_glfw.monitors[i] = monitors[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
_glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
_glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwDestroyMonitors(monitors, monitorCount);
|
_glfwFreeMonitors(monitors, monitorCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ void _glfwInputMonitorChange(void)
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
||||||
{
|
{
|
||||||
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
|
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
|
||||||
monitor->name = strdup(name);
|
monitor->name = strdup(name);
|
||||||
@ -185,7 +185,7 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM)
|
|||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
if (monitor == NULL)
|
if (monitor == NULL)
|
||||||
return;
|
return;
|
||||||
@ -198,12 +198,12 @@ void _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
|||||||
free(monitor);
|
free(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count)
|
void _glfwFreeMonitors(_GLFWmonitor** monitors, int count)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
_glfwDestroyMonitor(monitors[i]);
|
_glfwFreeMonitor(monitors[i]);
|
||||||
|
|
||||||
free(monitors);
|
free(monitors);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 OS X - www.glfw.org
|
// GLFW 3.1 OS X - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@ -61,4 +61,15 @@ typedef struct _GLFWlibraryNSGL
|
|||||||
} _GLFWlibraryNSGL;
|
} _GLFWlibraryNSGL;
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Prototypes for platform specific internal functions
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
|
||||||
#endif // _nsgl_platform_h_
|
#endif // _nsgl_platform_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 WGL - www.glfw.org
|
// GLFW 3.1 WGL - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -272,9 +272,21 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
usableCount++;
|
usableCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
||||||
if (!closest)
|
if (!closest)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"WGL: Failed to find a suitable pixel format");
|
||||||
|
|
||||||
free(usableConfigs);
|
free(usableConfigs);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@ -355,11 +367,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
|
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"WGL: Failed to find a suitable pixel format");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
|
||||||
{
|
{
|
||||||
@ -598,7 +606,7 @@ void _glfwPlatformSwapInterval(int interval)
|
|||||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
|
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
|
||||||
if (_glfwIsCompositionEnabled())
|
if (_glfwIsCompositionEnabled() && interval)
|
||||||
{
|
{
|
||||||
// Don't enabled vsync when desktop compositing is enabled, as it leads
|
// Don't enabled vsync when desktop compositing is enabled, as it leads
|
||||||
// to frame jitter
|
// to frame jitter
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 WGL - www.glfw.org
|
// GLFW 3.1 WGL - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -85,4 +85,18 @@ typedef struct _GLFWlibraryWGL
|
|||||||
} _GLFWlibraryWGL;
|
} _GLFWlibraryWGL;
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Prototypes for platform specific internal functions
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
int _glfwInitContextAPI(void);
|
||||||
|
void _glfwTerminateContextAPI(void);
|
||||||
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContext(_GLFWwindow* window);
|
||||||
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
|
const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
|
||||||
#endif // _wgl_platform_h_
|
#endif // _wgl_platform_h_
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -65,7 +65,11 @@ static GLboolean initLibraries(void)
|
|||||||
|
|
||||||
_glfw.win32.winmm.instance = LoadLibrary(L"winmm.dll");
|
_glfw.win32.winmm.instance = LoadLibrary(L"winmm.dll");
|
||||||
if (!_glfw.win32.winmm.instance)
|
if (!_glfw.win32.winmm.instance)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to load winmm.dll");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
_glfw.win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T)
|
_glfw.win32.winmm.joyGetDevCaps = (JOYGETDEVCAPS_T)
|
||||||
GetProcAddress(_glfw.win32.winmm.instance, "joyGetDevCapsW");
|
GetProcAddress(_glfw.win32.winmm.instance, "joyGetDevCapsW");
|
||||||
@ -81,6 +85,8 @@ static GLboolean initLibraries(void)
|
|||||||
!_glfw.win32.winmm.joyGetPosEx ||
|
!_glfw.win32.winmm.joyGetPosEx ||
|
||||||
!_glfw.win32.winmm.timeGetTime)
|
!_glfw.win32.winmm.timeGetTime)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Win32: Failed to load winmm functions");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif // _GLFW_NO_DLOAD_WINMM
|
#endif // _GLFW_NO_DLOAD_WINMM
|
||||||
@ -243,7 +249,7 @@ void _glfwPlatformTerminate(void)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
{
|
{
|
||||||
const char* version = _GLFW_VERSION_FULL " Win32"
|
const char* version = _GLFW_VERSION_NUMBER " Win32"
|
||||||
#if defined(_GLFW_WGL)
|
#if defined(_GLFW_WGL)
|
||||||
" WGL"
|
" WGL"
|
||||||
#elif defined(_GLFW_EGL)
|
#elif defined(_GLFW_EGL)
|
||||||
@ -252,7 +258,7 @@ const char* _glfwPlatformGetVersionString(void)
|
|||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
" MinGW"
|
" MinGW"
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
" VisualC "
|
" VisualC"
|
||||||
#elif defined(__BORLANDC__)
|
#elif defined(__BORLANDC__)
|
||||||
" BorlandC"
|
" BorlandC"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -148,7 +148,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
name = _glfwCreateUTF8FromWideString(display.DeviceString);
|
name = _glfwCreateUTF8FromWideString(display.DeviceString);
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
_glfwDestroyMonitors(monitors, found);
|
_glfwFreeMonitors(monitors, found);
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"Failed to convert string to UTF-8");
|
"Failed to convert string to UTF-8");
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitors[found] = _glfwCreateMonitor(name,
|
monitors[found] = _glfwAllocMonitor(name,
|
||||||
GetDeviceCaps(dc, HORZSIZE),
|
GetDeviceCaps(dc, HORZSIZE),
|
||||||
GetDeviceCaps(dc, VERTSIZE));
|
GetDeviceCaps(dc, VERTSIZE));
|
||||||
|
|
||||||
@ -282,3 +282,15 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
&mode->blueBits);
|
&mode->blueBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI const WCHAR* glfwGetWin32Monitor(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return monitor->win32.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -157,7 +157,7 @@ typedef struct _GLFWwindowWin32
|
|||||||
GLboolean cursorCentered;
|
GLboolean cursorCentered;
|
||||||
GLboolean cursorInside;
|
GLboolean cursorInside;
|
||||||
GLboolean cursorHidden;
|
GLboolean cursorHidden;
|
||||||
double oldCursorX, oldCursorY;
|
int oldCursorX, oldCursorY;
|
||||||
} _GLFWwindowWin32;
|
} _GLFWwindowWin32;
|
||||||
|
|
||||||
|
|
||||||
@ -174,8 +174,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
struct {
|
struct {
|
||||||
GLboolean hasPC;
|
GLboolean hasPC;
|
||||||
double resolution;
|
double resolution;
|
||||||
unsigned int t0_32;
|
unsigned __int64 base;
|
||||||
__int64 t0_64;
|
|
||||||
} timer;
|
} timer;
|
||||||
|
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||||
@ -239,17 +238,6 @@ void _glfwInitTimer(void);
|
|||||||
void _glfwInitJoysticks(void);
|
void _glfwInitJoysticks(void);
|
||||||
void _glfwTerminateJoysticks(void);
|
void _glfwTerminateJoysticks(void);
|
||||||
|
|
||||||
// OpenGL support
|
|
||||||
int _glfwInitContextAPI(void);
|
|
||||||
void _glfwTerminateContextAPI(void);
|
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window);
|
|
||||||
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
|
|
||||||
// Fullscreen support
|
// Fullscreen support
|
||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -28,6 +28,21 @@
|
|||||||
#include "internal.h"
|
#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 //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -36,20 +51,20 @@
|
|||||||
//
|
//
|
||||||
void _glfwInitTimer(void)
|
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.hasPC = GL_TRUE;
|
||||||
_glfw.win32.timer.resolution = 1.0 / (double) freq;
|
_glfw.win32.timer.resolution = 1.0 / (double) frequency;
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*) &_glfw.win32.timer.t0_64);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_glfw.win32.timer.hasPC = GL_FALSE;
|
_glfw.win32.timer.hasPC = GL_FALSE;
|
||||||
_glfw.win32.timer.resolution = 0.001; // winmm resolution is 1 ms
|
_glfw.win32.timer.resolution = 0.001; // winmm resolution is 1 ms
|
||||||
_glfw.win32.timer.t0_32 = _glfw_timeGetTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfw.win32.timer.base = getRawTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,30 +74,13 @@ void _glfwInitTimer(void)
|
|||||||
|
|
||||||
double _glfwPlatformGetTime(void)
|
double _glfwPlatformGetTime(void)
|
||||||
{
|
{
|
||||||
double t;
|
return (double) (getRawTime() - _glfw.win32.timer.base) *
|
||||||
__int64 t_64;
|
_glfw.win32.timer.resolution;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetTime(double t)
|
void _glfwPlatformSetTime(double time)
|
||||||
{
|
{
|
||||||
__int64 t_64;
|
_glfw.win32.timer.base = getRawTime() -
|
||||||
|
(unsigned __int64) (time / _glfw.win32.timer.resolution);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 Win32 - www.glfw.org
|
// GLFW 3.1 Win32 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
|
||||||
#define _GLFW_KEY_INVALID -2
|
#define _GLFW_KEY_INVALID -2
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ static void updateClipRect(_GLFWwindow* window)
|
|||||||
ClipCursor(&clipRect);
|
ClipCursor(&clipRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide mouse cursor
|
// Hide the mouse cursor
|
||||||
//
|
//
|
||||||
static void hideCursor(_GLFWwindow* window)
|
static void hideCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@ -67,9 +68,9 @@ static void hideCursor(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture mouse cursor
|
// Disable the mouse cursor
|
||||||
//
|
//
|
||||||
static void captureCursor(_GLFWwindow* window)
|
static void disableCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (!window->win32.cursorHidden)
|
if (!window->win32.cursorHidden)
|
||||||
{
|
{
|
||||||
@ -81,9 +82,9 @@ static void captureCursor(_GLFWwindow* window)
|
|||||||
SetCapture(window->win32.handle);
|
SetCapture(window->win32.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show mouse cursor
|
// Restores the mouse cursor
|
||||||
//
|
//
|
||||||
static void showCursor(_GLFWwindow* window)
|
static void restoreCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
POINT pos;
|
POINT pos;
|
||||||
|
|
||||||
@ -410,7 +411,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
// The window was defocused (or iconified, see above)
|
// The window was defocused (or iconified, see above)
|
||||||
|
|
||||||
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
||||||
showCursor(window);
|
restoreCursor(window);
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
@ -428,10 +429,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
{
|
{
|
||||||
// The window was focused
|
// The window was focused
|
||||||
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
||||||
captureCursor(window);
|
_glfwPlatformApplyCursorMode(window);
|
||||||
else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
|
||||||
hideCursor(window);
|
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor)
|
||||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||||
@ -442,6 +441,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
return 0;
|
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:
|
case WM_SHOWWINDOW:
|
||||||
{
|
{
|
||||||
_glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE);
|
_glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE);
|
||||||
@ -604,7 +616,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
if (newCursorX != window->win32.oldCursorX ||
|
if (newCursorX != window->win32.oldCursorX ||
|
||||||
newCursorY != window->win32.oldCursorY)
|
newCursorY != window->win32.oldCursorY)
|
||||||
{
|
{
|
||||||
double x, y;
|
int x, y;
|
||||||
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
@ -665,9 +677,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
if (_glfw.focusedWindow == window)
|
||||||
_glfw.focusedWindow == window)
|
|
||||||
{
|
{
|
||||||
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
updateClipRect(window);
|
updateClipRect(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,13 +690,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_MOVE:
|
case WM_MOVE:
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
if (_glfw.focusedWindow == window)
|
||||||
_glfw.focusedWindow == window)
|
|
||||||
{
|
{
|
||||||
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
updateClipRect(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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,13 +712,15 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
{
|
{
|
||||||
if (window->cursorMode != GLFW_CURSOR_NORMAL &&
|
if (_glfw.focusedWindow == window && LOWORD(lParam) == HTCLIENT)
|
||||||
_glfw.focusedWindow == window &&
|
{
|
||||||
LOWORD(lParam) == HTCLIENT)
|
if (window->cursorMode == GLFW_CURSOR_HIDDEN ||
|
||||||
|
window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
SetCursor(NULL);
|
SetCursor(NULL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -730,6 +748,40 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
// TODO: Restore vsync if compositing was disabled
|
// TODO: Restore vsync if compositing was disabled
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_DROPFILES:
|
||||||
|
{
|
||||||
|
HDROP hDrop = (HDROP) wParam;
|
||||||
|
POINT pt;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
const int count = DragQueryFile(hDrop, 0xffffffff, NULL, 0);
|
||||||
|
char** names = calloc(count, sizeof(char*));
|
||||||
|
|
||||||
|
// Move the mouse to the position of the drop
|
||||||
|
DragQueryPoint(hDrop, &pt);
|
||||||
|
_glfwInputCursorMotion(window, pt.x, pt.y);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
const UINT length = DragQueryFile(hDrop, i, NULL, 0);
|
||||||
|
WCHAR* buffer = calloc(length + 1, sizeof(WCHAR));
|
||||||
|
|
||||||
|
DragQueryFile(hDrop, i, buffer, length + 1);
|
||||||
|
names[i] = _glfwCreateUTF8FromWideString(buffer);
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwInputDrop(window, count, (const char**) names);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
free(names[i]);
|
||||||
|
free(names);
|
||||||
|
|
||||||
|
DragFinish(hDrop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||||
@ -849,6 +901,8 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
free(wideTitle);
|
free(wideTitle);
|
||||||
|
|
||||||
|
DragAcceptFiles(window->win32.handle, TRUE);
|
||||||
|
|
||||||
if (!window->win32.handle)
|
if (!window->win32.handle)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window");
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window");
|
||||||
@ -919,7 +973,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
// First we clear the current context (the one we just created)
|
// First we clear the current context (the one we just created)
|
||||||
// This is usually done by glfwDestroyWindow, but as we're not doing
|
// 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);
|
_glfwPlatformMakeContextCurrent(NULL);
|
||||||
|
|
||||||
// Next destroy the Win32 window and WGL context (without resetting or
|
// Next destroy the Win32 window and WGL context (without resetting or
|
||||||
@ -1017,7 +1071,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
|
|
||||||
SetWindowPos(window->win32.handle, HWND_TOP,
|
SetWindowPos(window->win32.handle, HWND_TOP,
|
||||||
0, 0, fullWidth, fullHeight,
|
0, 0, fullWidth, fullHeight,
|
||||||
SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
|
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1096,7 +1150,7 @@ void _glfwPlatformPollEvents(void)
|
|||||||
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods);
|
_glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, 0, GLFW_RELEASE, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did the cursor move in an focused window that has captured the cursor
|
// Did the cursor move in an focused window that has disabled the cursor
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
|
||||||
!window->win32.cursorCentered)
|
!window->win32.cursorCentered)
|
||||||
{
|
{
|
||||||
@ -1121,22 +1175,22 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
|
|||||||
ClientToScreen(window->win32.handle, &pos);
|
ClientToScreen(window->win32.handle, &pos);
|
||||||
SetCursorPos(pos.x, pos.y);
|
SetCursorPos(pos.x, pos.y);
|
||||||
|
|
||||||
window->win32.oldCursorX = xpos;
|
window->win32.oldCursorX = (int) xpos;
|
||||||
window->win32.oldCursorY = ypos;
|
window->win32.oldCursorY = (int) ypos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (window->cursorMode)
|
||||||
{
|
{
|
||||||
case GLFW_CURSOR_NORMAL:
|
case GLFW_CURSOR_NORMAL:
|
||||||
showCursor(window);
|
restoreCursor(window);
|
||||||
break;
|
break;
|
||||||
case GLFW_CURSOR_HIDDEN:
|
case GLFW_CURSOR_HIDDEN:
|
||||||
hideCursor(window);
|
hideCursor(window);
|
||||||
break;
|
break;
|
||||||
case GLFW_CURSOR_DISABLED:
|
case GLFW_CURSOR_DISABLED:
|
||||||
captureCursor(window);
|
disableCursor(window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 - www.glfw.org
|
// GLFW 3.1 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
@ -38,27 +38,21 @@
|
|||||||
//
|
//
|
||||||
void _glfwInitGammaRamp(void)
|
void _glfwInitGammaRamp(void)
|
||||||
{
|
{
|
||||||
// RandR gamma support is only available with version 1.2 and above
|
if (_glfw.x11.randr.available)
|
||||||
if (_glfw.x11.randr.available &&
|
|
||||||
(_glfw.x11.randr.versionMajor > 1 ||
|
|
||||||
(_glfw.x11.randr.versionMajor == 1 &&
|
|
||||||
_glfw.x11.randr.versionMinor >= 2)))
|
|
||||||
{
|
{
|
||||||
// FIXME: Assumes that all monitors have the same size gamma tables
|
XRRScreenResources* sr = XRRGetScreenResources(_glfw.x11.display,
|
||||||
// This is reasonable as I suspect the that if they did differ, it
|
|
||||||
// would imply that setting the gamma size to an arbitary size is
|
|
||||||
// possible as well.
|
|
||||||
XRRScreenResources* rr = XRRGetScreenResources(_glfw.x11.display,
|
|
||||||
_glfw.x11.root);
|
_glfw.x11.root);
|
||||||
|
|
||||||
if (XRRGetCrtcGammaSize(_glfw.x11.display, rr->crtcs[0]) == 0)
|
if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0]))
|
||||||
{
|
{
|
||||||
// This is probably older Nvidia RandR with broken gamma support
|
// This is probably older Nvidia RandR with broken gamma support
|
||||||
// Flag it as useless and try Xf86VidMode below, if available
|
// Flag it as useless and fall back to Xf86VidMode, if available
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: RandR gamma ramp support seems broken");
|
||||||
_glfw.x11.randr.gammaBroken = GL_TRUE;
|
_glfw.x11.randr.gammaBroken = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XRRFreeScreenResources(rr);
|
XRRFreeScreenResources(sr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -32,6 +32,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
// Translate an X11 key code to a GLFW key code.
|
// Translate an X11 key code to a GLFW key code.
|
||||||
@ -394,7 +395,6 @@ static void detectEWMH(void)
|
|||||||
(unsigned char**) &supportedAtoms);
|
(unsigned char**) &supportedAtoms);
|
||||||
|
|
||||||
// See which of the atoms we support that are supported by the WM
|
// See which of the atoms we support that are supported by the WM
|
||||||
|
|
||||||
_glfw.x11.NET_WM_STATE =
|
_glfw.x11.NET_WM_STATE =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
||||||
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
_glfw.x11.NET_WM_STATE_FULLSCREEN =
|
||||||
@ -409,6 +409,8 @@ static void detectEWMH(void)
|
|||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_PING");
|
||||||
_glfw.x11.NET_ACTIVE_WINDOW =
|
_glfw.x11.NET_ACTIVE_WINDOW =
|
||||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW");
|
||||||
|
_glfw.x11.NET_WM_BYPASS_COMPOSITOR =
|
||||||
|
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_BYPASS_COMPOSITOR");
|
||||||
|
|
||||||
XFree(supportedAtoms);
|
XFree(supportedAtoms);
|
||||||
|
|
||||||
@ -537,6 +539,17 @@ static GLboolean initExtensions(void)
|
|||||||
_glfw.x11.SAVE_TARGETS =
|
_glfw.x11.SAVE_TARGETS =
|
||||||
XInternAtom(_glfw.x11.display, "SAVE_TARGETS", False);
|
XInternAtom(_glfw.x11.display, "SAVE_TARGETS", False);
|
||||||
|
|
||||||
|
// Find Xdnd (drag and drop) atoms, if available
|
||||||
|
_glfw.x11.XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", True);
|
||||||
|
_glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", True);
|
||||||
|
_glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", True);
|
||||||
|
_glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", True);
|
||||||
|
_glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", True);
|
||||||
|
_glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", True);
|
||||||
|
_glfw.x11.XdndLeave = XInternAtom(_glfw.x11.display, "XdndLeave", True);
|
||||||
|
_glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", True);
|
||||||
|
_glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", True);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,7 +693,7 @@ void _glfwPlatformTerminate(void)
|
|||||||
|
|
||||||
const char* _glfwPlatformGetVersionString(void)
|
const char* _glfwPlatformGetVersionString(void)
|
||||||
{
|
{
|
||||||
const char* version = _GLFW_VERSION_FULL " X11"
|
const char* version = _GLFW_VERSION_NUMBER " X11"
|
||||||
#if defined(_GLFW_GLX)
|
#if defined(_GLFW_GLX)
|
||||||
" GLX"
|
" GLX"
|
||||||
#elif defined(_GLFW_EGL)
|
#elif defined(_GLFW_EGL)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -62,7 +62,7 @@ static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
|
|||||||
//
|
//
|
||||||
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
XRRScreenResources* sr;
|
XRRScreenResources* sr;
|
||||||
@ -111,6 +111,9 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bestMode == ci->mode)
|
||||||
|
return;
|
||||||
|
|
||||||
if (monitor->x11.oldMode == None)
|
if (monitor->x11.oldMode == None)
|
||||||
monitor->x11.oldMode = ci->mode;
|
monitor->x11.oldMode = ci->mode;
|
||||||
|
|
||||||
@ -133,7 +136,7 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||||||
//
|
//
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
XRRScreenResources* sr;
|
XRRScreenResources* sr;
|
||||||
XRRCrtcInfo* ci;
|
XRRCrtcInfo* ci;
|
||||||
@ -167,13 +170,13 @@ void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
|||||||
|
|
||||||
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
||||||
{
|
{
|
||||||
|
int i, found = 0;
|
||||||
_GLFWmonitor** monitors = NULL;
|
_GLFWmonitor** monitors = NULL;
|
||||||
|
|
||||||
*count = 0;
|
*count = 0;
|
||||||
|
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available)
|
||||||
{
|
{
|
||||||
int i, found = 0;
|
|
||||||
RROutput primary;
|
RROutput primary;
|
||||||
XRRScreenResources* sr;
|
XRRScreenResources* sr;
|
||||||
|
|
||||||
@ -215,7 +218,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitors[found] = _glfwCreateMonitor(oi->name,
|
monitors[found] = _glfwAllocMonitor(oi->name,
|
||||||
oi->mm_width, oi->mm_height);
|
oi->mm_width, oi->mm_height);
|
||||||
|
|
||||||
monitors[found]->x11.output = output;
|
monitors[found]->x11.output = output;
|
||||||
@ -242,23 +245,27 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
|
|||||||
|
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
{
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"X11: RandR monitor support seems broken");
|
||||||
|
_glfw.x11.randr.monitorBroken = GL_TRUE;
|
||||||
|
|
||||||
free(monitors);
|
free(monitors);
|
||||||
monitors = NULL;
|
monitors = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*count = found;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!monitors)
|
||||||
{
|
{
|
||||||
monitors = calloc(1, sizeof(_GLFWmonitor*));
|
monitors = calloc(1, sizeof(_GLFWmonitor*));
|
||||||
monitors[0] = _glfwCreateMonitor("Display",
|
monitors[0] = _glfwAllocMonitor("Display",
|
||||||
DisplayWidthMM(_glfw.x11.display,
|
DisplayWidthMM(_glfw.x11.display,
|
||||||
_glfw.x11.screen),
|
_glfw.x11.screen),
|
||||||
DisplayHeightMM(_glfw.x11.display,
|
DisplayHeightMM(_glfw.x11.display,
|
||||||
_glfw.x11.screen));
|
_glfw.x11.screen));
|
||||||
*count = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*count = found;
|
||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +276,7 @@ GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
|
|||||||
|
|
||||||
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
XRRScreenResources* sr;
|
XRRScreenResources* sr;
|
||||||
XRRCrtcInfo* ci;
|
XRRCrtcInfo* ci;
|
||||||
@ -306,7 +313,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
|
|
||||||
// Build array of available resolutions
|
// Build array of available resolutions
|
||||||
|
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
XRRScreenResources* sr;
|
XRRScreenResources* sr;
|
||||||
@ -372,7 +379,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
|
|||||||
|
|
||||||
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||||
{
|
{
|
||||||
XRRScreenResources* sr;
|
XRRScreenResources* sr;
|
||||||
XRRCrtcInfo* ci;
|
XRRCrtcInfo* ci;
|
||||||
@ -399,3 +406,15 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
&mode->redBits, &mode->greenBits, &mode->blueBits);
|
&mode->redBits, &mode->greenBits, &mode->blueBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI RRCrtc glfwGetX11Monitor(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||||
|
return monitor->x11.crtc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -80,8 +80,6 @@ typedef struct _GLFWwindowX11
|
|||||||
|
|
||||||
// Various platform specific internal variables
|
// Various platform specific internal variables
|
||||||
GLboolean overrideRedirect; // True if window is OverrideRedirect
|
GLboolean overrideRedirect; // True if window is OverrideRedirect
|
||||||
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
|
// Cached position and size used to filter out duplicate events
|
||||||
int width, height;
|
int width, height;
|
||||||
@ -117,10 +115,22 @@ typedef struct _GLFWlibraryX11
|
|||||||
Atom NET_WM_PING;
|
Atom NET_WM_PING;
|
||||||
Atom NET_WM_STATE;
|
Atom NET_WM_STATE;
|
||||||
Atom NET_WM_STATE_FULLSCREEN;
|
Atom NET_WM_STATE_FULLSCREEN;
|
||||||
|
Atom NET_WM_BYPASS_COMPOSITOR;
|
||||||
Atom NET_ACTIVE_WINDOW;
|
Atom NET_ACTIVE_WINDOW;
|
||||||
Atom MOTIF_WM_HINTS;
|
Atom MOTIF_WM_HINTS;
|
||||||
|
|
||||||
// Selection atoms
|
// Xdnd (drag and drop) atoms
|
||||||
|
Atom XdndAware;
|
||||||
|
Atom XdndEnter;
|
||||||
|
Atom XdndPosition;
|
||||||
|
Atom XdndStatus;
|
||||||
|
Atom XdndActionCopy;
|
||||||
|
Atom XdndDrop;
|
||||||
|
Atom XdndLeave;
|
||||||
|
Atom XdndFinished;
|
||||||
|
Atom XdndSelection;
|
||||||
|
|
||||||
|
// Selection (clipboard) atoms
|
||||||
Atom TARGETS;
|
Atom TARGETS;
|
||||||
Atom MULTIPLE;
|
Atom MULTIPLE;
|
||||||
Atom CLIPBOARD;
|
Atom CLIPBOARD;
|
||||||
@ -150,6 +160,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
int versionMajor;
|
int versionMajor;
|
||||||
int versionMinor;
|
int versionMinor;
|
||||||
GLboolean gammaBroken;
|
GLboolean gammaBroken;
|
||||||
|
GLboolean monitorBroken;
|
||||||
} randr;
|
} randr;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -190,6 +201,10 @@ typedef struct _GLFWlibraryX11
|
|||||||
char* string;
|
char* string;
|
||||||
} selection;
|
} selection;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Window source;
|
||||||
|
} xdnd;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int present;
|
int present;
|
||||||
int fd;
|
int fd;
|
||||||
@ -225,14 +240,6 @@ void _glfwInitTimer(void);
|
|||||||
// Gamma
|
// Gamma
|
||||||
void _glfwInitGammaRamp(void);
|
void _glfwInitGammaRamp(void);
|
||||||
|
|
||||||
// OpenGL support
|
|
||||||
int _glfwInitContextAPI(void);
|
|
||||||
void _glfwTerminateContextAPI(void);
|
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
|
||||||
const _GLFWwndconfig* wndconfig,
|
|
||||||
const _GLFWfbconfig* fbconfig);
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window);
|
|
||||||
|
|
||||||
// Fullscreen support
|
// Fullscreen support
|
||||||
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -854,38 +854,36 @@ static struct codepair {
|
|||||||
|
|
||||||
// Convert X11 KeySym to Unicode
|
// Convert X11 KeySym to Unicode
|
||||||
//
|
//
|
||||||
long _glfwKeySym2Unicode( KeySym keysym )
|
long _glfwKeySym2Unicode(KeySym keysym)
|
||||||
{
|
{
|
||||||
int min = 0;
|
int min = 0;
|
||||||
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
|
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
|
||||||
int mid;
|
int mid;
|
||||||
|
|
||||||
/* First check for Latin-1 characters (1:1 mapping) */
|
// First check for Latin-1 characters (1:1 mapping)
|
||||||
if( (keysym >= 0x0020 && keysym <= 0x007e) ||
|
if ((keysym >= 0x0020 && keysym <= 0x007e) ||
|
||||||
(keysym >= 0x00a0 && keysym <= 0x00ff) )
|
(keysym >= 0x00a0 && keysym <= 0x00ff))
|
||||||
{ return keysym;
|
{
|
||||||
|
return keysym;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Also check for directly encoded 24-bit UCS characters */
|
// Also check for directly encoded 24-bit UCS characters
|
||||||
if( (keysym & 0xff000000) == 0x01000000 )
|
if ((keysym & 0xff000000) == 0x01000000)
|
||||||
return keysym & 0x00ffffff;
|
return keysym & 0x00ffffff;
|
||||||
|
|
||||||
/* Binary search in table */
|
// Binary search in table
|
||||||
while( max >= min )
|
while (max >= min)
|
||||||
{
|
{
|
||||||
mid = (min + max) / 2;
|
mid = (min + max) / 2;
|
||||||
if( keysymtab[mid].keysym < keysym )
|
if (keysymtab[mid].keysym < keysym)
|
||||||
min = mid + 1;
|
min = mid + 1;
|
||||||
else if( keysymtab[mid].keysym > keysym )
|
else if (keysymtab[mid].keysym > keysym)
|
||||||
max = mid - 1;
|
max = mid - 1;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
/* Found it! */
|
|
||||||
return keysymtab[mid].ucs;
|
return keysymtab[mid].ucs;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* No matching Unicode value found */
|
// No matching Unicode value found
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
293
src/x11_window.c
293
src/x11_window.c
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// GLFW 3.0 X11 - www.glfw.org
|
// GLFW 3.1 X11 - www.glfw.org
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
@ -97,6 +97,51 @@ static int translateChar(XKeyEvent* event)
|
|||||||
return (int) _glfwKeySym2Unicode(keysym);
|
return (int) _glfwKeySym2Unicode(keysym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Splits a text/uri-list into separate file paths
|
||||||
|
//
|
||||||
|
static char** splitUriList(char* text, int* count)
|
||||||
|
{
|
||||||
|
const char* prefix = "file://";
|
||||||
|
char** names = NULL;
|
||||||
|
char* line;
|
||||||
|
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
while ((line = strtok(text, "\r\n")))
|
||||||
|
{
|
||||||
|
text = NULL;
|
||||||
|
|
||||||
|
if (*line == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strncmp(line, prefix, strlen(prefix)) == 0)
|
||||||
|
line += strlen(prefix);
|
||||||
|
|
||||||
|
(*count)++;
|
||||||
|
|
||||||
|
char* name = calloc(strlen(line) + 1, 1);
|
||||||
|
names = realloc(names, *count * sizeof(char*));
|
||||||
|
names[*count - 1] = name;
|
||||||
|
|
||||||
|
while (*line)
|
||||||
|
{
|
||||||
|
if (line[0] == '%' && line[1] && line[2])
|
||||||
|
{
|
||||||
|
const char digits[3] = { line[1], line[2], '\0' };
|
||||||
|
*name = strtol(digits, NULL, 16);
|
||||||
|
line += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*name = *line;
|
||||||
|
|
||||||
|
name++;
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the X11 window (and its colormap)
|
// Create the X11 window (and its colormap)
|
||||||
//
|
//
|
||||||
static GLboolean createWindow(_GLFWwindow* window,
|
static GLboolean createWindow(_GLFWwindow* window,
|
||||||
@ -129,13 +174,15 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
if (wndconfig->monitor == NULL)
|
if (wndconfig->monitor == NULL)
|
||||||
{
|
{
|
||||||
// HACK: This is a workaround for windows without a background pixel
|
// HACK: This is a workaround for windows without a background pixel
|
||||||
// not getting any decorations on certain older versions of Compiz
|
// not getting any decorations on certain older versions of
|
||||||
// running on Intel hardware
|
// Compiz running on Intel hardware
|
||||||
wa.background_pixel = BlackPixel(_glfw.x11.display,
|
wa.background_pixel = BlackPixel(_glfw.x11.display,
|
||||||
_glfw.x11.screen);
|
_glfw.x11.screen);
|
||||||
wamask |= CWBackPixel;
|
wamask |= CWBackPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_glfwGrabXErrorHandler();
|
||||||
|
|
||||||
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
||||||
_glfw.x11.root,
|
_glfw.x11.root,
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -147,12 +194,12 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
wamask,
|
wamask,
|
||||||
&wa);
|
&wa);
|
||||||
|
|
||||||
|
_glfwReleaseXErrorHandler();
|
||||||
|
|
||||||
if (!window->x11.handle)
|
if (!window->x11.handle)
|
||||||
{
|
{
|
||||||
// TODO: Handle all the various error codes here and translate them
|
_glfwInputXError(GLFW_PLATFORM_ERROR,
|
||||||
// to GLFW errors
|
"X11: Failed to create window");
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to create window");
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,13 +250,13 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
// The WM_DELETE_WINDOW ICCCM protocol
|
// The WM_DELETE_WINDOW ICCCM protocol
|
||||||
// Basic window close notification 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;
|
protocols[count++] = _glfw.x11.WM_DELETE_WINDOW;
|
||||||
|
|
||||||
// The _NET_WM_PING EWMH protocol
|
// The _NET_WM_PING EWMH protocol
|
||||||
// Tells the WM to ping the GLFW window and flag the application as
|
// 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
|
// 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;
|
protocols[count++] = _glfw.x11.NET_WM_PING;
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
@ -219,7 +266,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.x11.NET_WM_PID != None)
|
if (_glfw.x11.NET_WM_PID)
|
||||||
{
|
{
|
||||||
const pid_t pid = getpid();
|
const pid_t pid = getpid();
|
||||||
|
|
||||||
@ -256,6 +303,14 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
hints->flags |= PPosition;
|
hints->flags |= PPosition;
|
||||||
_glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
|
_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)
|
if (!wndconfig->resizable)
|
||||||
{
|
{
|
||||||
@ -296,6 +351,15 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
|
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_glfw.x11.XdndAware)
|
||||||
|
{
|
||||||
|
// Announce support for Xdnd (drag and drop)
|
||||||
|
const Atom version = 5;
|
||||||
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
|
_glfw.x11.XdndAware, XA_ATOM, 32,
|
||||||
|
PropModeReplace, (unsigned char*) &version, 1);
|
||||||
|
}
|
||||||
|
|
||||||
_glfwPlatformSetWindowTitle(window, wndconfig->title);
|
_glfwPlatformSetWindowTitle(window, wndconfig->title);
|
||||||
|
|
||||||
XRRSelectInput(_glfw.x11.display, window->x11.handle,
|
XRRSelectInput(_glfw.x11.display, window->x11.handle,
|
||||||
@ -307,64 +371,30 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide cursor
|
// Hide the mouse cursor
|
||||||
//
|
//
|
||||||
static void hideCursor(_GLFWwindow* window)
|
static void hideCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
|
|
||||||
// want the cursor grabbed in order to confine the cursor to the window
|
|
||||||
// area)
|
|
||||||
if (window->x11.cursorGrabbed && window->monitor == NULL)
|
|
||||||
{
|
|
||||||
XUngrabPointer(_glfw.x11.display, CurrentTime);
|
XUngrabPointer(_glfw.x11.display, CurrentTime);
|
||||||
window->x11.cursorGrabbed = GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window->x11.cursorHidden)
|
|
||||||
{
|
|
||||||
XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.cursor);
|
XDefineCursor(_glfw.x11.display, window->x11.handle, _glfw.x11.cursor);
|
||||||
window->x11.cursorHidden = GL_TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture cursor
|
// Disable the mouse cursor
|
||||||
//
|
//
|
||||||
static void captureCursor(_GLFWwindow* window)
|
static void disableCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
hideCursor(window);
|
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
|
||||||
|
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
|
||||||
if (!window->x11.cursorGrabbed)
|
GrabModeAsync, GrabModeAsync,
|
||||||
{
|
window->x11.handle, _glfw.x11.cursor, CurrentTime);
|
||||||
if (XGrabPointer(_glfw.x11.display, window->x11.handle, True,
|
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
|
||||||
PointerMotionMask, GrabModeAsync, GrabModeAsync,
|
|
||||||
window->x11.handle, None, CurrentTime) ==
|
|
||||||
GrabSuccess)
|
|
||||||
{
|
|
||||||
window->x11.cursorGrabbed = GL_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show cursor
|
// Restores the mouse cursor
|
||||||
//
|
//
|
||||||
static void showCursor(_GLFWwindow* window)
|
static void restoreCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
|
|
||||||
// want the cursor grabbed in order to confine the cursor to the window
|
|
||||||
// area)
|
|
||||||
if (window->x11.cursorGrabbed && window->monitor == NULL)
|
|
||||||
{
|
|
||||||
XUngrabPointer(_glfw.x11.display, CurrentTime);
|
XUngrabPointer(_glfw.x11.display, CurrentTime);
|
||||||
window->x11.cursorGrabbed = GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show cursor
|
|
||||||
if (window->x11.cursorHidden)
|
|
||||||
{
|
|
||||||
XUndefineCursor(_glfw.x11.display, window->x11.handle);
|
XUndefineCursor(_glfw.x11.display, window->x11.handle);
|
||||||
window->x11.cursorHidden = GL_FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter fullscreen mode
|
// Enter fullscreen mode
|
||||||
@ -389,15 +419,22 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
|||||||
|
|
||||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||||
|
|
||||||
if (_glfw.x11.hasEWMH &&
|
if (_glfw.x11.NET_WM_BYPASS_COMPOSITOR)
|
||||||
_glfw.x11.NET_WM_STATE != None &&
|
{
|
||||||
_glfw.x11.NET_WM_STATE_FULLSCREEN != None)
|
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;
|
int x, y;
|
||||||
_glfwPlatformGetMonitorPos(window->monitor, &x, &y);
|
_glfwPlatformGetMonitorPos(window->monitor, &x, &y);
|
||||||
_glfwPlatformSetWindowPos(window, 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
|
// Ask the window manager to raise and focus the GLFW window
|
||||||
// Only focused windows with the _NET_WM_STATE_FULLSCREEN state end
|
// Only focused windows with the _NET_WM_STATE_FULLSCREEN state end
|
||||||
@ -477,9 +514,16 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
|||||||
_glfw.x11.saver.exposure);
|
_glfw.x11.saver.exposure);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.x11.hasEWMH &&
|
if (_glfw.x11.NET_WM_BYPASS_COMPOSITOR)
|
||||||
_glfw.x11.NET_WM_STATE != None &&
|
{
|
||||||
_glfw.x11.NET_WM_STATE_FULLSCREEN != None)
|
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
|
// Ask the window manager to make the GLFW window a normal window
|
||||||
// Normal windows usually have frames and other decorations
|
// Normal windows usually have frames and other decorations
|
||||||
@ -504,6 +548,7 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Process the specified X event
|
// Process the specified X event
|
||||||
//
|
//
|
||||||
static void processEvent(XEvent *event)
|
static void processEvent(XEvent *event)
|
||||||
@ -618,18 +663,12 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
|
||||||
hideCursor(window);
|
|
||||||
|
|
||||||
_glfwInputCursorEnter(window, GL_TRUE);
|
_glfwInputCursorEnter(window, GL_TRUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
{
|
{
|
||||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
|
||||||
showCursor(window);
|
|
||||||
|
|
||||||
_glfwInputCursorEnter(window, GL_FALSE);
|
_glfwInputCursorEnter(window, GL_FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -707,7 +746,7 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
_glfwInputWindowCloseRequest(window);
|
_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)
|
(Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING)
|
||||||
{
|
{
|
||||||
// The window manager is pinging the application to ensure it's
|
// The window manager is pinging the application to ensure it's
|
||||||
@ -720,6 +759,95 @@ static void processEvent(XEvent *event)
|
|||||||
SubstructureNotifyMask | SubstructureRedirectMask,
|
SubstructureNotifyMask | SubstructureRedirectMask,
|
||||||
event);
|
event);
|
||||||
}
|
}
|
||||||
|
else if (event->xclient.message_type == _glfw.x11.XdndEnter)
|
||||||
|
{
|
||||||
|
// A drag operation has entered the window
|
||||||
|
// TODO: Check if UTF-8 string is supported by the source
|
||||||
|
}
|
||||||
|
else if (event->xclient.message_type == _glfw.x11.XdndDrop)
|
||||||
|
{
|
||||||
|
// The drag operation has finished dropping on
|
||||||
|
// the window, ask to convert it to a UTF-8 string
|
||||||
|
_glfw.x11.xdnd.source = event->xclient.data.l[0];
|
||||||
|
XConvertSelection(_glfw.x11.display,
|
||||||
|
_glfw.x11.XdndSelection,
|
||||||
|
_glfw.x11.UTF8_STRING,
|
||||||
|
_glfw.x11.XdndSelection,
|
||||||
|
window->x11.handle, CurrentTime);
|
||||||
|
}
|
||||||
|
else if (event->xclient.message_type == _glfw.x11.XdndPosition)
|
||||||
|
{
|
||||||
|
// The drag operation has moved over the window
|
||||||
|
const int absX = (event->xclient.data.l[2] >> 16) & 0xFFFF;
|
||||||
|
const int absY = (event->xclient.data.l[2]) & 0xFFFF;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
_glfwPlatformGetWindowPos(window, &x, &y);
|
||||||
|
_glfwInputCursorMotion(window, absX - x, absY - y);
|
||||||
|
|
||||||
|
// Reply that we are ready to copy the dragged data
|
||||||
|
XEvent reply;
|
||||||
|
memset(&reply, 0, sizeof(reply));
|
||||||
|
|
||||||
|
reply.type = ClientMessage;
|
||||||
|
reply.xclient.window = event->xclient.data.l[0];
|
||||||
|
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
||||||
|
reply.xclient.format = 32;
|
||||||
|
reply.xclient.data.l[0] = window->x11.handle;
|
||||||
|
reply.xclient.data.l[1] = 1; // Always accept the dnd with no rectangle
|
||||||
|
reply.xclient.data.l[2] = 0; // Specify an empty rectangle
|
||||||
|
reply.xclient.data.l[3] = 0;
|
||||||
|
reply.xclient.data.l[4] = _glfw.x11.XdndActionCopy;
|
||||||
|
|
||||||
|
XSendEvent(_glfw.x11.display, window->x11.handle,
|
||||||
|
False, NoEventMask, &reply);
|
||||||
|
XFlush(_glfw.x11.display);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SelectionNotify:
|
||||||
|
{
|
||||||
|
if (event->xselection.property)
|
||||||
|
{
|
||||||
|
// The converted data from the drag operation has arrived
|
||||||
|
char* data;
|
||||||
|
const int result = _glfwGetWindowProperty(event->xselection.requestor,
|
||||||
|
event->xselection.property,
|
||||||
|
event->xselection.target,
|
||||||
|
(unsigned char**) &data);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
int i, count;
|
||||||
|
char** names = splitUriList(data, &count);
|
||||||
|
|
||||||
|
_glfwInputDrop(window, count, (const char**) names);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
free(names[i]);
|
||||||
|
free(names);
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(data);
|
||||||
|
|
||||||
|
XEvent reply;
|
||||||
|
memset(&reply, 0, sizeof(reply));
|
||||||
|
|
||||||
|
reply.type = ClientMessage;
|
||||||
|
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||||
|
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||||
|
reply.xclient.format = 32;
|
||||||
|
reply.xclient.data.l[0] = window->x11.handle;
|
||||||
|
reply.xclient.data.l[1] = result;
|
||||||
|
reply.xclient.data.l[2] = _glfw.x11.XdndActionCopy;
|
||||||
|
|
||||||
|
// Reply that all is well
|
||||||
|
XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source,
|
||||||
|
False, NoEventMask, &reply);
|
||||||
|
XFlush(_glfw.x11.display);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -741,7 +869,7 @@ static void processEvent(XEvent *event)
|
|||||||
_glfwInputWindowFocus(window, GL_TRUE);
|
_glfwInputWindowFocus(window, GL_TRUE);
|
||||||
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
captureCursor(window);
|
disableCursor(window);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -751,7 +879,7 @@ static void processEvent(XEvent *event)
|
|||||||
_glfwInputWindowFocus(window, GL_FALSE);
|
_glfwInputWindowFocus(window, GL_FALSE);
|
||||||
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
showCursor(window);
|
restoreCursor(window);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -913,7 +1041,7 @@ unsigned long _glfwGetWindowProperty(Window window,
|
|||||||
&bytesAfter,
|
&bytesAfter,
|
||||||
value);
|
value);
|
||||||
|
|
||||||
if (actualType != type)
|
if (type != AnyPropertyType && actualType != type)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return itemCount;
|
return itemCount;
|
||||||
@ -989,7 +1117,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_glfw.x11.NET_WM_NAME != None)
|
if (_glfw.x11.NET_WM_NAME)
|
||||||
{
|
{
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.NET_WM_NAME, _glfw.x11.UTF8_STRING, 8,
|
_glfw.x11.NET_WM_NAME, _glfw.x11.UTF8_STRING, 8,
|
||||||
@ -997,7 +1125,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
(unsigned char*) title, strlen(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,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.NET_WM_ICON_NAME, _glfw.x11.UTF8_STRING, 8,
|
_glfw.x11.NET_WM_ICON_NAME, _glfw.x11.UTF8_STRING, 8,
|
||||||
@ -1014,10 +1142,9 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
|||||||
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root,
|
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root,
|
||||||
0, 0, &x, &y, &child);
|
0, 0, &x, &y, &child);
|
||||||
|
|
||||||
if (child != None)
|
if (child)
|
||||||
{
|
{
|
||||||
int left, top;
|
int left, top;
|
||||||
|
|
||||||
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child,
|
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child,
|
||||||
0, 0, &left, &top, &child);
|
0, 0, &left, &top, &child);
|
||||||
|
|
||||||
@ -1095,6 +1222,9 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
// Override-redirect windows cannot be iconified or restored, as those
|
// Override-redirect windows cannot be iconified or restored, as those
|
||||||
// tasks are performed by the window manager
|
// tasks are performed by the window manager
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"X11: Iconification of full screen windows requires "
|
||||||
|
"a WM that supports EWMH");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,6 +1237,9 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
// Override-redirect windows cannot be iconified or restored, as those
|
// Override-redirect windows cannot be iconified or restored, as those
|
||||||
// tasks are performed by the window manager
|
// tasks are performed by the window manager
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"X11: Iconification of full screen windows requires "
|
||||||
|
"a WM that supports EWMH");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1148,10 +1281,8 @@ void _glfwPlatformWaitEvents(void)
|
|||||||
{
|
{
|
||||||
if (!XPending(_glfw.x11.display))
|
if (!XPending(_glfw.x11.display))
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
|
const int fd = ConnectionNumber(_glfw.x11.display);
|
||||||
fd = ConnectionNumber(_glfw.x11.display);
|
|
||||||
|
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(fd, &fds);
|
FD_SET(fd, &fds);
|
||||||
@ -1176,18 +1307,18 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
|||||||
0,0,0,0, (int) x, (int) y);
|
0,0,0,0, (int) x, (int) y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (window->cursorMode)
|
||||||
{
|
{
|
||||||
case GLFW_CURSOR_NORMAL:
|
case GLFW_CURSOR_NORMAL:
|
||||||
showCursor(window);
|
restoreCursor(window);
|
||||||
break;
|
break;
|
||||||
case GLFW_CURSOR_HIDDEN:
|
case GLFW_CURSOR_HIDDEN:
|
||||||
hideCursor(window);
|
hideCursor(window);
|
||||||
break;
|
break;
|
||||||
case GLFW_CURSOR_DISABLED:
|
case GLFW_CURSOR_DISABLED:
|
||||||
captureCursor(window);
|
disableCursor(window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,6 +381,16 @@ static void char_callback(GLFWwindow* window, unsigned int codepoint)
|
|||||||
get_character_string(codepoint));
|
get_character_string(codepoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drop_callback(GLFWwindow* window, int count, const char** names)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
printf("%08x at %0.3f: Drop input\n", counter++, glfwGetTime());
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
printf(" %i: \"%s\"\n", i, names[i]);
|
||||||
|
}
|
||||||
|
|
||||||
void monitor_callback(GLFWmonitor* monitor, int event)
|
void monitor_callback(GLFWmonitor* monitor, int event)
|
||||||
{
|
{
|
||||||
if (event == GLFW_CONNECTED)
|
if (event == GLFW_CONNECTED)
|
||||||
@ -457,6 +467,7 @@ int main(int argc, char** argv)
|
|||||||
glfwSetScrollCallback(window, scroll_callback);
|
glfwSetScrollCallback(window, scroll_callback);
|
||||||
glfwSetKeyCallback(window, key_callback);
|
glfwSetKeyCallback(window, key_callback);
|
||||||
glfwSetCharCallback(window, char_callback);
|
glfwSetCharCallback(window, char_callback);
|
||||||
|
glfwSetDropCallback(window, drop_callback);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
@ -54,9 +54,16 @@
|
|||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-r STRATEGY]\n");
|
printf("Usage: glfwinfo [-h] [-a API] [-m MAJOR] [-n MINOR] [-d] [-l] [-f] [-p PROFILE] [-r STRATEGY]\n");
|
||||||
printf("available APIs: " API_OPENGL " " API_OPENGL_ES "\n");
|
printf("Options:\n");
|
||||||
printf("available profiles: " PROFILE_NAME_CORE " " PROFILE_NAME_COMPAT "\n");
|
printf(" -a the client API to use (" API_OPENGL " or " API_OPENGL_ES ")\n");
|
||||||
printf("available strategies: " STRATEGY_NAME_NONE " " STRATEGY_NAME_LOSE "\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)
|
static void error_callback(int error, const char* description)
|
||||||
@ -186,9 +193,6 @@ int main(int argc, char** argv)
|
|||||||
GLint flags, mask;
|
GLint flags, mask;
|
||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
|
|
||||||
if (!valid_version())
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "a:dfhlm:n:p:r:")) != -1)
|
while ((ch = getopt(argc, argv, "a:dfhlm:n:p:r:")) != -1)
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
@ -249,11 +253,11 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
// Initialize GLFW and create window
|
// Initialize GLFW and create window
|
||||||
|
|
||||||
|
if (!valid_version())
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
|
@ -64,14 +64,12 @@ 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)
|
static void draw_joystick(Joystick* j, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int axis_width, axis_height;
|
const int axis_height = 3 * height / 4;
|
||||||
int button_width, button_height;
|
const int button_height = height / 4;
|
||||||
|
|
||||||
axis_width = width / j->axis_count;
|
if (j->axis_count)
|
||||||
axis_height = 3 * height / 4;
|
{
|
||||||
|
const int axis_width = width / j->axis_count;
|
||||||
button_width = width / j->button_count;
|
|
||||||
button_height = height / 4;
|
|
||||||
|
|
||||||
for (i = 0; i < j->axis_count; i++)
|
for (i = 0; i < j->axis_count; i++)
|
||||||
{
|
{
|
||||||
@ -89,6 +87,11 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height)
|
|||||||
x + (i + 1) * axis_width,
|
x + (i + 1) * axis_width,
|
||||||
y + 5 + (int) (value * (axis_height - 5)));
|
y + 5 + (int) (value * (axis_height - 5)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j->button_count)
|
||||||
|
{
|
||||||
|
const int button_width = width / j->button_count;
|
||||||
|
|
||||||
for (i = 0; i < j->button_count; i++)
|
for (i = 0; i < j->button_count; i++)
|
||||||
{
|
{
|
||||||
@ -102,6 +105,7 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height)
|
|||||||
x + (i + 1) * button_width,
|
x + (i + 1) * button_width,
|
||||||
y + axis_height + button_height);
|
y + axis_height + button_height);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_joysticks(GLFWwindow* window)
|
static void draw_joysticks(GLFWwindow* window)
|
||||||
|
@ -218,9 +218,6 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
// Cursor input bug test
|
// Cursor mode test
|
||||||
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
|
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied
|
// This software is provided 'as-is', without any express or implied
|
||||||
@ -23,10 +23,7 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
//
|
//
|
||||||
// This test came about as the result of bugs #1262764, #1726540 and
|
// This test allows you to switch between the various cursor modes
|
||||||
// #1726592, all reported by the user peterpp, hence the name
|
|
||||||
//
|
|
||||||
// The utility of this test outside of these bugs is uncertain
|
|
||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
@ -39,20 +36,6 @@ static GLboolean reopen = GL_FALSE;
|
|||||||
static double cursor_x;
|
static double cursor_x;
|
||||||
static double cursor_y;
|
static double cursor_y;
|
||||||
|
|
||||||
static void toggle_cursor(GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
|
|
||||||
{
|
|
||||||
printf("Released cursor\n");
|
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Captured cursor\n");
|
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
@ -60,31 +43,37 @@ static void error_callback(int error, const char* description)
|
|||||||
|
|
||||||
static void cursor_position_callback(GLFWwindow* window, double x, double y)
|
static void cursor_position_callback(GLFWwindow* window, double x, double y)
|
||||||
{
|
{
|
||||||
printf("Cursor moved to: %f %f (%f %f)\n", x, y, x - cursor_x, y - cursor_y);
|
printf("%0.3f: Cursor position: %f %f (%f %f)\n",
|
||||||
|
glfwGetTime(),
|
||||||
|
x, y, x - cursor_x, y - cursor_y);
|
||||||
|
|
||||||
cursor_x = x;
|
cursor_x = x;
|
||||||
cursor_y = y;
|
cursor_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
|
if (action != GLFW_PRESS)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case GLFW_KEY_SPACE:
|
case GLFW_KEY_D:
|
||||||
{
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
if (action == GLFW_PRESS)
|
break;
|
||||||
toggle_cursor(window);
|
|
||||||
|
case GLFW_KEY_H:
|
||||||
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GLFW_KEY_N:
|
||||||
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case GLFW_KEY_R:
|
case GLFW_KEY_R:
|
||||||
{
|
|
||||||
if (action == GLFW_PRESS)
|
|
||||||
reopen = GL_TRUE;
|
reopen = GL_TRUE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||||
|
Loading…
Reference in New Issue
Block a user