diff --git a/externals/glew-1.10.0/doc/advanced.html b/externals/glew-1.10.0/doc/advanced.html deleted file mode 100644 index a3cb7db90..000000000 --- a/externals/glew-1.10.0/doc/advanced.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - -
-
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Automatic Code Generation- --Starting from release 1.1.0, the source code and parts of the -documentation are automatically generated from the extension -specifications in a two-step process. In the first step, -specification files from the OpenGL registry are downloaded and -parsed. Skeleton descriptors are created for each extension. These -descriptors contain all necessary information for creating the source -code and documentation in a simple and compact format, including the -name of the extension, url link to the specification, tokens, function -declarations, typedefs and struct definitions. In the second step, -the header files as well as the library and glewinfo source are -generated from the descriptor files. The code generation scripts are -located in the auto subdirectory. - - --The code generation scripts require GNU make, wget, and perl. On -Windows, the simplest way to get access to these tools is to install -Cygwin, but make sure that the -root directory is mounted in binary mode. The makefile in the -auto directory provides the following build targets: - - -
Adding a New Extension- --To add a new extension, create a descriptor file for the extension in -auto/core and rerun the code generation scripts by typing -make clean; make in the auto directory. - - --The format of the descriptor file is given below. Items in -brackets are optional. - - -
-<Extension Name> -Take a look at one of the files in auto/core for an -example. Note that typedefs and function signatures should not be -terminated with a semicolon. - - -Custom Code Generation--Starting from GLEW 1.3.0, it is possible to control which extensions -to include in the libarary by specifying a list in -auto/custom.txt. This is useful when you do not need all the -extensions and would like to reduce the size of the source files. -Type make clean; make custom in the auto directory -to rerun the scripts with the custom list of extensions. - - --For example, the following is the list of extensions needed to get GLEW and the -utilities to compile. - - -
-WGL_ARB_extensions_string Multiple Rendering Contexts (GLEW MX)- -Starting with release 1.2.0, thread-safe support for multiple -rendering contexts, possibly with different capabilities, is -available. Since this is not required by most users, it is not added -to the binary releases to maintain compatibility between different -versions. To include multi-context support, you have to do the -following: -
Note that according to the MSDN -WGL documentation, you have to initialize the entry points for -every rendering context that use pixel formats with different -capabilities For example, the pixel formats provided by the generic -software OpenGL implementation by Microsoft vs. the hardware -accelerated pixel formats have different capabilities. GLEW by -default ignores this requirement, and does not define per-context -entry points (you can however do this using the steps described -above). Assuming a global namespace for the entry points works in -most situations, because typically all hardware accelerated pixel -formats provide the same entry points and capabilities. This means -that unless you use the multi-context version of GLEW, you need to -call glewInit() only once in your program, or more precisely, -once per process. - -Separate Namespace- --To avoid name clashes when linking with libraries that include the -same symbols, extension entry points are declared in a separate -namespace (release 1.1.0 and up). This is achieved by aliasing OpenGL -function names to their GLEW equivalents. For instance, -glFancyFunction is simply an alias to -glewFancyFunction. The separate namespace does not effect -token and function pointer definitions. - - -Known Issues- --GLEW requires GLX 1.2 for compatibility with GLUT. - - - - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Initializing GLEW--First you need to create a valid OpenGL rendering context and call -glewInit() to initialize the extension entry points. If -glewInit() returns GLEW_OK, the initialization -succeeded and you can use the available extensions as well as core -OpenGL functionality. For example: - - -
-#include <GL/glew.h> Checking for Extensions- --Starting from GLEW 1.1.0, you can find out if a particular extension -is available on your platform by querying globally defined variables -of the form GLEW_{extension_name}: - - -
-if (GLEW_ARB_vertex_program) -In GLEW 1.0.x, a global structure was used for this task. To ensure -binary compatibility between releases, the struct was replaced with a -set of variables. - - --You can also check for core OpenGL functionality. For example, to -see if OpenGL 1.3 is supported, do the following: - - -
-if (GLEW_VERSION_1_3) -In general, you can check if GLEW_{extension_name} or -GLEW_VERSION_{version} is true or false. - - --It is also possible to perform extension checks from string -input. Starting from the 1.3.0 release, use glewIsSupported -to check if the required core or extension functionality is -available: - - -
-if (glewIsSupported("GL_VERSION_1_4 GL_ARB_point_sprite")) -For extensions only, glewGetExtension provides a slower alternative -(GLEW 1.0.x-1.2.x). Note that in the 1.3.0 release -glewGetExtension was replaced with -glewIsSupported. - - -
-if (glewGetExtension("GL_ARB_fragment_program")) Experimental Drivers- --GLEW obtains information on the supported extensions from the graphics -driver. Experimental or pre-release drivers, however, might not -report every available extension through the standard mechanism, in -which case GLEW will report it unsupported. To circumvent this -situation, the glewExperimental global switch can be turned -on by setting it to GL_TRUE before calling -glewInit(), which ensures that all extensions with valid -entry points will be exposed. - - -Platform Specific Extensions- --Platform specific extensions are separated into two header files: -wglew.h and glxew.h, which define the available -WGL and GLX extensions. To determine if a certain -extension is supported, query WGLEW_{extension name} or -GLXEW_{extension_name}. For example: - - -
-#include <GL/wglew.h> -Alternatively, use wglewIsSupported or -glxewIsSupported to check for extensions from a string: - - -
-if (wglewIsSupported("WGL_ARB_pbuffer")) Utilities- --GLEW provides two command-line utilities: one for creating a list of -available extensions and visuals; and another for verifying extension -entry points. - - -visualinfo: extensions and visuals- --visualinfo is an extended version of glxinfo. The -Windows version creates a file called visualinfo.txt, which -contains a list of available OpenGL, WGL, and GLU extensions as well -as a table of visuals aka. pixel formats. Pbuffer and MRT capable -visuals are also included. For additional usage information, type -visualinfo -h. - - -glewinfo: extension verification utility- --glewinfo allows you to verify the entry points for the -extensions supported on your platform. The Windows version -reports the results to a text file called glewinfo.txt. The -Unix version prints the results to stdout. - - -Windows usage: -- -glewinfo [-pf <id>] where <id> is the pixel format id for which the -capabilities are displayed. - -Unix usage: -- -glewinfo [-display <dpy>] [-visual <id>] where <dpy> is the X11 display and <id> is -the visual id for which the capabilities are displayed. - - - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Building GLEW- -Windows- -A MS Visual Studio project is provided in the build/vc6 directory. -Pre-built shared and static libraries are also available for download. - -Makefile- -For platforms other than MS Windows, the provided Makefile is used. - -Command-line variables- -
Make targets- -
Requirements- -
sudo apt-get install Xmu-dev Xi-Dev- - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Credits- --GLEW was developed by Milan -Ikits and Marcelo -Magallon. They also perform occasional maintainance to make sure -that GLEW stays in mint condition. Aaron Lefohn, Joe Kniss, and Chris -Wyman were the first users and also assisted with the design and -debugging process. The acronym GLEW originates from Aaron Lefohn. -Pasi Kärkkäinen identified and fixed several problems with -GLX and SDL. Nate Robins created the wglinfo utility, to -which modifications were made by Michael Wimmer. - - -Copyright- --GLEW is originally derived from the EXTGL project by Lev Povalahev. -The source code is licensed under the Modified BSD -License, the Mesa 3-D License (MIT -License), and the Khronos License (MIT -License). The automatic code generation scripts are released under -the GNU GPL. - - - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Supported GLX Extensions- -
|
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - --The OpenGL Extension Wrangler Library (GLEW) is a cross-platform -open-source C/C++ extension loading library. GLEW provides efficient -run-time mechanisms for determining which OpenGL extensions are -supported on the target platform. OpenGL core and extension -functionality is exposed in a single header file. GLEW has been -tested on a variety of operating systems, including Windows, Linux, -Mac OS X, FreeBSD, Irix, and Solaris. - - -Downloads-
-GLEW is distributed
-as source and precompiled binaries. - --
-An up-to-date copy is also available using git: - -
-Unsupported snapshots are also available: - - - -Supported Extensions--The latest release contains support for OpenGL 4.4 and the following extensions: - - - -News-
Links- - - - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Installation- --To use the shared library version of GLEW, you need to copy the -headers and libraries into their destination directories. On Windows -this typically boils down to copying: - - -
- - --where {VC Root} is the Visual C++ root directory, typically -C:/Program Files/Microsoft Visual Studio/VC98 for Visual -Studio 6.0 or C:/Program Files/Microsoft Visual -Studio .NET 2003/Vc7/PlatformSDK for Visual Studio .NET. - - --On Unix, typing make install will attempt to install GLEW -into /usr/include/GL and /usr/lib. You can -customize the installation target via the GLEW_DEST -environment variable if you do not have write access to these -directories. - - -Building Your Project with GLEW--There are two ways to build your project with GLEW. - -Including the source files / project file--The simpler but less flexible way is to include glew.h and -glew.c into your project. On Windows, you also need to -define the GLEW_STATIC preprocessor token when building a -static library or executable, and the GLEW_BUILD preprocessor -token when building a dll. You also need to replace -<GL/gl.h> and <GL/glu.h> with -<glew.h> in your code and set the appropriate include -flag (-I) to tell the compiler where to look for it. For -example: - -
-#include <glew.h> -Depending on where you put glew.h you may also need to change -the include directives in glew.c. Note that if you are using -GLEW together with GLUT, you have to include glew.h first. -In addition, glew.h includes glu.h, so you do not -need to include it separately. - --On Windows, you also have the option of adding the supplied project -file glew_static.dsp to your workspace (solution) and compile -it together with your other projects. In this case you also need to -change the GLEW_BUILD preprocessor constant to -GLEW_STATIC when building a static library or executable, -otherwise you get build errors. - --Note that GLEW does not use the C -runtime library, so it does not matter which version (single-threaded, -multi-threaded or multi-threaded DLL) it is linked with (without -debugging information). It is, however, always a good idea to compile all -your projects including GLEW with the same C runtime settings. - - -Using GLEW as a shared library- --Alternatively, you can use the provided project files / makefile to -build a separate shared library you can link your projects with later. -In this case the best practice is to install glew.h, -glew32.lib, and glew32.dll / libGLEW.so to -where the OpenGL equivalents gl.h, opengl32.lib, and -opengl32.dll / libGL.so are located. Note that you -need administrative privileges to do this. If you do not have -administrator access and your system administrator will not do it for -you, you can install GLEW into your own lib and include subdirectories -and tell the compiler where to find it. Then you can just replace -<GL/gl.h> with <GL/glew.h> in your -program: - - -
-#include <GL/glew.h> -or: - - -
-#include <GL/glew.h> -Remember to link your project with glew32.lib, -glu32.lib, and opengl32.lib on Windows and -libGLEW.so, libGLU.so, and libGL.so on -Unix (-lGLEW -lGLU -lGL). - - --It is important to keep in mind that glew.h includes neither -windows.h nor gl.h. Also, GLEW will warn you by -issuing a preprocessor error in case you have included gl.h, -glext.h, or glATI.h before glew.h. - - - - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Change Log- --
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - |
-
|
-
-
-
-The OpenGL Extension Wrangler Library- - - - -Supported WGL Extensions- -
|
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
GLFWgammaramp | Gamma ramp |
GLFWvidmode | Video mode type |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
This is about compiling and linking programs that use GLFW. For information on how to write such programs, start with the introductory tutorial.
-In the files of your program where you use OpenGL or GLFW, you should include the GLFW 3 header file, i.e.:
-This defines all the constants, types and function prototypes of the GLFW API. It also includes the chosen client API header files (by default OpenGL), and defines all the constants and types necessary for those headers to work on that platform.
-For example, under Windows you are normally required to include windows.h
before including GL/gl.h
. This would make your source file tied to Windows and pollute your code's namespace with the whole Win32 API.
Instead, the GLFW header takes care of this for you, not by including windows.h
, but rather by itself duplicating only the necessary parts of it. It does this only where needed, so if windows.h
is included, the GLFW header does not try to redefine those symbols.
In other words:
-windows.h
or other platform-specific headers unless you plan on using those APIs directlyIf you are using an OpenGL extension loading library such as GLEW, the GLEW header should also be included before the GLFW one. The GLEW header defines macros that disable any OpenGL header that the GLFW header includes and GLEW will work as expected.
-These macros may be defined before the inclusion of the GLFW header and affect how that header behaves.
-GLFW_INCLUDE_GLCOREARB
makes the header include the modern GL/glcorearb.h
header (OpenGL/gl3.h
on OS X) instead of the regular OpenGL header.
GLFW_INCLUDE_ES1
makes the header include the OpenGL ES 1.x GLES/gl.h
header instead of the regular OpenGL header.
GLFW_INCLUDE_ES2
makes the header include the OpenGL ES 2.0 GLES2/gl2.h
header instead of the regular OpenGL header.
GLFW_INCLUDE_ES3
makes the header include the OpenGL ES 3.0 GLES3/gl3.h
header instead of the regular OpenGL header.
GLFW_INCLUDE_NONE
makes the header not include any client API header.
GLFW_INCLUDE_GLU
makes the header include the GLU header in addition to the OpenGL header. This should only be used with the default GL/gl.h
header (OpenGL/gl.h
on OS X), i.e. if you are not using any of the above macros.
GLFW_DLL
is necessary when using the GLFW DLL on Windows, in order to explain to the compiler that the GLFW functions will be coming from another executable. It has no function on other platforms.
The static version of the GLFW library is named glfw3
. When using this version, it is also necessary to link with some libraries that GLFW uses.
When linking a program under Windows that uses the static version of GLFW, you must link with opengl32
. If you are using GLU, you must also link with glu32
.
The link library for the GLFW DLL is named glfw3dll
. When compiling a program that uses the DLL version of GLFW, you need to define the GLFW_DLL
macro before any inclusion of the GLFW header. This can be done either with a compiler switch or by defining it in your source code.
A program using the GLFW DLL does not need to link against any of its dependencies, but you still have to link against opengl32
if your program uses OpenGL and glu32
if it uses GLU.
You can use the GLFW source tree directly from a project that uses CMake. This way, GLFW will be built along with your application as needed.
-Firstly, add the root directory of the GLFW source tree to your project. This will add the glfw
target and the necessary cache variables to your project.
add_subdirectory(path/to/glfw) -
To be able to include the GLFW header from your code, you need to tell the compiler where to find it.
-include_directories(path/to/glfw/include) -
Once GLFW has been added to the project, the GLFW_LIBRARIES
cache variable contains all link-time dependencies of GLFW as it is currently configured. To link against GLFW, link against them and the glfw
target.
target_link_libraries(myapp glfw ${GLFW_LIBRARIES}) -
Note that GLFW_LIBRARIES
does not include GLU, as GLFW does not use it. If your application needs GLU, you can add it to the list of dependencies with the OPENGL_glu_LIBRARY
cache variable, which is implicitly created when the GLFW CMake files look for OpenGL.
target_link_libraries(myapp glfw ${OPENGL_glu_LIBRARY} ${GLFW_LIBRARIES}) -
CMake can import settings from pkg-config, which GLFW supports. When you installed GLFW, the pkg-config file glfw3.pc
was installed along with it.
First you need to find the PkgConfig package. If this fails, you may need to install the pkg-config package for your distribution.
-find_package(PkgConfig REQUIRED) -
This creates the CMake commands to find pkg-config packages. Then you need to find the GLFW package.
-pkg_search_module(GLFW REQUIRED glfw3) -
This creates the CMake variables you need to use GLFW. To be able to include the GLFW header, you need to tell your compiler where it is.
-include_directories(${GLFW_INCLUDE_DIRS}) -
You also need to link against the correct libraries. If you are using the shared library version of GLFW, use the GLFW_LIBRARIES
variable.
target_link_libraries(simple ${GLFW_LIBRARIES}) -
If you are using the static library version of GLFW, use the GLFW_STATIC_LIBRARIES
variable instead.
target_link_libraries(simple ${GLFW_STATIC_LIBRARIES}) -
GLFW supports pkg-config, and glfw3.pc
file is generated when the GLFW library is built and installed along with it.
A typical compile and link command-line when using the static may look like this:
-cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3` -
If you are using the shared library, simply omit the --static
flag.
cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --libs glfw3` -
You can also use the glfw3.pc
file without installing it first, by using the PKG_CONFIG_PATH
environment variable.
env PKG_CONFIG_PATH=path/to/glfw/src cc `pkg-config --cflags glfw3` -o myprog myprog.c `pkg-config --static --libs glfw3` -
The dependencies do not include GLU, as GLFW does not need it. On OS X, GLU is built into the OpenGL framework, so if you need GLU you don't need to do anything extra. If you need GLU and are using Linux or BSD, you should add -lGLU
to your link flags.
See the manpage and other documentation for pkg-config and your compiler and linker for more information on how to link programs.
-If you are using the dynamic library version of GLFW, simply add it to the project dependencies.
-If you are using the static library version of GLFW, add it and the Cocoa, OpenGL and IOKit frameworks to the project as dependencies.
-If you do not wish to use pkg-config, you need to add the required frameworks and libraries to your command-line using the -l
and -framework
switches, i.e.:
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -
Note that you do not add the .framework
extension to a framework when adding it from the command-line.
The OpenGL framework contains both the OpenGL and GLU APIs, so there is nothing special to do when using GLU. Also note that even though your machine may have libGL
-style OpenGL libraries, they are for use with the X Window System and will not work with the OS X native version of GLFW.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
This chapter describes the various API extensions used by this version of GLFW. It lists what are essentially implementation details, but which are nonetheless vital knowledge for developers wishing to deploy their applications on machines with varied specifications.
-Note that the information in this appendix is not a part of the API specification but merely list some of the preconditions for certain parts of the API to function on a given machine. As such, any part of it may change in future versions without this being considered a breaking API change.
-As GLFW uses Xlib, directly, without any intervening toolkit library, it has sole responsibility for interacting well with the many and varied window managers in use on Unix-like systems. In order for applications and window managers to work well together, a number of standards and conventions have been developed that regulate behavior outside the scope of the X11 API; most importantly the Inter-Client Communication Conventions Manual (ICCCM) and Extended Window Manager Hints (EWMH) standards.
-GLFW uses the ICCCM WM_DELETE_WINDOW
protocol to intercept the user attempting to close the GLFW window. If the running window manager does not support this protocol, the close callback will never be called.
GLFW uses the EWMH _NET_WM_PING
protocol, allowing the window manager notify the user when the application has stopped responding, i.e. when it has ceased to process events. If the running window manager does not support this protocol, the user will not be notified if the application locks up.
GLFW uses the EWMH _NET_WM_STATE
protocol to tell the window manager to make the GLFW window full screen. If the running window manager does not support this protocol, full screen windows may not work properly. GLFW has a fallback code path in case this protocol is unavailable, but every window manager behaves slightly differently in this regard.
GLFW uses the clipboard manager protocol to push a clipboard string (i.e. selection) owned by a GLFW window about to be destroyed to the clipboard manager. If there is no running clipboard manager, the clipboard string will be unavailable once the window has been destroyed.
-The GLX API is the default API used to create OpenGL contexts on Unix-like systems using the X Window System.
-GLFW uses the GLXFBConfig
API to enumerate and select framebuffer pixel formats. This requires either GLX 1.3 or greater, or the GLX_SGIX_fbconfig
extension. Where both are available, the SGIX extension is preferred. If neither is available, GLFW will be unable to create windows.
GLFW uses the GLX_MESA_swap_control,
GLX_EXT_swap_control
and GLX_SGI_swap_control
extensions to provide vertical retrace synchronization (or "vsync"), in that order of preference. Where none of these extension are available, calling glfwSwapInterval will have no effect.
GLFW uses the GLX_ARB_multisample
extension to create contexts with multisampling anti-aliasing. Where this extension is unavailable, the GLFW_SAMPLES
hint will have no effect.
GLFW uses the GLX_ARB_create_context
extension when available, even when creating OpenGL contexts of version 2.1 and below. Where this extension is unavailable, the GLFW_CONTEXT_VERSION_MAJOR
and GLFW_CONTEXT_VERSION_MINOR
hints will only be partially supported, the GLFW_OPENGL_DEBUG_CONTEXT
hint will have no effect, and setting the GLFW_OPENGL_PROFILE
or GLFW_OPENGL_FORWARD_COMPAT
hints to a non-zero value will cause glfwCreateWindow to fail.
GLFW uses the GLX_ARB_create_context_profile
extension to provide support for context profiles. Where this extension is unavailable, setting the GLFW_OPENGL_PROFILE
hint to anything but zero, or setting GLFW_CLIENT_API
to anything but GLFW_OPENGL_API
will cause glfwCreateWindow to fail.
The WGL API is used to create OpenGL contexts on Microsoft Windows and other implementations of the Win32 API, such as Wine.
-GLFW uses either the WGL_EXT_extension_string
or the WGL_ARB_extension_string
extension to check for the presence of all other WGL extensions listed below. If both are available, the EXT one is preferred. If neither is available, no other extensions are used and many GLFW features related to context creation will have no effect or cause errors when used.
GLFW uses the WGL_EXT_swap_control
extension to provide vertical retrace synchronization (or 'vsync'). Where this extension is unavailable, calling glfwSwapInterval will have no effect.
GLFW uses the WGL_ARB_pixel_format
and WGL_ARB_multisample
extensions to create contexts with multisampling anti-aliasing. Where these extensions are unavailable, the GLFW_SAMPLES
hint will have no effect.
GLFW uses the WGL_ARB_create_context
extension when available, even when creating OpenGL contexts of version 2.1 and below. Where this extension is unavailable, the GLFW_CONTEXT_VERSION_MAJOR
and GLFW_CONTEXT_VERSION_MINOR
hints will only be partially supported, the GLFW_OPENGL_DEBUG_CONTEXT
hint will have no effect, and setting the GLFW_OPENGL_PROFILE
or GLFW_OPENGL_FORWARD_COMPAT
hints to a non-zero value will cause glfwCreateWindow to fail.
GLFW uses the WGL_ARB_create_context_profile
extension to provide support for context profiles. Where this extension is unavailable, setting the GLFW_OPENGL_PROFILE
hint to anything but zero will cause glfwCreateWindow to fail.
Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then only forward-compatible, core profile contexts are supported. Support for OpenGL 4.1 was introduced with OS X 10.9, also limited to forward-compatible, core profile contexts. There is also still no mechanism for requesting debug contexts. Versions of Mac OS X earlier than 10.7 support at most OpenGL version 2.1.
-Because of this, on OS X 10.7 and later, the GLFW_CONTEXT_VERSION_MAJOR
and GLFW_CONTEXT_VERSION_MINOR
hints will cause glfwCreateWindow to fail if given version 3.0 or 3.1, the GLFW_OPENGL_FORWARD_COMPAT
is required for creating contexts for OpenGL 3.2 and later, the GLFW_OPENGL_DEBUG_CONTEXT
hint is ignored and setting the GLFW_OPENGL_PROFILE
hint to anything except GLFW_OPENGL_CORE_PROFILE
will cause glfwCreateWindow to fail.
Also, on Mac OS X 10.6 and below, the GLFW_CONTEXT_VERSION_MAJOR
and GLFW_CONTEXT_VERSION_MINOR
hints will fail if given a version above 2.1, the GLFW_OPENGL_DEBUG_CONTEXT
hint will have no effect, and setting the GLFW_OPENGL_PROFILE
or GLFW_OPENGL_FORWARD_COMPAT
hints to a non-zero value will cause glfwCreateWindow to fail.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
The primary purpose of GLFW is to provide a simple interface to window management and OpenGL and OpenGL ES context creation. GLFW supports multiple windows, each of which has its own context.
-The GLFWwindow object encapsulates both a window and a context. They are created with glfwCreateWindow and destroyed with glfwDestroyWindow (or glfwTerminate, if any remain). As the window and context are inseparably linked, the object pointer is used as both a context and window handle.
-There are a number of hints, specified using glfwWindowHint, related to what kind of context is created. See context related hints in the window handling guide.
-Before you can use the OpenGL or OpenGL ES APIs, you need to have a current context of the proper type. The context encapsulates all render state and all objects like textures and shaders.
-Note that a context can only be current for a single thread at a time, and a thread can only have a single context at a time.
-A context is made current with glfwMakeContextCurrent.
-The current context is returned by glfwGetCurrentContext.
-See swapping buffers in the window handling guide.
-One of the benefits of OpenGL is its extensibility. Independent hardware vendors (IHVs) may include functionality in their OpenGL implementations that expand upon the OpenGL standard before that functionality is included in a new version of the OpenGL specification.
-An extension is defined by:
-GL_ARB_debug_output
)GL_DEBUG_SEVERITY_HIGH_ARB
)glGetDebugMessageLogARB
)Note the ARB
affix, which stands for Architecture Review Board and is used for official extensions. There are many different affixes, depending on who wrote the extension. A list of extensions, together with their specifications, can be found at the OpenGL Registry.
To use a certain extension, you must first check whether the context supports that extension and then, if it introduces new functions, retrieve the pointers to those functions.
-This can be done with GLFW, as will be described in this section, but usually you will instead want to use a dedicated extension loading library such as GLEW. This kind of library greatly reduces the amount of work necessary to use both OpenGL extensions and modern versions of the OpenGL API. GLEW in particular has been extensively tested with and works well with GLFW.
-The glext.h
header is a continually updated file that defines the interfaces for all OpenGL extensions. The latest version of this can always be found at the OpenGL Registry. It it strongly recommended that you use your own copy, as the one shipped with your development environment may be several years out of date and may not include the extensions you wish to use.
The header defines function pointer types for all functions of all extensions it supports. These have names like PFNGLGETDEBUGMESSAGELOGARB
(for glGetDebugMessageLogARB
), i.e. the name is made uppercase and PFN
and PROC
are added to the ends.
A given machine may not actually support the extension (it may have older drivers or a graphics card that lacks the necessary hardware features), so it is necessary to check whether the context supports the extension. This is done with glfwExtensionSupported.
-The argument is a null terminated ASCII string with the extension name. If the extension is supported, glfwExtensionSupported returns non-zero, otherwise it returns zero.
-Many extensions, though not all, require the use of new OpenGL functions. These entry points are often not exposed by your link libraries, making it necessary to fetch them at run time. With glfwGetProcAddress you can retrieve the address of extension and non-extension OpenGL functions.
-In general, you should avoid giving the function pointer variables the (exact) same name as the function, as this may confuse your linker. Instead, you can use a different prefix, like above, or some other naming scheme.
-Now that all the pieces have been introduced, here is what they might look like when used together.
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Files | |
file | glfw3.h [code] |
file | glfw3native.h [code] |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Directories | |
directory | include |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Directories | |
directory | GLFW |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
glfw3.h | |
glfw3native.h |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
Go to the source code of this file.
--Data Structures | |
struct | GLFWvidmode |
Video mode type. More... | |
struct | GLFWgammaramp |
Gamma ramp. More... | |
-Macros | |
#define | GLFW_KEY_UNKNOWN -1 |
#define | GLFW_KEY_SPACE 32 |
#define | GLFW_KEY_APOSTROPHE 39 /* ' */ |
#define | GLFW_KEY_COMMA 44 /* , */ |
#define | GLFW_KEY_MINUS 45 /* - */ |
#define | GLFW_KEY_PERIOD 46 /* . */ |
#define | GLFW_KEY_SLASH 47 /* / */ |
#define | GLFW_KEY_0 48 |
#define | GLFW_KEY_1 49 |
#define | GLFW_KEY_2 50 |
#define | GLFW_KEY_3 51 |
#define | GLFW_KEY_4 52 |
#define | GLFW_KEY_5 53 |
#define | GLFW_KEY_6 54 |
#define | GLFW_KEY_7 55 |
#define | GLFW_KEY_8 56 |
#define | GLFW_KEY_9 57 |
#define | GLFW_KEY_SEMICOLON 59 /* ; */ |
#define | GLFW_KEY_EQUAL 61 /* = */ |
#define | GLFW_KEY_A 65 |
#define | GLFW_KEY_B 66 |
#define | GLFW_KEY_C 67 |
#define | GLFW_KEY_D 68 |
#define | GLFW_KEY_E 69 |
#define | GLFW_KEY_F 70 |
#define | GLFW_KEY_G 71 |
#define | GLFW_KEY_H 72 |
#define | GLFW_KEY_I 73 |
#define | GLFW_KEY_J 74 |
#define | GLFW_KEY_K 75 |
#define | GLFW_KEY_L 76 |
#define | GLFW_KEY_M 77 |
#define | GLFW_KEY_N 78 |
#define | GLFW_KEY_O 79 |
#define | GLFW_KEY_P 80 |
#define | GLFW_KEY_Q 81 |
#define | GLFW_KEY_R 82 |
#define | GLFW_KEY_S 83 |
#define | GLFW_KEY_T 84 |
#define | GLFW_KEY_U 85 |
#define | GLFW_KEY_V 86 |
#define | GLFW_KEY_W 87 |
#define | GLFW_KEY_X 88 |
#define | GLFW_KEY_Y 89 |
#define | GLFW_KEY_Z 90 |
#define | GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
#define | GLFW_KEY_BACKSLASH 92 /* \ */ |
#define | GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
#define | GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
#define | GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
#define | GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
#define | GLFW_KEY_ESCAPE 256 |
#define | GLFW_KEY_ENTER 257 |
#define | GLFW_KEY_TAB 258 |
#define | GLFW_KEY_BACKSPACE 259 |
#define | GLFW_KEY_INSERT 260 |
#define | GLFW_KEY_DELETE 261 |
#define | GLFW_KEY_RIGHT 262 |
#define | GLFW_KEY_LEFT 263 |
#define | GLFW_KEY_DOWN 264 |
#define | GLFW_KEY_UP 265 |
#define | GLFW_KEY_PAGE_UP 266 |
#define | GLFW_KEY_PAGE_DOWN 267 |
#define | GLFW_KEY_HOME 268 |
#define | GLFW_KEY_END 269 |
#define | GLFW_KEY_CAPS_LOCK 280 |
#define | GLFW_KEY_SCROLL_LOCK 281 |
#define | GLFW_KEY_NUM_LOCK 282 |
#define | GLFW_KEY_PRINT_SCREEN 283 |
#define | GLFW_KEY_PAUSE 284 |
#define | GLFW_KEY_F1 290 |
#define | GLFW_KEY_F2 291 |
#define | GLFW_KEY_F3 292 |
#define | GLFW_KEY_F4 293 |
#define | GLFW_KEY_F5 294 |
#define | GLFW_KEY_F6 295 |
#define | GLFW_KEY_F7 296 |
#define | GLFW_KEY_F8 297 |
#define | GLFW_KEY_F9 298 |
#define | GLFW_KEY_F10 299 |
#define | GLFW_KEY_F11 300 |
#define | GLFW_KEY_F12 301 |
#define | GLFW_KEY_F13 302 |
#define | GLFW_KEY_F14 303 |
#define | GLFW_KEY_F15 304 |
#define | GLFW_KEY_F16 305 |
#define | GLFW_KEY_F17 306 |
#define | GLFW_KEY_F18 307 |
#define | GLFW_KEY_F19 308 |
#define | GLFW_KEY_F20 309 |
#define | GLFW_KEY_F21 310 |
#define | GLFW_KEY_F22 311 |
#define | GLFW_KEY_F23 312 |
#define | GLFW_KEY_F24 313 |
#define | GLFW_KEY_F25 314 |
#define | GLFW_KEY_KP_0 320 |
#define | GLFW_KEY_KP_1 321 |
#define | GLFW_KEY_KP_2 322 |
#define | GLFW_KEY_KP_3 323 |
#define | GLFW_KEY_KP_4 324 |
#define | GLFW_KEY_KP_5 325 |
#define | GLFW_KEY_KP_6 326 |
#define | GLFW_KEY_KP_7 327 |
#define | GLFW_KEY_KP_8 328 |
#define | GLFW_KEY_KP_9 329 |
#define | GLFW_KEY_KP_DECIMAL 330 |
#define | GLFW_KEY_KP_DIVIDE 331 |
#define | GLFW_KEY_KP_MULTIPLY 332 |
#define | GLFW_KEY_KP_SUBTRACT 333 |
#define | GLFW_KEY_KP_ADD 334 |
#define | GLFW_KEY_KP_ENTER 335 |
#define | GLFW_KEY_KP_EQUAL 336 |
#define | GLFW_KEY_LEFT_SHIFT 340 |
#define | GLFW_KEY_LEFT_CONTROL 341 |
#define | GLFW_KEY_LEFT_ALT 342 |
#define | GLFW_KEY_LEFT_SUPER 343 |
#define | GLFW_KEY_RIGHT_SHIFT 344 |
#define | GLFW_KEY_RIGHT_CONTROL 345 |
#define | GLFW_KEY_RIGHT_ALT 346 |
#define | GLFW_KEY_RIGHT_SUPER 347 |
#define | GLFW_KEY_MENU 348 |
#define | GLFW_KEY_LAST GLFW_KEY_MENU |
#define | GLFW_MOD_SHIFT 0x0001 |
If this bit is set one or more Shift keys were held down. More... | |
#define | GLFW_MOD_CONTROL 0x0002 |
If this bit is set one or more Control keys were held down. More... | |
#define | GLFW_MOD_ALT 0x0004 |
If this bit is set one or more Alt keys were held down. More... | |
#define | GLFW_MOD_SUPER 0x0008 |
If this bit is set one or more Super keys were held down. More... | |
#define | GLFW_MOUSE_BUTTON_1 0 |
#define | GLFW_MOUSE_BUTTON_2 1 |
#define | GLFW_MOUSE_BUTTON_3 2 |
#define | GLFW_MOUSE_BUTTON_4 3 |
#define | GLFW_MOUSE_BUTTON_5 4 |
#define | GLFW_MOUSE_BUTTON_6 5 |
#define | GLFW_MOUSE_BUTTON_7 6 |
#define | GLFW_MOUSE_BUTTON_8 7 |
#define | GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
#define | GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
#define | GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
#define | GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
#define | GLFW_JOYSTICK_1 0 |
#define | GLFW_JOYSTICK_2 1 |
#define | GLFW_JOYSTICK_3 2 |
#define | GLFW_JOYSTICK_4 3 |
#define | GLFW_JOYSTICK_5 4 |
#define | GLFW_JOYSTICK_6 5 |
#define | GLFW_JOYSTICK_7 6 |
#define | GLFW_JOYSTICK_8 7 |
#define | GLFW_JOYSTICK_9 8 |
#define | GLFW_JOYSTICK_10 9 |
#define | GLFW_JOYSTICK_11 10 |
#define | GLFW_JOYSTICK_12 11 |
#define | GLFW_JOYSTICK_13 12 |
#define | GLFW_JOYSTICK_14 13 |
#define | GLFW_JOYSTICK_15 14 |
#define | GLFW_JOYSTICK_16 15 |
#define | GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
#define | GLFW_NOT_INITIALIZED 0x00010001 |
GLFW has not been initialized. More... | |
#define | GLFW_NO_CURRENT_CONTEXT 0x00010002 |
No context is current for this thread. More... | |
#define | GLFW_INVALID_ENUM 0x00010003 |
One of the enum parameters for the function was given an invalid enum. More... | |
#define | GLFW_INVALID_VALUE 0x00010004 |
One of the parameters for the function was given an invalid value. More... | |
#define | GLFW_OUT_OF_MEMORY 0x00010005 |
A memory allocation failed. More... | |
#define | GLFW_API_UNAVAILABLE 0x00010006 |
GLFW could not find support for the requested client API on the system. More... | |
#define | GLFW_VERSION_UNAVAILABLE 0x00010007 |
The requested client API version is not available. More... | |
#define | GLFW_PLATFORM_ERROR 0x00010008 |
A platform-specific error occurred that does not match any of the more specific categories. More... | |
#define | GLFW_FORMAT_UNAVAILABLE 0x00010009 |
The clipboard did not contain data in the requested format. More... | |
#define | GLFW_FOCUSED 0x00020001 |
#define | GLFW_ICONIFIED 0x00020002 |
#define | GLFW_RESIZABLE 0x00020003 |
#define | GLFW_VISIBLE 0x00020004 |
#define | GLFW_DECORATED 0x00020005 |
#define | GLFW_RED_BITS 0x00021001 |
#define | GLFW_GREEN_BITS 0x00021002 |
#define | GLFW_BLUE_BITS 0x00021003 |
#define | GLFW_ALPHA_BITS 0x00021004 |
#define | GLFW_DEPTH_BITS 0x00021005 |
#define | GLFW_STENCIL_BITS 0x00021006 |
#define | GLFW_ACCUM_RED_BITS 0x00021007 |
#define | GLFW_ACCUM_GREEN_BITS 0x00021008 |
#define | GLFW_ACCUM_BLUE_BITS 0x00021009 |
#define | GLFW_ACCUM_ALPHA_BITS 0x0002100A |
#define | GLFW_AUX_BUFFERS 0x0002100B |
#define | GLFW_STEREO 0x0002100C |
#define | GLFW_SAMPLES 0x0002100D |
#define | GLFW_SRGB_CAPABLE 0x0002100E |
#define | GLFW_REFRESH_RATE 0x0002100F |
#define | GLFW_CLIENT_API 0x00022001 |
#define | GLFW_CONTEXT_VERSION_MAJOR 0x00022002 |
#define | GLFW_CONTEXT_VERSION_MINOR 0x00022003 |
#define | GLFW_CONTEXT_REVISION 0x00022004 |
#define | GLFW_CONTEXT_ROBUSTNESS 0x00022005 |
#define | GLFW_OPENGL_FORWARD_COMPAT 0x00022006 |
#define | GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 |
#define | GLFW_OPENGL_PROFILE 0x00022008 |
#define | GLFW_OPENGL_API 0x00030001 |
#define | GLFW_OPENGL_ES_API 0x00030002 |
#define | GLFW_NO_ROBUSTNESS 0 |
#define | GLFW_NO_RESET_NOTIFICATION 0x00031001 |
#define | GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 |
#define | GLFW_OPENGL_ANY_PROFILE 0 |
#define | GLFW_OPENGL_CORE_PROFILE 0x00032001 |
#define | GLFW_OPENGL_COMPAT_PROFILE 0x00032002 |
#define | GLFW_CURSOR 0x00033001 |
#define | GLFW_STICKY_KEYS 0x00033002 |
#define | GLFW_STICKY_MOUSE_BUTTONS 0x00033003 |
#define | GLFW_CURSOR_NORMAL 0x00034001 |
#define | GLFW_CURSOR_HIDDEN 0x00034002 |
#define | GLFW_CURSOR_DISABLED 0x00034003 |
#define | GLFW_CONNECTED 0x00040001 |
#define | GLFW_DISCONNECTED 0x00040002 |
GLFW version macros | |
#define | GLFW_VERSION_MAJOR 3 |
The major version number of the GLFW library. More... | |
#define | GLFW_VERSION_MINOR 0 |
The minor version number of the GLFW library. More... | |
#define | GLFW_VERSION_REVISION 2 |
The revision number of the GLFW library. More... | |
Key and button actions | |
#define | GLFW_RELEASE 0 |
The key or button was released. More... | |
#define | GLFW_PRESS 1 |
The key or button was pressed. More... | |
#define | GLFW_REPEAT 2 |
The key was held down until it repeated. More... | |
-Typedefs | |
typedef void(* | GLFWglproc )(void) |
Client API function pointer type. More... | |
typedef struct GLFWmonitor | GLFWmonitor |
typedef struct GLFWwindow | GLFWwindow |
typedef void(* | GLFWerrorfun )(int, const char *) |
The function signature for error callbacks. More... | |
typedef void(* | GLFWwindowposfun )(GLFWwindow *, int, int) |
The function signature for window position callbacks. More... | |
typedef void(* | GLFWwindowsizefun )(GLFWwindow *, int, int) |
The function signature for window resize callbacks. More... | |
typedef void(* | GLFWwindowclosefun )(GLFWwindow *) |
The function signature for window close callbacks. More... | |
typedef void(* | GLFWwindowrefreshfun )(GLFWwindow *) |
The function signature for window content refresh callbacks. More... | |
typedef void(* | GLFWwindowfocusfun )(GLFWwindow *, int) |
The function signature for window focus/defocus callbacks. More... | |
typedef void(* | GLFWwindowiconifyfun )(GLFWwindow *, int) |
The function signature for window iconify/restore callbacks. More... | |
typedef void(* | GLFWframebuffersizefun )(GLFWwindow *, int, int) |
The function signature for framebuffer resize callbacks. More... | |
typedef void(* | GLFWmousebuttonfun )(GLFWwindow *, int, int, int) |
The function signature for mouse button callbacks. More... | |
typedef void(* | GLFWcursorposfun )(GLFWwindow *, double, double) |
The function signature for cursor position callbacks. More... | |
typedef void(* | GLFWcursorenterfun )(GLFWwindow *, int) |
The function signature for cursor enter/leave callbacks. More... | |
typedef void(* | GLFWscrollfun )(GLFWwindow *, double, double) |
The function signature for scroll callbacks. More... | |
typedef void(* | GLFWkeyfun )(GLFWwindow *, int, int, int, int) |
The function signature for keyboard key callbacks. More... | |
typedef void(* | GLFWcharfun )(GLFWwindow *, unsigned int) |
The function signature for Unicode character callbacks. More... | |
typedef void(* | GLFWmonitorfun )(GLFWmonitor *, int) |
The function signature for monitor configuration callbacks. More... | |
-Functions | |
int | glfwInit (void) |
Initializes the GLFW library. More... | |
void | glfwTerminate (void) |
Terminates the GLFW library. More... | |
void | glfwGetVersion (int *major, int *minor, int *rev) |
Retrieves the version of the GLFW library. More... | |
const char * | glfwGetVersionString (void) |
Returns a string describing the compile-time configuration. More... | |
GLFWerrorfun | glfwSetErrorCallback (GLFWerrorfun cbfun) |
Sets the error callback. More... | |
GLFWmonitor ** | glfwGetMonitors (int *count) |
Returns the currently connected monitors. More... | |
GLFWmonitor * | glfwGetPrimaryMonitor (void) |
Returns the primary monitor. More... | |
void | glfwGetMonitorPos (GLFWmonitor *monitor, int *xpos, int *ypos) |
Returns the position of the monitor's viewport on the virtual screen. More... | |
void | glfwGetMonitorPhysicalSize (GLFWmonitor *monitor, int *width, int *height) |
Returns the physical size of the monitor. More... | |
const char * | glfwGetMonitorName (GLFWmonitor *monitor) |
Returns the name of the specified monitor. More... | |
GLFWmonitorfun | glfwSetMonitorCallback (GLFWmonitorfun cbfun) |
Sets the monitor configuration callback. More... | |
const GLFWvidmode * | glfwGetVideoModes (GLFWmonitor *monitor, int *count) |
Returns the available video modes for the specified monitor. More... | |
const GLFWvidmode * | glfwGetVideoMode (GLFWmonitor *monitor) |
Returns the current mode of the specified monitor. More... | |
void | glfwSetGamma (GLFWmonitor *monitor, float gamma) |
Generates a gamma ramp and sets it for the specified monitor. More... | |
const GLFWgammaramp * | glfwGetGammaRamp (GLFWmonitor *monitor) |
Retrieves the current gamma ramp for the specified monitor. More... | |
void | glfwSetGammaRamp (GLFWmonitor *monitor, const GLFWgammaramp *ramp) |
Sets the current gamma ramp for the specified monitor. More... | |
void | glfwDefaultWindowHints (void) |
Resets all window hints to their default values. More... | |
void | glfwWindowHint (int target, int hint) |
Sets the specified window hint to the desired value. More... | |
GLFWwindow * | glfwCreateWindow (int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share) |
Creates a window and its associated context. More... | |
void | glfwDestroyWindow (GLFWwindow *window) |
Destroys the specified window and its context. More... | |
int | glfwWindowShouldClose (GLFWwindow *window) |
Checks the close flag of the specified window. More... | |
void | glfwSetWindowShouldClose (GLFWwindow *window, int value) |
Sets the close flag of the specified window. More... | |
void | glfwSetWindowTitle (GLFWwindow *window, const char *title) |
Sets the title of the specified window. More... | |
void | glfwGetWindowPos (GLFWwindow *window, int *xpos, int *ypos) |
Retrieves the position of the client area of the specified window. More... | |
void | glfwSetWindowPos (GLFWwindow *window, int xpos, int ypos) |
Sets the position of the client area of the specified window. More... | |
void | glfwGetWindowSize (GLFWwindow *window, int *width, int *height) |
Retrieves the size of the client area of the specified window. More... | |
void | glfwSetWindowSize (GLFWwindow *window, int width, int height) |
Sets the size of the client area of the specified window. More... | |
void | glfwGetFramebufferSize (GLFWwindow *window, int *width, int *height) |
Retrieves the size of the framebuffer of the specified window. More... | |
void | glfwIconifyWindow (GLFWwindow *window) |
Iconifies the specified window. More... | |
void | glfwRestoreWindow (GLFWwindow *window) |
Restores the specified window. More... | |
void | glfwShowWindow (GLFWwindow *window) |
Makes the specified window visible. More... | |
void | glfwHideWindow (GLFWwindow *window) |
Hides the specified window. More... | |
GLFWmonitor * | glfwGetWindowMonitor (GLFWwindow *window) |
Returns the monitor that the window uses for full screen mode. More... | |
int | glfwGetWindowAttrib (GLFWwindow *window, int attrib) |
Returns an attribute of the specified window. More... | |
void | glfwSetWindowUserPointer (GLFWwindow *window, void *pointer) |
Sets the user pointer of the specified window. More... | |
void * | glfwGetWindowUserPointer (GLFWwindow *window) |
Returns the user pointer of the specified window. More... | |
GLFWwindowposfun | glfwSetWindowPosCallback (GLFWwindow *window, GLFWwindowposfun cbfun) |
Sets the position callback for the specified window. More... | |
GLFWwindowsizefun | glfwSetWindowSizeCallback (GLFWwindow *window, GLFWwindowsizefun cbfun) |
Sets the size callback for the specified window. More... | |
GLFWwindowclosefun | glfwSetWindowCloseCallback (GLFWwindow *window, GLFWwindowclosefun cbfun) |
Sets the close callback for the specified window. More... | |
GLFWwindowrefreshfun | glfwSetWindowRefreshCallback (GLFWwindow *window, GLFWwindowrefreshfun cbfun) |
Sets the refresh callback for the specified window. More... | |
GLFWwindowfocusfun | glfwSetWindowFocusCallback (GLFWwindow *window, GLFWwindowfocusfun cbfun) |
Sets the focus callback for the specified window. More... | |
GLFWwindowiconifyfun | glfwSetWindowIconifyCallback (GLFWwindow *window, GLFWwindowiconifyfun cbfun) |
Sets the iconify callback for the specified window. More... | |
GLFWframebuffersizefun | glfwSetFramebufferSizeCallback (GLFWwindow *window, GLFWframebuffersizefun cbfun) |
Sets the framebuffer resize callback for the specified window. More... | |
void | glfwPollEvents (void) |
Processes all pending events. More... | |
void | glfwWaitEvents (void) |
Waits until events are pending and processes them. More... | |
int | glfwGetInputMode (GLFWwindow *window, int mode) |
Returns the value of an input option for the specified window. More... | |
void | glfwSetInputMode (GLFWwindow *window, int mode, int value) |
Sets an input option for the specified window. More... | |
int | glfwGetKey (GLFWwindow *window, int key) |
Returns the last reported state of a keyboard key for the specified window. More... | |
int | glfwGetMouseButton (GLFWwindow *window, int button) |
Returns the last reported state of a mouse button for the specified window. More... | |
void | glfwGetCursorPos (GLFWwindow *window, double *xpos, double *ypos) |
Retrieves the last reported cursor position, relative to the client area of the window. More... | |
void | glfwSetCursorPos (GLFWwindow *window, double xpos, double ypos) |
Sets the position of the cursor, relative to the client area of the window. More... | |
GLFWkeyfun | glfwSetKeyCallback (GLFWwindow *window, GLFWkeyfun cbfun) |
Sets the key callback. More... | |
GLFWcharfun | glfwSetCharCallback (GLFWwindow *window, GLFWcharfun cbfun) |
Sets the Unicode character callback. More... | |
GLFWmousebuttonfun | glfwSetMouseButtonCallback (GLFWwindow *window, GLFWmousebuttonfun cbfun) |
Sets the mouse button callback. More... | |
GLFWcursorposfun | glfwSetCursorPosCallback (GLFWwindow *window, GLFWcursorposfun cbfun) |
Sets the cursor position callback. More... | |
GLFWcursorenterfun | glfwSetCursorEnterCallback (GLFWwindow *window, GLFWcursorenterfun cbfun) |
Sets the cursor enter/exit callback. More... | |
GLFWscrollfun | glfwSetScrollCallback (GLFWwindow *window, GLFWscrollfun cbfun) |
Sets the scroll callback. More... | |
int | glfwJoystickPresent (int joy) |
Returns whether the specified joystick is present. More... | |
const float * | glfwGetJoystickAxes (int joy, int *count) |
Returns the values of all axes of the specified joystick. More... | |
const unsigned char * | glfwGetJoystickButtons (int joy, int *count) |
Returns the state of all buttons of the specified joystick. More... | |
const char * | glfwGetJoystickName (int joy) |
Returns the name of the specified joystick. More... | |
void | glfwSetClipboardString (GLFWwindow *window, const char *string) |
Sets the clipboard to the specified string. More... | |
const char * | glfwGetClipboardString (GLFWwindow *window) |
Retrieves the contents of the clipboard as a string. More... | |
double | glfwGetTime (void) |
Returns the value of the GLFW timer. More... | |
void | glfwSetTime (double time) |
Sets the GLFW timer. More... | |
void | glfwMakeContextCurrent (GLFWwindow *window) |
Makes the context of the specified window current for the calling thread. More... | |
GLFWwindow * | glfwGetCurrentContext (void) |
Returns the window whose context is current on the calling thread. More... | |
void | glfwSwapBuffers (GLFWwindow *window) |
Swaps the front and back buffers of the specified window. More... | |
void | glfwSwapInterval (int interval) |
Sets the swap interval for the current context. More... | |
int | glfwExtensionSupported (const char *extension) |
Returns whether the specified extension is available. More... | |
GLFWglproc | glfwGetProcAddress (const char *procname) |
Returns the address of the specified function for the current context. More... | |
#define GLFW_ACCUM_ALPHA_BITS 0x0002100A | -
#define GLFW_ACCUM_BLUE_BITS 0x00021009 | -
#define GLFW_ACCUM_GREEN_BITS 0x00021008 | -
#define GLFW_ACCUM_RED_BITS 0x00021007 | -
#define GLFW_ALPHA_BITS 0x00021004 | -
#define GLFW_AUX_BUFFERS 0x0002100B | -
#define GLFW_BLUE_BITS 0x00021003 | -
#define GLFW_CLIENT_API 0x00022001 | -
#define GLFW_CONNECTED 0x00040001 | -
#define GLFW_CONTEXT_REVISION 0x00022004 | -
#define GLFW_CONTEXT_ROBUSTNESS 0x00022005 | -
#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 | -
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003 | -
#define GLFW_CURSOR 0x00033001 | -
#define GLFW_CURSOR_DISABLED 0x00034003 | -
#define GLFW_CURSOR_HIDDEN 0x00034002 | -
#define GLFW_CURSOR_NORMAL 0x00034001 | -
#define GLFW_DECORATED 0x00020005 | -
#define GLFW_DEPTH_BITS 0x00021005 | -
#define GLFW_DISCONNECTED 0x00040002 | -
#define GLFW_FOCUSED 0x00020001 | -
#define GLFW_GREEN_BITS 0x00021002 | -
#define GLFW_ICONIFIED 0x00020002 | -
#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002 | -
#define GLFW_NO_RESET_NOTIFICATION 0x00031001 | -
#define GLFW_NO_ROBUSTNESS 0 | -
#define GLFW_OPENGL_ANY_PROFILE 0 | -
#define GLFW_OPENGL_API 0x00030001 | -
#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002 | -
#define GLFW_OPENGL_CORE_PROFILE 0x00032001 | -
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 | -
#define GLFW_OPENGL_ES_API 0x00030002 | -
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 | -
#define GLFW_OPENGL_PROFILE 0x00022008 | -
#define GLFW_RED_BITS 0x00021001 | -
#define GLFW_REFRESH_RATE 0x0002100F | -
#define GLFW_RESIZABLE 0x00020003 | -
#define GLFW_SAMPLES 0x0002100D | -
#define GLFW_SRGB_CAPABLE 0x0002100E | -
#define GLFW_STENCIL_BITS 0x00021006 | -
#define GLFW_STEREO 0x0002100C | -
#define GLFW_STICKY_KEYS 0x00033002 | -
#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003 | -
#define GLFW_VISIBLE 0x00020004 | -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
Go to the source code of this file.
--Functions | |
HWND | glfwGetWin32Window (GLFWwindow *window) |
Returns the HWND of the specified window. More... | |
HGLRC | glfwGetWGLContext (GLFWwindow *window) |
Returns the HGLRC of the specified window. More... | |
id | glfwGetCocoaWindow (GLFWwindow *window) |
Returns the NSWindow of the specified window. More... | |
id | glfwGetNSGLContext (GLFWwindow *window) |
Returns the NSOpenGLContext of the specified window. More... | |
Display * | glfwGetX11Display (void) |
Returns the Display used by GLFW. More... | |
Window | glfwGetX11Window (GLFWwindow *window) |
Returns the Window of the specified window. More... | |
GLXContext | glfwGetGLXContext (GLFWwindow *window) |
Returns the GLXContext of the specified window. More... | |
EGLDisplay | glfwGetEGLDisplay (void) |
Returns the EGLDisplay used by GLFW. More... | |
EGLContext | glfwGetEGLContext (GLFWwindow *window) |
Returns the EGLContext of the specified window. More... | |
EGLSurface | glfwGetEGLSurface (GLFWwindow *window) |
Returns the EGLSurface of the specified window. More... | |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Macros | |
#define | GLFW_MOUSE_BUTTON_1 0 |
#define | GLFW_MOUSE_BUTTON_2 1 |
#define | GLFW_MOUSE_BUTTON_3 2 |
#define | GLFW_MOUSE_BUTTON_4 3 |
#define | GLFW_MOUSE_BUTTON_5 4 |
#define | GLFW_MOUSE_BUTTON_6 5 |
#define | GLFW_MOUSE_BUTTON_7 6 |
#define | GLFW_MOUSE_BUTTON_8 7 |
#define | GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 |
#define | GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 |
#define | GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 |
#define | GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 |
#define GLFW_MOUSE_BUTTON_1 0 | -
#define GLFW_MOUSE_BUTTON_2 1 | -
#define GLFW_MOUSE_BUTTON_3 2 | -
#define GLFW_MOUSE_BUTTON_4 3 | -
#define GLFW_MOUSE_BUTTON_5 4 | -
#define GLFW_MOUSE_BUTTON_6 5 | -
#define GLFW_MOUSE_BUTTON_7 6 | -
#define GLFW_MOUSE_BUTTON_8 7 | -
#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8 | -
#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1 | -
#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3 | -
#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2 | -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Functions | |
void | glfwSetClipboardString (GLFWwindow *window, const char *string) |
Sets the clipboard to the specified string. More... | |
const char * | glfwGetClipboardString (GLFWwindow *window) |
Retrieves the contents of the clipboard as a string. More... | |
const char* glfwGetClipboardString | -( | -GLFWwindow * | -window | ) | -- |
This function returns the contents of the system clipboard, if it contains or is convertible to a UTF-8 encoded string.
-[in] | window | The window that will request the clipboard contents. |
NULL
if an error occurred.void glfwSetClipboardString | -( | -GLFWwindow * | -window, | -
- | - | const char * | -string | -
- | ) | -- |
This function sets the system clipboard to the specified, UTF-8 encoded string. The string is copied before returning, so you don't have to retain it afterwards.
-[in] | window | The window that will own the clipboard contents. |
[in] | string | A UTF-8 encoded string. |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Typedefs | |
typedef void(* | GLFWglproc )(void) |
Client API function pointer type. More... | |
-Functions | |
void | glfwMakeContextCurrent (GLFWwindow *window) |
Makes the context of the specified window current for the calling thread. More... | |
GLFWwindow * | glfwGetCurrentContext (void) |
Returns the window whose context is current on the calling thread. More... | |
void | glfwSwapBuffers (GLFWwindow *window) |
Swaps the front and back buffers of the specified window. More... | |
void | glfwSwapInterval (int interval) |
Sets the swap interval for the current context. More... | |
int | glfwExtensionSupported (const char *extension) |
Returns whether the specified extension is available. More... | |
GLFWglproc | glfwGetProcAddress (const char *procname) |
Returns the address of the specified function for the current context. More... | |
typedef void(* GLFWglproc)(void) | -
Generic function pointer used for returning client API function pointers without forcing a cast from a regular pointer.
- -int glfwExtensionSupported | -( | -const char * | -extension | ) | -- |
This function returns whether the specified OpenGL or context creation API extension is supported by the current context. For example, on Windows both the OpenGL and WGL extension strings are checked.
-[in] | extension | The ASCII encoded name of the extension. |
GL_TRUE
if the extension is available, or GL_FALSE
otherwise.GLFWwindow* glfwGetCurrentContext | -( | -void | -) | -- |
This function returns the window whose context is current on the calling thread.
-NULL
if no window's context is current.GLFWglproc glfwGetProcAddress | -( | -const char * | -procname | ) | -- |
This function returns the address of the specified client API or extension function, if it is supported by the current context.
-[in] | procname | The ASCII encoded name of the function. |
NULL
if the function is unavailable.void glfwMakeContextCurrent | -( | -GLFWwindow * | -window | ) | -- |
This function makes the context of the specified window current on the calling thread. A context can only be made current on a single thread at a time and each thread can have only a single current context at a time.
-[in] | window | The window whose context to make current, or NULL to detach the current context. |
void glfwSwapBuffers | -( | -GLFWwindow * | -window | ) | -- |
This function swaps the front and back buffers of the specified window. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.
-[in] | window | The window whose buffers to swap. |
void glfwSwapInterval | -( | -int | -interval | ) | -- |
This function sets the swap interval for the current context, i.e. the number of screen updates to wait before swapping the buffers of a window and returning from glfwSwapBuffers. This is sometimes called 'vertical synchronization', 'vertical retrace synchronization' or 'vsync'.
-Contexts that support either of the WGL_EXT_swap_control_tear
and GLX_EXT_swap_control_tear
extensions also accept negative swap intervals, which allow the driver to swap even if a frame arrives a little bit late. You can check for the presence of these extensions using glfwExtensionSupported. For more information about swap tearing, see the extension specifications.
[in] | interval | The minimum number of screen updates to wait for until the buffers are swapped by glfwSwapBuffers. |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Modules | |
Error codes | |
-Typedefs | |
typedef void(* | GLFWerrorfun )(int, const char *) |
The function signature for error callbacks. More... | |
-Functions | |
GLFWerrorfun | glfwSetErrorCallback (GLFWerrorfun cbfun) |
Sets the error callback. More... | |
typedef void(* GLFWerrorfun)(int, const char *) | -
This is the function signature for error callback functions.
-[in] | error | An error code. |
[in] | description | A UTF-8 encoded string describing the error. |
GLFWerrorfun glfwSetErrorCallback | -( | -GLFWerrorfun | -cbfun | ) | -- |
This function sets the error callback, which is called with an error code and a human-readable description each time a GLFW error occurs.
-[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Macros | |
#define | GLFW_NOT_INITIALIZED 0x00010001 |
GLFW has not been initialized. More... | |
#define | GLFW_NO_CURRENT_CONTEXT 0x00010002 |
No context is current for this thread. More... | |
#define | GLFW_INVALID_ENUM 0x00010003 |
One of the enum parameters for the function was given an invalid enum. More... | |
#define | GLFW_INVALID_VALUE 0x00010004 |
One of the parameters for the function was given an invalid value. More... | |
#define | GLFW_OUT_OF_MEMORY 0x00010005 |
A memory allocation failed. More... | |
#define | GLFW_API_UNAVAILABLE 0x00010006 |
GLFW could not find support for the requested client API on the system. More... | |
#define | GLFW_VERSION_UNAVAILABLE 0x00010007 |
The requested client API version is not available. More... | |
#define | GLFW_PLATFORM_ERROR 0x00010008 |
A platform-specific error occurred that does not match any of the more specific categories. More... | |
#define | GLFW_FORMAT_UNAVAILABLE 0x00010009 |
The clipboard did not contain data in the requested format. More... | |
#define GLFW_API_UNAVAILABLE 0x00010006 | -
#define GLFW_FORMAT_UNAVAILABLE 0x00010009 | -
#define GLFW_INVALID_ENUM 0x00010003 | -
#define GLFW_INVALID_VALUE 0x00010004 | -
#define GLFW_NO_CURRENT_CONTEXT 0x00010002 | -
#define GLFW_NOT_INITIALIZED 0x00010001 | -
#define GLFW_OUT_OF_MEMORY 0x00010005 | -
#define GLFW_PLATFORM_ERROR 0x00010008 | -
#define GLFW_VERSION_UNAVAILABLE 0x00010007 | -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Functions | |
int | glfwInit (void) |
Initializes the GLFW library. More... | |
void | glfwTerminate (void) |
Terminates the GLFW library. More... | |
void | glfwGetVersion (int *major, int *minor, int *rev) |
Retrieves the version of the GLFW library. More... | |
const char * | glfwGetVersionString (void) |
Returns a string describing the compile-time configuration. More... | |
-GLFW version macros | |
#define | GLFW_VERSION_MAJOR 3 |
The major version number of the GLFW library. More... | |
#define | GLFW_VERSION_MINOR 0 |
The minor version number of the GLFW library. More... | |
#define | GLFW_VERSION_REVISION 2 |
The revision number of the GLFW library. More... | |
#define GLFW_VERSION_MAJOR 3 | -
This is incremented when the API is changed in non-compatible ways.
- -#define GLFW_VERSION_MINOR 0 | -
This is incremented when features are added to the API but it remains backward-compatible.
- -#define GLFW_VERSION_REVISION 2 | -
This is incremented when a bug fix release is made that does not contain any API changes.
- -void glfwGetVersion | -( | -int * | -major, | -
- | - | int * | -minor, | -
- | - | int * | -rev | -
- | ) | -- |
This function retrieves the major, minor and revision numbers of the GLFW library. It is intended for when you are using GLFW as a shared library and want to ensure that you are using the minimum required version.
-[out] | major | Where to store the major version number, or NULL . |
[out] | minor | Where to store the minor version number, or NULL . |
[out] | rev | Where to store the revision number, or NULL . |
const char* glfwGetVersionString | -( | -void | -) | -- |
This function returns a static string generated at compile-time according to which configuration macros were defined. This is intended for use when submitting bug reports, to allow developers to see which code paths are enabled in a binary.
-The format of the string is as follows:
-For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL back ends, the version string may look something like this:
-3.0.0 Win32 WGL MinGW -
int glfwInit | -( | -void | -) | -- |
This function initializes the GLFW library. Before most GLFW functions can be used, GLFW must be initialized, and before a program terminates GLFW should be terminated in order to free any resources allocated during or after initialization.
-If this function fails, it calls glfwTerminate before returning. If it succeeds, you should call glfwTerminate before the program exits.
-Additional calls to this function after successful initialization but before termination will succeed but will do nothing.
-GL_TRUE
if successful, or GL_FALSE
if an error occurred.atexit
.Contents/Resources
subdirectory of the application's bundle, if present.void glfwTerminate | -( | -void | -) | -- |
This function destroys all remaining windows, frees any allocated resources and sets the library to an uninitialized state. Once this is called, you must again call glfwInit successfully before you will be able to use most GLFW functions.
-If GLFW has been successfully initialized, this function should be called before the program exits. If initialization fails, there is no need to call this function, as it is called by glfwInit before it returns failure.
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Modules | |
Joysticks | |
Keyboard keys | |
Modifier key flags | |
Mouse buttons | |
-Typedefs | |
typedef void(* | GLFWmousebuttonfun )(GLFWwindow *, int, int, int) |
The function signature for mouse button callbacks. More... | |
typedef void(* | GLFWcursorposfun )(GLFWwindow *, double, double) |
The function signature for cursor position callbacks. More... | |
typedef void(* | GLFWcursorenterfun )(GLFWwindow *, int) |
The function signature for cursor enter/leave callbacks. More... | |
typedef void(* | GLFWscrollfun )(GLFWwindow *, double, double) |
The function signature for scroll callbacks. More... | |
typedef void(* | GLFWkeyfun )(GLFWwindow *, int, int, int, int) |
The function signature for keyboard key callbacks. More... | |
typedef void(* | GLFWcharfun )(GLFWwindow *, unsigned int) |
The function signature for Unicode character callbacks. More... | |
-Functions | |
int | glfwGetInputMode (GLFWwindow *window, int mode) |
Returns the value of an input option for the specified window. More... | |
void | glfwSetInputMode (GLFWwindow *window, int mode, int value) |
Sets an input option for the specified window. More... | |
int | glfwGetKey (GLFWwindow *window, int key) |
Returns the last reported state of a keyboard key for the specified window. More... | |
int | glfwGetMouseButton (GLFWwindow *window, int button) |
Returns the last reported state of a mouse button for the specified window. More... | |
void | glfwGetCursorPos (GLFWwindow *window, double *xpos, double *ypos) |
Retrieves the last reported cursor position, relative to the client area of the window. More... | |
void | glfwSetCursorPos (GLFWwindow *window, double xpos, double ypos) |
Sets the position of the cursor, relative to the client area of the window. More... | |
GLFWkeyfun | glfwSetKeyCallback (GLFWwindow *window, GLFWkeyfun cbfun) |
Sets the key callback. More... | |
GLFWcharfun | glfwSetCharCallback (GLFWwindow *window, GLFWcharfun cbfun) |
Sets the Unicode character callback. More... | |
GLFWmousebuttonfun | glfwSetMouseButtonCallback (GLFWwindow *window, GLFWmousebuttonfun cbfun) |
Sets the mouse button callback. More... | |
GLFWcursorposfun | glfwSetCursorPosCallback (GLFWwindow *window, GLFWcursorposfun cbfun) |
Sets the cursor position callback. More... | |
GLFWcursorenterfun | glfwSetCursorEnterCallback (GLFWwindow *window, GLFWcursorenterfun cbfun) |
Sets the cursor enter/exit callback. More... | |
GLFWscrollfun | glfwSetScrollCallback (GLFWwindow *window, GLFWscrollfun cbfun) |
Sets the scroll callback. More... | |
int | glfwJoystickPresent (int joy) |
Returns whether the specified joystick is present. More... | |
const float * | glfwGetJoystickAxes (int joy, int *count) |
Returns the values of all axes of the specified joystick. More... | |
const unsigned char * | glfwGetJoystickButtons (int joy, int *count) |
Returns the state of all buttons of the specified joystick. More... | |
const char * | glfwGetJoystickName (int joy) |
Returns the name of the specified joystick. More... | |
-Key and button actions | |
#define | GLFW_RELEASE 0 |
The key or button was released. More... | |
#define | GLFW_PRESS 1 |
The key or button was pressed. More... | |
#define | GLFW_REPEAT 2 |
The key was held down until it repeated. More... | |
#define GLFW_PRESS 1 | -
#define GLFW_RELEASE 0 | -
#define GLFW_REPEAT 2 | -
typedef void(* GLFWcharfun)(GLFWwindow *, unsigned int) | -
This is the function signature for Unicode character callback functions.
-[in] | window | The window that received the event. |
[in] | character | The Unicode code point of the character. |
typedef void(* GLFWcursorenterfun)(GLFWwindow *, int) | -
This is the function signature for cursor enter/leave callback functions.
-[in] | window | The window that received the event. |
[in] | entered | GL_TRUE if the cursor entered the window's client area, or GL_FALSE if it left it. |
typedef void(* GLFWcursorposfun)(GLFWwindow *, double, double) | -
This is the function signature for cursor position callback functions.
-[in] | window | The window that received the event. |
[in] | xpos | The new x-coordinate of the cursor. |
[in] | ypos | The new y-coordinate of the cursor. |
typedef void(* GLFWkeyfun)(GLFWwindow *, int, int, int, int) | -
This is the function signature for keyboard key callback functions.
-[in] | window | The window that received the event. |
[in] | key | The keyboard key that was pressed or released. |
[in] | scancode | The system-specific scancode of the key. |
[in] | action | GLFW_PRESS, GLFW_RELEASE or GLFW_REPEAT. |
[in] | mods | Bit field describing which modifier keys were held down. |
typedef void(* GLFWmousebuttonfun)(GLFWwindow *, int, int, int) | -
This is the function signature for mouse button callback functions.
-[in] | window | The window that received the event. |
[in] | button | The mouse button that was pressed or released. |
[in] | action | One of GLFW_PRESS or GLFW_RELEASE . |
[in] | mods | Bit field describing which modifier keys were held down. |
typedef void(* GLFWscrollfun)(GLFWwindow *, double, double) | -
This is the function signature for scroll callback functions.
-[in] | window | The window that received the event. |
[in] | xoffset | The scroll offset along the x-axis. |
[in] | yoffset | The scroll offset along the y-axis. |
void glfwGetCursorPos | -( | -GLFWwindow * | -window, | -
- | - | double * | -xpos, | -
- | - | double * | -ypos | -
- | ) | -- |
This function returns the last reported position of the cursor to the specified window.
-If the cursor is disabled (with GLFW_CURSOR_DISABLED
) then the cursor position is unbounded and limited only by the minimum and maximum values of a double
.
The coordinate can be converted to their integer equivalents with the floor
function. Casting directly to an integer type works for positive coordinates, but fails for negative ones.
[in] | window | The desired window. |
[out] | xpos | Where to store the cursor x-coordinate, relative to the left edge of the client area, or NULL . |
[out] | ypos | Where to store the cursor y-coordinate, relative to the to top edge of the client area, or NULL . |
int glfwGetInputMode | -( | -GLFWwindow * | -window, | -
- | - | int | -mode | -
- | ) | -- |
[in] | window | The window to query. |
[in] | mode | One of GLFW_CURSOR , GLFW_STICKY_KEYS or GLFW_STICKY_MOUSE_BUTTONS . |
const float* glfwGetJoystickAxes | -( | -int | -joy, | -
- | - | int * | -count | -
- | ) | -- |
This function returns the values of all axes of the specified joystick.
-[in] | joy | The joystick to query. |
[out] | count | Where to store the size of the returned array. This is set to zero if an error occurred. |
NULL
if the joystick is not present.const unsigned char* glfwGetJoystickButtons | -( | -int | -joy, | -
- | - | int * | -count | -
- | ) | -- |
This function returns the state of all buttons of the specified joystick.
-[in] | joy | The joystick to query. |
[out] | count | Where to store the size of the returned array. This is set to zero if an error occurred. |
NULL
if the joystick is not present.const char* glfwGetJoystickName | -( | -int | -joy | ) | -- |
This function returns the name, encoded as UTF-8, of the specified joystick.
-[in] | joy | The joystick to query. |
NULL
if the joystick is not present.int glfwGetKey | -( | -GLFWwindow * | -window, | -
- | - | int | -key | -
- | ) | -- |
This function returns the last state reported for the specified key to the specified window. The returned state is one of GLFW_PRESS
or GLFW_RELEASE
. The higher-level state GLFW_REPEAT
is only reported to the key callback.
If the GLFW_STICKY_KEYS
input mode is enabled, this function returns GLFW_PRESS
the first time you call this function after a key has been pressed, even if the key has already been released.
The key functions deal with physical keys, with key tokens named after their use on the standard US keyboard layout. If you want to input text, use the Unicode character callback instead.
-[in] | window | The desired window. |
[in] | key | The desired keyboard key. |
GLFW_PRESS
or GLFW_RELEASE
.GLFW_KEY_UNKNOWN
is not a valid key for this function. int glfwGetMouseButton | -( | -GLFWwindow * | -window, | -
- | - | int | -button | -
- | ) | -- |
This function returns the last state reported for the specified mouse button to the specified window.
-If the GLFW_STICKY_MOUSE_BUTTONS
input mode is enabled, this function returns GLFW_PRESS
the first time you call this function after a mouse button has been pressed, even if the mouse button has already been released.
[in] | window | The desired window. |
[in] | button | The desired mouse button. |
GLFW_PRESS
or GLFW_RELEASE
. int glfwJoystickPresent | -( | -int | -joy | ) | -- |
This function returns whether the specified joystick is present.
-[in] | joy | The joystick to query. |
GL_TRUE
if the joystick is present, or GL_FALSE
otherwise. GLFWcharfun glfwSetCharCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWcharfun | -cbfun | -
- | ) | -- |
This function sets the character callback of the specific window, which is called when a Unicode character is input.
-The character callback is intended for text input. If you want to know whether a specific key was pressed or released, use the key callback instead.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. GLFWcursorenterfun glfwSetCursorEnterCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWcursorenterfun | -cbfun | -
- | ) | -- |
This function sets the cursor boundary crossing callback of the specified window, which is called when the cursor enters or leaves the client area of the window.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. void glfwSetCursorPos | -( | -GLFWwindow * | -window, | -
- | - | double | -xpos, | -
- | - | double | -ypos | -
- | ) | -- |
This function sets the position of the cursor. The specified window must be focused. If the window does not have focus when this function is called, it fails silently.
-If the cursor is disabled (with GLFW_CURSOR_DISABLED
) then the cursor position is unbounded and limited only by the minimum and maximum values of a double
.
[in] | window | The desired window. |
[in] | xpos | The desired x-coordinate, relative to the left edge of the client area, or NULL . |
[in] | ypos | The desired y-coordinate, relative to the top edge of the client area, or NULL . |
GLFWcursorposfun glfwSetCursorPosCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWcursorposfun | -cbfun | -
- | ) | -- |
This function sets the cursor position callback of the specified window, which is called when the cursor is moved. The callback is provided with the position relative to the upper-left corner of the client area of the window.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. void glfwSetInputMode | -( | -GLFWwindow * | -window, | -
- | - | int | -mode, | -
- | - | int | -value | -
- | ) | -- |
[in] | window | The window whose input mode to set. |
[in] | mode | One of GLFW_CURSOR , GLFW_STICKY_KEYS or GLFW_STICKY_MOUSE_BUTTONS . |
[in] | value | The new value of the specified input mode. |
If mode
is GLFW_CURSOR
, the value must be one of the supported input modes:
GLFW_CURSOR_NORMAL
makes the cursor visible and behaving normally.GLFW_CURSOR_HIDDEN
makes the cursor invisible when it is over the client area of the window.GLFW_CURSOR_DISABLED
disables the cursor and removes any limitations on cursor movement.If mode
is GLFW_STICKY_KEYS
, the value must be either GL_TRUE
to enable sticky keys, or GL_FALSE
to disable it. If sticky keys are enabled, a key press will ensure that glfwGetKey returns GLFW_PRESS the next time it is called even if the key had been released before the call. This is useful when you are only interested in whether keys have been pressed but not when or in which order.
If mode
is GLFW_STICKY_MOUSE_BUTTONS
, the value must be either GL_TRUE
to enable sticky mouse buttons, or GL_FALSE
to disable it. If sticky mouse buttons are enabled, a mouse button press will ensure that glfwGetMouseButton returns GLFW_PRESS the next time it is called even if the mouse button had been released before the call. This is useful when you are only interested in whether mouse buttons have been pressed but not when or in which order.
GLFWkeyfun glfwSetKeyCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWkeyfun | -cbfun | -
- | ) | -- |
This function sets the key callback of the specific window, which is called when a key is pressed, repeated or released.
-The key functions deal with physical keys, with layout independent key tokens named after their values in the standard US keyboard layout. If you want to input text, use the character callback instead.
-When a window loses focus, it will generate synthetic key release events for all pressed keys. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the window has lost focus, i.e. GLFW_FOCUSED
will be false and the focus callback will have already been called.
The scancode of a key is specific to that platform or sometimes even to that machine. Scancodes are intended to allow users to bind keys that don't have a GLFW key token. Such keys have key
set to GLFW_KEY_UNKNOWN
, their state is not saved and so it cannot be retrieved with glfwGetKey.
Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new key callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. GLFWmousebuttonfun glfwSetMouseButtonCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWmousebuttonfun | -cbfun | -
- | ) | -- |
This function sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.
-When a window loses focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the window has lost focus, i.e. GLFW_FOCUSED
will be false and the focus callback will have already been called.
[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. GLFWscrollfun glfwSetScrollCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWscrollfun | -cbfun | -
- | ) | -- |
This function sets the scroll callback of the specified window, which is called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
-The scroll callback receives all scrolling input, like that from a mouse wheel or a touchpad scrolling area.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new scroll callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Macros | |
#define | GLFW_JOYSTICK_1 0 |
#define | GLFW_JOYSTICK_2 1 |
#define | GLFW_JOYSTICK_3 2 |
#define | GLFW_JOYSTICK_4 3 |
#define | GLFW_JOYSTICK_5 4 |
#define | GLFW_JOYSTICK_6 5 |
#define | GLFW_JOYSTICK_7 6 |
#define | GLFW_JOYSTICK_8 7 |
#define | GLFW_JOYSTICK_9 8 |
#define | GLFW_JOYSTICK_10 9 |
#define | GLFW_JOYSTICK_11 10 |
#define | GLFW_JOYSTICK_12 11 |
#define | GLFW_JOYSTICK_13 12 |
#define | GLFW_JOYSTICK_14 13 |
#define | GLFW_JOYSTICK_15 14 |
#define | GLFW_JOYSTICK_16 15 |
#define | GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 |
#define GLFW_JOYSTICK_1 0 | -
#define GLFW_JOYSTICK_10 9 | -
#define GLFW_JOYSTICK_11 10 | -
#define GLFW_JOYSTICK_12 11 | -
#define GLFW_JOYSTICK_13 12 | -
#define GLFW_JOYSTICK_14 13 | -
#define GLFW_JOYSTICK_15 14 | -
#define GLFW_JOYSTICK_16 15 | -
#define GLFW_JOYSTICK_2 1 | -
#define GLFW_JOYSTICK_3 2 | -
#define GLFW_JOYSTICK_4 3 | -
#define GLFW_JOYSTICK_5 4 | -
#define GLFW_JOYSTICK_6 5 | -
#define GLFW_JOYSTICK_7 6 | -
#define GLFW_JOYSTICK_8 7 | -
#define GLFW_JOYSTICK_9 8 | -
#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16 | -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Macros | |
#define | GLFW_KEY_UNKNOWN -1 |
#define | GLFW_KEY_SPACE 32 |
#define | GLFW_KEY_APOSTROPHE 39 /* ' */ |
#define | GLFW_KEY_COMMA 44 /* , */ |
#define | GLFW_KEY_MINUS 45 /* - */ |
#define | GLFW_KEY_PERIOD 46 /* . */ |
#define | GLFW_KEY_SLASH 47 /* / */ |
#define | GLFW_KEY_0 48 |
#define | GLFW_KEY_1 49 |
#define | GLFW_KEY_2 50 |
#define | GLFW_KEY_3 51 |
#define | GLFW_KEY_4 52 |
#define | GLFW_KEY_5 53 |
#define | GLFW_KEY_6 54 |
#define | GLFW_KEY_7 55 |
#define | GLFW_KEY_8 56 |
#define | GLFW_KEY_9 57 |
#define | GLFW_KEY_SEMICOLON 59 /* ; */ |
#define | GLFW_KEY_EQUAL 61 /* = */ |
#define | GLFW_KEY_A 65 |
#define | GLFW_KEY_B 66 |
#define | GLFW_KEY_C 67 |
#define | GLFW_KEY_D 68 |
#define | GLFW_KEY_E 69 |
#define | GLFW_KEY_F 70 |
#define | GLFW_KEY_G 71 |
#define | GLFW_KEY_H 72 |
#define | GLFW_KEY_I 73 |
#define | GLFW_KEY_J 74 |
#define | GLFW_KEY_K 75 |
#define | GLFW_KEY_L 76 |
#define | GLFW_KEY_M 77 |
#define | GLFW_KEY_N 78 |
#define | GLFW_KEY_O 79 |
#define | GLFW_KEY_P 80 |
#define | GLFW_KEY_Q 81 |
#define | GLFW_KEY_R 82 |
#define | GLFW_KEY_S 83 |
#define | GLFW_KEY_T 84 |
#define | GLFW_KEY_U 85 |
#define | GLFW_KEY_V 86 |
#define | GLFW_KEY_W 87 |
#define | GLFW_KEY_X 88 |
#define | GLFW_KEY_Y 89 |
#define | GLFW_KEY_Z 90 |
#define | GLFW_KEY_LEFT_BRACKET 91 /* [ */ |
#define | GLFW_KEY_BACKSLASH 92 /* \ */ |
#define | GLFW_KEY_RIGHT_BRACKET 93 /* ] */ |
#define | GLFW_KEY_GRAVE_ACCENT 96 /* ` */ |
#define | GLFW_KEY_WORLD_1 161 /* non-US #1 */ |
#define | GLFW_KEY_WORLD_2 162 /* non-US #2 */ |
#define | GLFW_KEY_ESCAPE 256 |
#define | GLFW_KEY_ENTER 257 |
#define | GLFW_KEY_TAB 258 |
#define | GLFW_KEY_BACKSPACE 259 |
#define | GLFW_KEY_INSERT 260 |
#define | GLFW_KEY_DELETE 261 |
#define | GLFW_KEY_RIGHT 262 |
#define | GLFW_KEY_LEFT 263 |
#define | GLFW_KEY_DOWN 264 |
#define | GLFW_KEY_UP 265 |
#define | GLFW_KEY_PAGE_UP 266 |
#define | GLFW_KEY_PAGE_DOWN 267 |
#define | GLFW_KEY_HOME 268 |
#define | GLFW_KEY_END 269 |
#define | GLFW_KEY_CAPS_LOCK 280 |
#define | GLFW_KEY_SCROLL_LOCK 281 |
#define | GLFW_KEY_NUM_LOCK 282 |
#define | GLFW_KEY_PRINT_SCREEN 283 |
#define | GLFW_KEY_PAUSE 284 |
#define | GLFW_KEY_F1 290 |
#define | GLFW_KEY_F2 291 |
#define | GLFW_KEY_F3 292 |
#define | GLFW_KEY_F4 293 |
#define | GLFW_KEY_F5 294 |
#define | GLFW_KEY_F6 295 |
#define | GLFW_KEY_F7 296 |
#define | GLFW_KEY_F8 297 |
#define | GLFW_KEY_F9 298 |
#define | GLFW_KEY_F10 299 |
#define | GLFW_KEY_F11 300 |
#define | GLFW_KEY_F12 301 |
#define | GLFW_KEY_F13 302 |
#define | GLFW_KEY_F14 303 |
#define | GLFW_KEY_F15 304 |
#define | GLFW_KEY_F16 305 |
#define | GLFW_KEY_F17 306 |
#define | GLFW_KEY_F18 307 |
#define | GLFW_KEY_F19 308 |
#define | GLFW_KEY_F20 309 |
#define | GLFW_KEY_F21 310 |
#define | GLFW_KEY_F22 311 |
#define | GLFW_KEY_F23 312 |
#define | GLFW_KEY_F24 313 |
#define | GLFW_KEY_F25 314 |
#define | GLFW_KEY_KP_0 320 |
#define | GLFW_KEY_KP_1 321 |
#define | GLFW_KEY_KP_2 322 |
#define | GLFW_KEY_KP_3 323 |
#define | GLFW_KEY_KP_4 324 |
#define | GLFW_KEY_KP_5 325 |
#define | GLFW_KEY_KP_6 326 |
#define | GLFW_KEY_KP_7 327 |
#define | GLFW_KEY_KP_8 328 |
#define | GLFW_KEY_KP_9 329 |
#define | GLFW_KEY_KP_DECIMAL 330 |
#define | GLFW_KEY_KP_DIVIDE 331 |
#define | GLFW_KEY_KP_MULTIPLY 332 |
#define | GLFW_KEY_KP_SUBTRACT 333 |
#define | GLFW_KEY_KP_ADD 334 |
#define | GLFW_KEY_KP_ENTER 335 |
#define | GLFW_KEY_KP_EQUAL 336 |
#define | GLFW_KEY_LEFT_SHIFT 340 |
#define | GLFW_KEY_LEFT_CONTROL 341 |
#define | GLFW_KEY_LEFT_ALT 342 |
#define | GLFW_KEY_LEFT_SUPER 343 |
#define | GLFW_KEY_RIGHT_SHIFT 344 |
#define | GLFW_KEY_RIGHT_CONTROL 345 |
#define | GLFW_KEY_RIGHT_ALT 346 |
#define | GLFW_KEY_RIGHT_SUPER 347 |
#define | GLFW_KEY_MENU 348 |
#define | GLFW_KEY_LAST GLFW_KEY_MENU |
These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), but re-arranged to map to 7-bit ASCII for printable keys (function keys are put in the 256+ range).
-The naming of the key codes follow these rules:
-#define GLFW_KEY_0 48 | -
#define GLFW_KEY_1 49 | -
#define GLFW_KEY_2 50 | -
#define GLFW_KEY_3 51 | -
#define GLFW_KEY_4 52 | -
#define GLFW_KEY_5 53 | -
#define GLFW_KEY_6 54 | -
#define GLFW_KEY_7 55 | -
#define GLFW_KEY_8 56 | -
#define GLFW_KEY_9 57 | -
#define GLFW_KEY_A 65 | -
#define GLFW_KEY_APOSTROPHE 39 /* ' */ | -
#define GLFW_KEY_B 66 | -
#define GLFW_KEY_BACKSLASH 92 /* \ */ | -
#define GLFW_KEY_BACKSPACE 259 | -
#define GLFW_KEY_C 67 | -
#define GLFW_KEY_CAPS_LOCK 280 | -
#define GLFW_KEY_COMMA 44 /* , */ | -
#define GLFW_KEY_D 68 | -
#define GLFW_KEY_DELETE 261 | -
#define GLFW_KEY_DOWN 264 | -
#define GLFW_KEY_E 69 | -
#define GLFW_KEY_END 269 | -
#define GLFW_KEY_ENTER 257 | -
#define GLFW_KEY_EQUAL 61 /* = */ | -
#define GLFW_KEY_ESCAPE 256 | -
#define GLFW_KEY_F 70 | -
#define GLFW_KEY_F1 290 | -
#define GLFW_KEY_F10 299 | -
#define GLFW_KEY_F11 300 | -
#define GLFW_KEY_F12 301 | -
#define GLFW_KEY_F13 302 | -
#define GLFW_KEY_F14 303 | -
#define GLFW_KEY_F15 304 | -
#define GLFW_KEY_F16 305 | -
#define GLFW_KEY_F17 306 | -
#define GLFW_KEY_F18 307 | -
#define GLFW_KEY_F19 308 | -
#define GLFW_KEY_F2 291 | -
#define GLFW_KEY_F20 309 | -
#define GLFW_KEY_F21 310 | -
#define GLFW_KEY_F22 311 | -
#define GLFW_KEY_F23 312 | -
#define GLFW_KEY_F24 313 | -
#define GLFW_KEY_F25 314 | -
#define GLFW_KEY_F3 292 | -
#define GLFW_KEY_F4 293 | -
#define GLFW_KEY_F5 294 | -
#define GLFW_KEY_F6 295 | -
#define GLFW_KEY_F7 296 | -
#define GLFW_KEY_F8 297 | -
#define GLFW_KEY_F9 298 | -
#define GLFW_KEY_G 71 | -
#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */ | -
#define GLFW_KEY_H 72 | -
#define GLFW_KEY_HOME 268 | -
#define GLFW_KEY_I 73 | -
#define GLFW_KEY_INSERT 260 | -
#define GLFW_KEY_J 74 | -
#define GLFW_KEY_K 75 | -
#define GLFW_KEY_KP_0 320 | -
#define GLFW_KEY_KP_1 321 | -
#define GLFW_KEY_KP_2 322 | -
#define GLFW_KEY_KP_3 323 | -
#define GLFW_KEY_KP_4 324 | -
#define GLFW_KEY_KP_5 325 | -
#define GLFW_KEY_KP_6 326 | -
#define GLFW_KEY_KP_7 327 | -
#define GLFW_KEY_KP_8 328 | -
#define GLFW_KEY_KP_9 329 | -
#define GLFW_KEY_KP_ADD 334 | -
#define GLFW_KEY_KP_DECIMAL 330 | -
#define GLFW_KEY_KP_DIVIDE 331 | -
#define GLFW_KEY_KP_ENTER 335 | -
#define GLFW_KEY_KP_EQUAL 336 | -
#define GLFW_KEY_KP_MULTIPLY 332 | -
#define GLFW_KEY_KP_SUBTRACT 333 | -
#define GLFW_KEY_L 76 | -
#define GLFW_KEY_LAST GLFW_KEY_MENU | -
#define GLFW_KEY_LEFT 263 | -
#define GLFW_KEY_LEFT_ALT 342 | -
#define GLFW_KEY_LEFT_BRACKET 91 /* [ */ | -
#define GLFW_KEY_LEFT_CONTROL 341 | -
#define GLFW_KEY_LEFT_SHIFT 340 | -
#define GLFW_KEY_LEFT_SUPER 343 | -
#define GLFW_KEY_M 77 | -
#define GLFW_KEY_MENU 348 | -
#define GLFW_KEY_MINUS 45 /* - */ | -
#define GLFW_KEY_N 78 | -
#define GLFW_KEY_NUM_LOCK 282 | -
#define GLFW_KEY_O 79 | -
#define GLFW_KEY_P 80 | -
#define GLFW_KEY_PAGE_DOWN 267 | -
#define GLFW_KEY_PAGE_UP 266 | -
#define GLFW_KEY_PAUSE 284 | -
#define GLFW_KEY_PERIOD 46 /* . */ | -
#define GLFW_KEY_PRINT_SCREEN 283 | -
#define GLFW_KEY_Q 81 | -
#define GLFW_KEY_R 82 | -
#define GLFW_KEY_RIGHT 262 | -
#define GLFW_KEY_RIGHT_ALT 346 | -
#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */ | -
#define GLFW_KEY_RIGHT_CONTROL 345 | -
#define GLFW_KEY_RIGHT_SHIFT 344 | -
#define GLFW_KEY_RIGHT_SUPER 347 | -
#define GLFW_KEY_S 83 | -
#define GLFW_KEY_SCROLL_LOCK 281 | -
#define GLFW_KEY_SEMICOLON 59 /* ; */ | -
#define GLFW_KEY_SLASH 47 /* / */ | -
#define GLFW_KEY_SPACE 32 | -
#define GLFW_KEY_T 84 | -
#define GLFW_KEY_TAB 258 | -
#define GLFW_KEY_U 85 | -
#define GLFW_KEY_UNKNOWN -1 | -
#define GLFW_KEY_UP 265 | -
#define GLFW_KEY_V 86 | -
#define GLFW_KEY_W 87 | -
#define GLFW_KEY_WORLD_1 161 /* non-US #1 */ | -
#define GLFW_KEY_WORLD_2 162 /* non-US #2 */ | -
#define GLFW_KEY_X 88 | -
#define GLFW_KEY_Y 89 | -
#define GLFW_KEY_Z 90 | -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Macros | |
#define | GLFW_MOD_SHIFT 0x0001 |
If this bit is set one or more Shift keys were held down. More... | |
#define | GLFW_MOD_CONTROL 0x0002 |
If this bit is set one or more Control keys were held down. More... | |
#define | GLFW_MOD_ALT 0x0004 |
If this bit is set one or more Alt keys were held down. More... | |
#define | GLFW_MOD_SUPER 0x0008 |
If this bit is set one or more Super keys were held down. More... | |
#define GLFW_MOD_ALT 0x0004 | -
#define GLFW_MOD_CONTROL 0x0002 | -
#define GLFW_MOD_SHIFT 0x0001 | -
#define GLFW_MOD_SUPER 0x0008 | -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Data Structures | |
struct | GLFWvidmode |
Video mode type. More... | |
struct | GLFWgammaramp |
Gamma ramp. More... | |
-Typedefs | |
typedef struct GLFWmonitor | GLFWmonitor |
typedef void(* | GLFWmonitorfun )(GLFWmonitor *, int) |
The function signature for monitor configuration callbacks. More... | |
-Functions | |
GLFWmonitor ** | glfwGetMonitors (int *count) |
Returns the currently connected monitors. More... | |
GLFWmonitor * | glfwGetPrimaryMonitor (void) |
Returns the primary monitor. More... | |
void | glfwGetMonitorPos (GLFWmonitor *monitor, int *xpos, int *ypos) |
Returns the position of the monitor's viewport on the virtual screen. More... | |
void | glfwGetMonitorPhysicalSize (GLFWmonitor *monitor, int *width, int *height) |
Returns the physical size of the monitor. More... | |
const char * | glfwGetMonitorName (GLFWmonitor *monitor) |
Returns the name of the specified monitor. More... | |
GLFWmonitorfun | glfwSetMonitorCallback (GLFWmonitorfun cbfun) |
Sets the monitor configuration callback. More... | |
const GLFWvidmode * | glfwGetVideoModes (GLFWmonitor *monitor, int *count) |
Returns the available video modes for the specified monitor. More... | |
const GLFWvidmode * | glfwGetVideoMode (GLFWmonitor *monitor) |
Returns the current mode of the specified monitor. More... | |
void | glfwSetGamma (GLFWmonitor *monitor, float gamma) |
Generates a gamma ramp and sets it for the specified monitor. More... | |
const GLFWgammaramp * | glfwGetGammaRamp (GLFWmonitor *monitor) |
Retrieves the current gamma ramp for the specified monitor. More... | |
void | glfwSetGammaRamp (GLFWmonitor *monitor, const GLFWgammaramp *ramp) |
Sets the current gamma ramp for the specified monitor. More... | |
This is the reference documentation for monitor related functions and types. For more information, see the Multi-monitor guide.
-typedef struct GLFWmonitor GLFWmonitor | -
Opaque monitor object.
- -typedef void(* GLFWmonitorfun)(GLFWmonitor *, int) | -
This is the function signature for monitor configuration callback functions.
-[in] | monitor | The monitor that was connected or disconnected. |
[in] | event | One of GLFW_CONNECTED or GLFW_DISCONNECTED . |
const GLFWgammaramp* glfwGetGammaRamp | -( | -GLFWmonitor * | -monitor | ) | -- |
This function retrieves the current gamma ramp of the specified monitor.
-[in] | monitor | The monitor to query. |
NULL
if an error occurred.const char* glfwGetMonitorName | -( | -GLFWmonitor * | -monitor | ) | -- |
This function returns a human-readable name, encoded as UTF-8, of the specified monitor.
-[in] | monitor | The monitor to query. |
NULL
if an error occurred.void glfwGetMonitorPhysicalSize | -( | -GLFWmonitor * | -monitor, | -
- | - | int * | -width, | -
- | - | int * | -height | -
- | ) | -- |
This function returns the size, in millimetres, of the display area of the specified monitor.
-[in] | monitor | The monitor to query. |
[out] | width | Where to store the width, in mm, of the monitor's display area, or NULL . |
[out] | height | Where to store the height, in mm, of the monitor's display area, or NULL . |
void glfwGetMonitorPos | -( | -GLFWmonitor * | -monitor, | -
- | - | int * | -xpos, | -
- | - | int * | -ypos | -
- | ) | -- |
This function returns the position, in screen coordinates, of the upper-left corner of the specified monitor.
-[in] | monitor | The monitor to query. |
[out] | xpos | Where to store the monitor x-coordinate, or NULL . |
[out] | ypos | Where to store the monitor y-coordinate, or NULL . |
GLFWmonitor** glfwGetMonitors | -( | -int * | -count | ) | -- |
This function returns an array of handles for all currently connected monitors.
-[out] | count | Where to store the size of the returned array. This is set to zero if an error occurred. |
NULL
if an error occurred.GLFWmonitor* glfwGetPrimaryMonitor | -( | -void | -) | -- |
This function returns the primary monitor. This is usually the monitor where elements like the Windows task bar or the OS X menu bar is located.
-NULL
if an error occurred.const GLFWvidmode* glfwGetVideoMode | -( | -GLFWmonitor * | -monitor | ) | -- |
This function returns the current video mode of the specified monitor. If you are using a full screen window, the return value will therefore depend on whether it is focused.
-[in] | monitor | The monitor to query. |
NULL
if an error occurred.const GLFWvidmode* glfwGetVideoModes | -( | -GLFWmonitor * | -monitor, | -
- | - | int * | -count | -
- | ) | -- |
This function returns an array of all video modes supported by the specified monitor. The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths) and then by resolution area (the product of width and height).
-[in] | monitor | The monitor to query. |
[out] | count | Where to store the number of video modes in the returned array. This is set to zero if an error occurred. |
NULL
if an error occurred.void glfwSetGamma | -( | -GLFWmonitor * | -monitor, | -
- | - | float | -gamma | -
- | ) | -- |
This function generates a 256-element gamma ramp from the specified exponent and then calls glfwSetGammaRamp with it.
-[in] | monitor | The monitor whose gamma ramp to set. |
[in] | gamma | The desired exponent. |
void glfwSetGammaRamp | -( | -GLFWmonitor * | -monitor, | -
- | - | const GLFWgammaramp * | -ramp | -
- | ) | -- |
This function sets the current gamma ramp for the specified monitor.
-[in] | monitor | The monitor whose gamma ramp to set. |
[in] | ramp | The gamma ramp to use. |
GLFWmonitorfun glfwSetMonitorCallback | -( | -GLFWmonitorfun | -cbfun | ) | -- |
This function sets the monitor configuration callback, or removes the currently set callback. This is called when a monitor is connected to or disconnected from the system.
-[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Functions | |
HWND | glfwGetWin32Window (GLFWwindow *window) |
Returns the HWND of the specified window. More... | |
HGLRC | glfwGetWGLContext (GLFWwindow *window) |
Returns the HGLRC of the specified window. More... | |
id | glfwGetCocoaWindow (GLFWwindow *window) |
Returns the NSWindow of the specified window. More... | |
id | glfwGetNSGLContext (GLFWwindow *window) |
Returns the NSOpenGLContext of the specified window. More... | |
Display * | glfwGetX11Display (void) |
Returns the Display used by GLFW. More... | |
Window | glfwGetX11Window (GLFWwindow *window) |
Returns the Window of the specified window. More... | |
GLXContext | glfwGetGLXContext (GLFWwindow *window) |
Returns the GLXContext of the specified window. More... | |
EGLDisplay | glfwGetEGLDisplay (void) |
Returns the EGLDisplay used by GLFW. More... | |
EGLContext | glfwGetEGLContext (GLFWwindow *window) |
Returns the EGLContext of the specified window. More... | |
EGLSurface | glfwGetEGLSurface (GLFWwindow *window) |
Returns the EGLSurface of the specified window. More... | |
By using the native API, you assert that you know what you're doing and how to fix problems caused by using it. If you don't, you shouldn't be using it.
-Before the inclusion of glfw3native.h, you must define exactly one window API macro and exactly one context API macro. Failure to do this will cause a compile-time error.
-The available window API macros are:
-GLFW_EXPOSE_NATIVE_WIN32
GLFW_EXPOSE_NATIVE_COCOA
GLFW_EXPOSE_NATIVE_X11
The available context API macros are:
-GLFW_EXPOSE_NATIVE_WGL
GLFW_EXPOSE_NATIVE_NSGL
GLFW_EXPOSE_NATIVE_GLX
GLFW_EXPOSE_NATIVE_EGL
These macros select which of the native access functions that are declared and which platform-specific headers to include. It is then up your (by definition platform-specific) code to handle which of these should be defined.
-id glfwGetCocoaWindow | -( | -GLFWwindow * | -window | ) | -- |
NSWindow
of the specified window. EGLContext glfwGetEGLContext | -( | -GLFWwindow * | -window | ) | -- |
EGLContext
of the specified window. EGLDisplay glfwGetEGLDisplay | -( | -void | -) | -- |
EGLDisplay
used by GLFW. EGLSurface glfwGetEGLSurface | -( | -GLFWwindow * | -window | ) | -- |
EGLSurface
of the specified window. GLXContext glfwGetGLXContext | -( | -GLFWwindow * | -window | ) | -- |
GLXContext
of the specified window. id glfwGetNSGLContext | -( | -GLFWwindow * | -window | ) | -- |
NSOpenGLContext
of the specified window. HGLRC glfwGetWGLContext | -( | -GLFWwindow * | -window | ) | -- |
HGLRC
of the specified window. HWND glfwGetWin32Window | -( | -GLFWwindow * | -window | ) | -- |
HWND
of the specified window. Display* glfwGetX11Display | -( | -void | -) | -- |
Display
used by GLFW. Window glfwGetX11Window | -( | -GLFWwindow * | -window | ) | -- |
Window
of the specified window.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Functions | |
double | glfwGetTime (void) |
Returns the value of the GLFW timer. More... | |
void | glfwSetTime (double time) |
Sets the GLFW timer. More... | |
double glfwGetTime | -( | -void | -) | -- |
This function returns the value of the GLFW timer. Unless the timer has been set using glfwSetTime, the timer measures time elapsed since GLFW was initialized.
-void glfwSetTime | -( | -double | -time | ) | -- |
This function sets the value of the GLFW timer. It then continues to count up from that value.
-[in] | time | The new value, in seconds. |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
-Typedefs | |
typedef struct GLFWwindow | GLFWwindow |
typedef void(* | GLFWwindowposfun )(GLFWwindow *, int, int) |
The function signature for window position callbacks. More... | |
typedef void(* | GLFWwindowsizefun )(GLFWwindow *, int, int) |
The function signature for window resize callbacks. More... | |
typedef void(* | GLFWwindowclosefun )(GLFWwindow *) |
The function signature for window close callbacks. More... | |
typedef void(* | GLFWwindowrefreshfun )(GLFWwindow *) |
The function signature for window content refresh callbacks. More... | |
typedef void(* | GLFWwindowfocusfun )(GLFWwindow *, int) |
The function signature for window focus/defocus callbacks. More... | |
typedef void(* | GLFWwindowiconifyfun )(GLFWwindow *, int) |
The function signature for window iconify/restore callbacks. More... | |
typedef void(* | GLFWframebuffersizefun )(GLFWwindow *, int, int) |
The function signature for framebuffer resize callbacks. More... | |
-Functions | |
void | glfwDefaultWindowHints (void) |
Resets all window hints to their default values. More... | |
void | glfwWindowHint (int target, int hint) |
Sets the specified window hint to the desired value. More... | |
GLFWwindow * | glfwCreateWindow (int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share) |
Creates a window and its associated context. More... | |
void | glfwDestroyWindow (GLFWwindow *window) |
Destroys the specified window and its context. More... | |
int | glfwWindowShouldClose (GLFWwindow *window) |
Checks the close flag of the specified window. More... | |
void | glfwSetWindowShouldClose (GLFWwindow *window, int value) |
Sets the close flag of the specified window. More... | |
void | glfwSetWindowTitle (GLFWwindow *window, const char *title) |
Sets the title of the specified window. More... | |
void | glfwGetWindowPos (GLFWwindow *window, int *xpos, int *ypos) |
Retrieves the position of the client area of the specified window. More... | |
void | glfwSetWindowPos (GLFWwindow *window, int xpos, int ypos) |
Sets the position of the client area of the specified window. More... | |
void | glfwGetWindowSize (GLFWwindow *window, int *width, int *height) |
Retrieves the size of the client area of the specified window. More... | |
void | glfwSetWindowSize (GLFWwindow *window, int width, int height) |
Sets the size of the client area of the specified window. More... | |
void | glfwGetFramebufferSize (GLFWwindow *window, int *width, int *height) |
Retrieves the size of the framebuffer of the specified window. More... | |
void | glfwIconifyWindow (GLFWwindow *window) |
Iconifies the specified window. More... | |
void | glfwRestoreWindow (GLFWwindow *window) |
Restores the specified window. More... | |
void | glfwShowWindow (GLFWwindow *window) |
Makes the specified window visible. More... | |
void | glfwHideWindow (GLFWwindow *window) |
Hides the specified window. More... | |
GLFWmonitor * | glfwGetWindowMonitor (GLFWwindow *window) |
Returns the monitor that the window uses for full screen mode. More... | |
int | glfwGetWindowAttrib (GLFWwindow *window, int attrib) |
Returns an attribute of the specified window. More... | |
void | glfwSetWindowUserPointer (GLFWwindow *window, void *pointer) |
Sets the user pointer of the specified window. More... | |
void * | glfwGetWindowUserPointer (GLFWwindow *window) |
Returns the user pointer of the specified window. More... | |
GLFWwindowposfun | glfwSetWindowPosCallback (GLFWwindow *window, GLFWwindowposfun cbfun) |
Sets the position callback for the specified window. More... | |
GLFWwindowsizefun | glfwSetWindowSizeCallback (GLFWwindow *window, GLFWwindowsizefun cbfun) |
Sets the size callback for the specified window. More... | |
GLFWwindowclosefun | glfwSetWindowCloseCallback (GLFWwindow *window, GLFWwindowclosefun cbfun) |
Sets the close callback for the specified window. More... | |
GLFWwindowrefreshfun | glfwSetWindowRefreshCallback (GLFWwindow *window, GLFWwindowrefreshfun cbfun) |
Sets the refresh callback for the specified window. More... | |
GLFWwindowfocusfun | glfwSetWindowFocusCallback (GLFWwindow *window, GLFWwindowfocusfun cbfun) |
Sets the focus callback for the specified window. More... | |
GLFWwindowiconifyfun | glfwSetWindowIconifyCallback (GLFWwindow *window, GLFWwindowiconifyfun cbfun) |
Sets the iconify callback for the specified window. More... | |
GLFWframebuffersizefun | glfwSetFramebufferSizeCallback (GLFWwindow *window, GLFWframebuffersizefun cbfun) |
Sets the framebuffer resize callback for the specified window. More... | |
void | glfwPollEvents (void) |
Processes all pending events. More... | |
void | glfwWaitEvents (void) |
Waits until events are pending and processes them. More... | |
This is the reference documentation for window related functions and types, including creation, deletion and event polling. For more information, see the Window handling guide.
-typedef void(* GLFWframebuffersizefun)(GLFWwindow *, int, int) | -
This is the function signature for framebuffer resize callback functions.
-[in] | window | The window whose framebuffer was resized. |
[in] | width | The new width, in pixels, of the framebuffer. |
[in] | height | The new height, in pixels, of the framebuffer. |
typedef struct GLFWwindow GLFWwindow | -
Opaque window object.
- -typedef void(* GLFWwindowclosefun)(GLFWwindow *) | -
This is the function signature for window close callback functions.
-[in] | window | The window that the user attempted to close. |
typedef void(* GLFWwindowfocusfun)(GLFWwindow *, int) | -
This is the function signature for window focus callback functions.
-[in] | window | The window that was focused or defocused. |
[in] | focused | GL_TRUE if the window was focused, or GL_FALSE if it was defocused. |
typedef void(* GLFWwindowiconifyfun)(GLFWwindow *, int) | -
This is the function signature for window iconify/restore callback functions.
-[in] | window | The window that was iconified or restored. |
[in] | iconified | GL_TRUE if the window was iconified, or GL_FALSE if it was restored. |
typedef void(* GLFWwindowposfun)(GLFWwindow *, int, int) | -
This is the function signature for window position callback functions.
-[in] | window | The window that the user moved. |
[in] | xpos | The new x-coordinate, in screen coordinates, of the upper-left corner of the client area of the window. |
[in] | ypos | The new y-coordinate, in screen coordinates, of the upper-left corner of the client area of the window. |
typedef void(* GLFWwindowrefreshfun)(GLFWwindow *) | -
This is the function signature for window refresh callback functions.
-[in] | window | The window whose content needs to be refreshed. |
typedef void(* GLFWwindowsizefun)(GLFWwindow *, int, int) | -
This is the function signature for window size callback functions.
-[in] | window | The window that the user resized. |
[in] | width | The new width, in screen coordinates, of the window. |
[in] | height | The new height, in screen coordinates, of the window. |
GLFWwindow* glfwCreateWindow | -( | -int | -width, | -
- | - | int | -height, | -
- | - | const char * | -title, | -
- | - | GLFWmonitor * | -monitor, | -
- | - | GLFWwindow * | -share | -
- | ) | -- |
This function creates a window and its associated context. Most of the options controlling how the window and its context should be created are specified through glfwWindowHint.
-Successful creation does not change which context is current. Before you can use the newly created context, you need to make it current using glfwMakeContextCurrent.
-Note that the created window and context may differ from what you requested, as not all parameters and hints are hard constraints. This includes the size of the window, especially for full screen windows. To retrieve the actual attributes of the created window and context, use queries like glfwGetWindowAttrib and glfwGetWindowSize.
-To create a full screen window, you need to specify the monitor to use. If no monitor is specified, windowed mode will be used. Unless you have a way for the user to choose a specific monitor, it is recommended that you pick the primary monitor. For more information on how to retrieve monitors, see Retrieving monitors.
-To create the window at a specific position, make it initially invisible using the GLFW_VISIBLE
window hint, set its position and then show it.
If a full screen window is active, the screensaver is prohibited from starting.
-[in] | width | The desired width, in screen coordinates, of the window. This must be greater than zero. |
[in] | height | The desired height, in screen coordinates, of the window. This must be greater than zero. |
[in] | title | The initial, UTF-8 encoded window title. |
[in] | monitor | The monitor to use for full screen mode, or NULL to use windowed mode. |
[in] | share | The window whose context to share resources with, or NULL to not share resources. |
NULL
if an error occurred.GLFW_ICON,
it will be set as the icon for the window. If no such icon is present, the IDI_WINLOGO
icon will be used instead.void glfwDefaultWindowHints | -( | -void | -) | -- |
This function resets all window hints to their default values.
-void glfwDestroyWindow | -( | -GLFWwindow * | -window | ) | -- |
This function destroys the specified window and its context. On calling this function, no further callbacks will be called for that window.
-[in] | window | The window to destroy. |
void glfwGetFramebufferSize | -( | -GLFWwindow * | -window, | -
- | - | int * | -width, | -
- | - | int * | -height | -
- | ) | -- |
This function retrieves the size, in pixels, of the framebuffer of the specified window.
-[in] | window | The window whose framebuffer to query. |
[out] | width | Where to store the width, in pixels, of the framebuffer, or NULL . |
[out] | height | Where to store the height, in pixels, of the framebuffer, or NULL . |
int glfwGetWindowAttrib | -( | -GLFWwindow * | -window, | -
- | - | int | -attrib | -
- | ) | -- |
This function returns an attribute of the specified window. There are many attributes, some related to the window and others to its context.
-[in] | window | The window to query. |
[in] | attrib | The window attribute whose value to return. |
GLFWmonitor* glfwGetWindowMonitor | -( | -GLFWwindow * | -window | ) | -- |
This function returns the handle of the monitor that the specified window is in full screen on.
-[in] | window | The window to query. |
NULL
if the window is in windowed mode. void glfwGetWindowPos | -( | -GLFWwindow * | -window, | -
- | - | int * | -xpos, | -
- | - | int * | -ypos | -
- | ) | -- |
This function retrieves the position, in screen coordinates, of the upper-left corner of the client area of the specified window.
-[in] | window | The window to query. |
[out] | xpos | Where to store the x-coordinate of the upper-left corner of the client area, or NULL . |
[out] | ypos | Where to store the y-coordinate of the upper-left corner of the client area, or NULL . |
void glfwGetWindowSize | -( | -GLFWwindow * | -window, | -
- | - | int * | -width, | -
- | - | int * | -height | -
- | ) | -- |
This function retrieves the size, in screen coordinates, of the client area of the specified window.
-[in] | window | The window whose size to retrieve. |
[out] | width | Where to store the width, in screen coordinates, of the client area, or NULL . |
[out] | height | Where to store the height, in screen coordinates, of the client area, or NULL . |
void* glfwGetWindowUserPointer | -( | -GLFWwindow * | -window | ) | -- |
This function returns the current value of the user-defined pointer of the specified window. The initial value is NULL
.
[in] | window | The window whose pointer to return. |
void glfwHideWindow | -( | -GLFWwindow * | -window | ) | -- |
This function hides the specified window, if it was previously visible. If the window is already hidden or is in full screen mode, this function does nothing.
-[in] | window | The window to hide. |
void glfwIconifyWindow | -( | -GLFWwindow * | -window | ) | -- |
This function iconifies/minimizes the specified window, if it was previously restored. If it is a full screen window, the original monitor resolution is restored until the window is restored. If the window is already iconified, this function does nothing.
-[in] | window | The window to iconify. |
void glfwPollEvents | -( | -void | -) | -- |
This function processes only those events that have already been received and then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
-This function is not required for joystick input to work.
-void glfwRestoreWindow | -( | -GLFWwindow * | -window | ) | -- |
This function restores the specified window, if it was previously iconified/minimized. If it is a full screen window, the resolution chosen for the window is restored on the selected monitor. If the window is already restored, this function does nothing.
-[in] | window | The window to restore. |
GLFWframebuffersizefun glfwSetFramebufferSizeCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWframebuffersizefun | -cbfun | -
- | ) | -- |
This function sets the framebuffer resize callback of the specified window, which is called when the framebuffer of the specified window is resized.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. GLFWwindowclosefun glfwSetWindowCloseCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWwindowclosefun | -cbfun | -
- | ) | -- |
This function sets the close callback of the specified window, which is called when the user attempts to close the window, for example by clicking the close widget in the title bar.
-The close flag is set before this callback is called, but you can modify it at any time with glfwSetWindowShouldClose.
-The close callback is not triggered by glfwDestroyWindow.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred.GLFWwindowfocusfun glfwSetWindowFocusCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWwindowfocusfun | -cbfun | -
- | ) | -- |
This function sets the focus callback of the specified window, which is called when the window gains or loses focus.
-After the focus callback is called for a window that lost focus, synthetic key and mouse button release events will be generated for all such that had been pressed. For more information, see glfwSetKeyCallback and glfwSetMouseButtonCallback.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. GLFWwindowiconifyfun glfwSetWindowIconifyCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWwindowiconifyfun | -cbfun | -
- | ) | -- |
This function sets the iconification callback of the specified window, which is called when the window is iconified or restored.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. void glfwSetWindowPos | -( | -GLFWwindow * | -window, | -
- | - | int | -xpos, | -
- | - | int | -ypos | -
- | ) | -- |
This function sets the position, in screen coordinates, of the upper-left corner of the client area of the window.
-If the specified window is a full screen window, this function does nothing.
-If you wish to set an initial window position you should create a hidden window (using glfwWindowHint and GLFW_VISIBLE
), set its position and then show it.
[in] | window | The window to query. |
[in] | xpos | The x-coordinate of the upper-left corner of the client area. |
[in] | ypos | The y-coordinate of the upper-left corner of the client area. |
GLFWwindowposfun glfwSetWindowPosCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWwindowposfun | -cbfun | -
- | ) | -- |
This function sets the position callback of the specified window, which is called when the window is moved. The callback is provided with the screen position of the upper-left corner of the client area of the window.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. GLFWwindowrefreshfun glfwSetWindowRefreshCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWwindowrefreshfun | -cbfun | -
- | ) | -- |
This function sets the refresh callback of the specified window, which is called when the client area of the window needs to be redrawn, for example if the window has been exposed after having been covered by another window.
-On compositing window systems such as Aero, Compiz or Aqua, where the window contents are saved off-screen, this callback may be called only very infrequently or never at all.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred.void glfwSetWindowShouldClose | -( | -GLFWwindow * | -window, | -
- | - | int | -value | -
- | ) | -- |
This function sets the value of the close flag of the specified window. This can be used to override the user's attempt to close the window, or to signal that it should be closed.
-[in] | window | The window whose flag to change. |
[in] | value | The new value. |
void glfwSetWindowSize | -( | -GLFWwindow * | -window, | -
- | - | int | -width, | -
- | - | int | -height | -
- | ) | -- |
This function sets the size, in screen coordinates, of the client area of the specified window.
-For full screen windows, this function selects and switches to the resolution closest to the specified size, without affecting the window's context. As the context is unaffected, the bit depths of the framebuffer remain unchanged.
-[in] | window | The window to resize. |
[in] | width | The desired width of the specified window. |
[in] | height | The desired height of the specified window. |
GLFWwindowsizefun glfwSetWindowSizeCallback | -( | -GLFWwindow * | -window, | -
- | - | GLFWwindowsizefun | -cbfun | -
- | ) | -- |
This function sets the size callback of the specified window, which is called when the window is resized. The callback is provided with the size, in screen coordinates, of the client area of the window.
-[in] | window | The window whose callback to set. |
[in] | cbfun | The new callback, or NULL to remove the currently set callback. |
NULL
if no callback was set or an error occurred. void glfwSetWindowTitle | -( | -GLFWwindow * | -window, | -
- | - | const char * | -title | -
- | ) | -- |
This function sets the window title, encoded as UTF-8, of the specified window.
-[in] | window | The window whose title to change. |
[in] | title | The UTF-8 encoded window title. |
void glfwSetWindowUserPointer | -( | -GLFWwindow * | -window, | -
- | - | void * | -pointer | -
- | ) | -- |
This function sets the user-defined pointer of the specified window. The current value is retained until the window is destroyed. The initial value is NULL
.
[in] | window | The window whose pointer to set. |
[in] | pointer | The new value. |
void glfwShowWindow | -( | -GLFWwindow * | -window | ) | -- |
This function makes the specified window visible, if it was previously hidden. If the window is already visible or is in full screen mode, this function does nothing.
-[in] | window | The window to make visible. |
void glfwWaitEvents | -( | -void | -) | -- |
This function puts the calling thread to sleep until at least one event has been received. Once one or more events have been received, it behaves as if glfwPollEvents was called, i.e. the events are processed and the function then returns immediately. Processing events will cause the window and input callbacks associated with those events to be called.
-Since not all events are associated with callbacks, this function may return without a callback having been called even if you are monitoring all callbacks.
-This function is not required for joystick input to work.
-void glfwWindowHint | -( | -int | -target, | -
- | - | int | -hint | -
- | ) | -- |
This function sets hints for the next call to glfwCreateWindow. The hints, once set, retain their values until changed by a call to glfwWindowHint or glfwDefaultWindowHints, or until the library is terminated with glfwTerminate.
-[in] | target | The window hint to set. |
[in] | hint | The new value of the window hint. |
int glfwWindowShouldClose | -( | -GLFWwindow * | -window | ) | -- |
This function returns the value of the close flag of the specified window.
-[in] | window | The window to query. |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
GLFW is a free, Open Source, multi-platform library for opening a window, creating an OpenGL context and managing input. It is easy to integrate into existing applications and does not lay claim to the main loop.
-This is the documentation for version 3.0, which has many new features.
-There is a quick tutorial for people new to GLFW, which shows how to write a small but complete program.
-If you have used GLFW 2.x in the past, there is a transition guide that explains what has changed and how to update existing code to use the new API.
-t |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
The GLFWmonitor object represents a currently connected monitor.
-The primary monitor is returned by glfwGetPrimaryMonitor. It is usually the user's preferred monitor and the one with global UI elements like task bar or menu bar.
-You can retrieve all currently connected monitors with glfwGetMonitors.
-Although GLFW generally does a good job at selecting a suitable video mode for you when you open a full screen window, it is sometimes useful to know exactly which modes are available on a certain system. For example, you may want to present the user with a list of video modes to select from. To get a list of available video modes, you can use the function glfwGetVideoModes.
-To get the current video mode of a monitor call glfwGetVideoMode.
-The physical size in millimetres of a monitor, or an approximation of it, can be retrieved with glfwGetMonitorPhysicalSize.
-This can, for example, be used together with the current video mode to calculate the DPI of a monitor.
-The name of a monitor is returned by glfwGetMonitorName.
-The monitor name is a regular C string using the UTF-8 encoding. Note that monitor names are not guaranteed to be unique.
-The gamma ramp of a monitor can be set with glfwSetGammaRamp, which accepts a monitor handle and a pointer to a GLFWgammaramp structure.
-The current gamma ramp for a monitor is returned by glfwGetGammaRamp.
-If you wish to set a regular gamma ramp, you can have GLFW calculate it for you from the desired exponent with glfwSetGamma, which in turn calls glfwSetGammaRamp with the resulting ramp.
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
This is a transition guide for moving from GLFW 2 to 3. It describes what has changed or been removed, but does not include new features unless they are required when moving an existing code base onto the new API. For example, use of the new multi-monitor functions are required to create full screen windows with GLFW 3.
-The threading functions have been removed, including the sleep function. They were fairly primitive, under-used, poorly integrated and took time away from the focus of GLFW (i.e. context, input and window). There are better threading libraries available and native threading support is available in both C++11 and C11, both of which are gaining traction.
-If you wish to use the C++11 or C11 facilities but your compiler doesn't yet support them, see the TinyThread++ and TinyCThread projects created by the original author of GLFW. These libraries implement a usable subset of the threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use TinyCThread.
-However, GLFW 3 has better support for use from multiple threads than GLFW 2 had. Contexts can be made current on and rendered with from secondary threads, and the documentation explicitly states which functions may be used from secondary threads and which may only be used from the main thread, i.e. the thread that calls main.
-The image and texture loading functions have been removed. They only supported the Targa image format, making them mostly useful for beginner level examples. To become of sufficiently high quality to warrant keeping them in GLFW 3, they would need not only to support other formats, but also modern extensions to the OpenGL texturing facilities. This would either add a number of external dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions of these libraries.
-As there already are libraries doing this, it seems unnecessary both to duplicate this work and to tie this duplicate to GLFW. Projects similar to GLFW, such as freeglut, could also gain from such a library. Also, would be no platform-specific part of such a library, as both OpenGL and stdio are available wherever GLFW is.
-The action parameter of the character callback has been removed. This was an artefact of the origin of GLFW, i.e. being developed in English by a Swede. However, many keyboard layouts require more than one key to produce characters with diacritical marks. Even the Swedish keyboard layout requires this for uncommon cases like ü.
-Note that this is only the removal of the action parameter of the character callback, not the removal of the character callback itself.
-The glfwGetMouseWheel
function has been removed. Scroll events do not represent an absolute state, but is instead an interpretation of a relative change in state, like character input. So, like character input, there is no sane 'current state' to return. The mouse wheel callback has been replaced by a scroll callback that receives two-dimensional scroll offsets.
The GLFWCALL
macro, which made callback functions use __stdcall on Windows, has been removed. GLFW is written in C, not Pascal. Removing this macro means there's one less thing for users of GLFW to remember, i.e. the requirement to mark all callback functions with GLFWCALL
. It also simplifies the creation of DLLs and DLL link libraries, as there's no need to explicitly disable @n
entry point suffixes.
The Win32 port of GLFW 3 will not compile in MBCS mode. However, because the use of the Unicode version of the Win32 API doesn't affect the process as a whole, but only those windows created using it, it's perfectly possible to call MBCS functions from other parts of the same application. Therefore, even if an application using GLFW has MBCS mode code, there's no need for GLFW itself to support it.
-All explicit support for version of Windows older than XP has been removed. There is no code that actively prevents GLFW 3 from running on these earlier versions, but it uses Win32 functions that those versions lack.
-Windows XP was released in 2001, and by now (2013) it has not only replaced almost all earlier versions of Windows, but is itself rapidly being replaced by Windows 7 and 8. The MSDN library doesn't even provide documentation for version older than Windows 2000, making it difficult to maintain compatibility with these versions even if it was deemed worth the effort.
-The Win32 API has also not stood still, and GLFW 3 uses many functions only present on Windows XP or later. Even supporting an OS as new as XP (new from the perspective of GLFW 2, which still supports Windows 95) requires runtime checking for a number of functions that are present only on modern version of Windows.
-The ability to disable and capture system-wide hotkeys like Alt+Tab has been removed. Modern applications, whether they're games, scientific visualisations or something else, are nowadays expected to be good desktop citizens and allow these hotkeys to function even when running in full screen mode.
-The GLFW_OPENED
window parameter has been removed. As long as the window object is around, the window is "open". To detect when the user attempts to close the window, see glfwWindowShouldClose and the close callback.
GLFW 3 does not automatically poll for events on glfwSwapBuffers, which means you need to call glfwPollEvents or glfwWaitEvents yourself. Unlike buffer swap, the event processing functions act on all windows at once.
-GLFW 3 does not register glfwTerminate with atexit
at initialization. To properly release all resources allocated by GLFW, you should therefore call glfwTerminate yourself before exiting.
GLFW 3 does not include the GLU header by default and GLU itself has been deprecated, but you can request that the GLFW 3 header includes it by defining GLFW_INCLUDE_GLU
before the inclusion of the GLFW 3 header.
Because GLFW 3 supports multiple windows, window handle parameters have been added to all window-related GLFW functions and callbacks. The handle of a newly created window is returned by glfwCreateWindow (formerly glfwOpenWindow
). Window handles are of the GLFWwindow*
type, i.e. a pointer to an opaque struct.
GLFW 3 provides support for multiple monitors, adding the GLFWmonitor*
handle type and a set of related functions. To request a full screen mode window, instead of passing GLFW_FULLSCREEN
you specify which monitor you wish the window to use. There is glfwGetPrimaryMonitor that provides behaviour similar to that of GLFW 2.
Window closing is now just an event like any other. GLFW 3 windows won't disappear from underfoot even when no close callback is set; instead the window's close flag is set. You can query this flag using glfwWindowShouldClose, or capture close events by setting a close callback. The close flag can be modified from any point in your program using glfwSetWindowShouldClose.
-Each GLFW 3 window has its own OpenGL context and only you, the user, can know which context should be current on which thread at any given time. Therefore, GLFW 3 makes no assumptions about when you want a certain context to be current, leaving that decision to you.
-This means, among other things, that you need to call glfwMakeContextCurrent after creating a window before you can call any OpenGL functions.
-The GLFW_KEY_REPEAT
enable has been removed and key repeat is always enabled for both keys and characters. A new key action, GLFW_REPEAT
, has been added to allow the key callback to distinguish an initial key press from a repeat. Note that glfwGetKey still returns only GLFW_PRESS
or GLFW_RELEASE
.
GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to the values generated by the current keyboard layout. The tokens are named according to the values they would have using the standard US layout, but this is only a convenience, as most programmers are assumed to know that layout. This means that (for example) GLFW_KEY_LEFT_BRACKET
is always a single key and is the same key in the same place regardless of what keyboard layouts the users of your program has.
The key input facility was never meant for text input, although using it that way worked slightly better in GLFW 2. If you were using it to input text, you should be using the character callback instead, on both GLFW 2 and 3. This will give you the characters being input, as opposed to the keys being pressed.
-GLFW 3 has key tokens for all keys on a standard 105 key keyboard, so instead of having to remember whether to check for 'a'
or 'A'
, you now check for GLFW_KEY_A
.
The glfwGetJoystickPos
function has been renamed to glfwGetJoystickAxes.
The glfwGetJoystickParam
function and the GLFW_PRESENT
, GLFW_AXES
and GLFW_BUTTONS
tokens have been replaced by the glfwJoystickPresent function as well as axis and button counts returned by the glfwGetJoystickAxes and glfwGetJoystickButtons functions.
Video mode enumeration is now per-monitor. The glfwGetVideoModes function now returns all available modes for a specific monitor instead of requiring you to guess how large an array you need. The glfwGetDesktopMode
function, which had poorly defined behavior, has been replaced by glfwGetVideoMode, which returns the current mode of a monitor.
GLFW 3 only allows you to position the cursor within a window using glfwSetCursorPos (formerly glfwSetMousePos
) when that window is active. Unless the window is active, the function fails silently.
Window hints are no longer reset to their default values on window creation, but instead retain their values until modified by glfwWindowHint (formerly glfwOpenWindowHint
) or glfwDefaultWindowHints, or until the library is terminated and re-initialized.
The GLFW 3 header is named glfw3.h and moved to the GLFW
directory, to avoid collisions with the headers of other major versions. Similarly, the GLFW 3 library is named glfw3,
except when it's installed as a shared library on Unix-like systems, where it uses the soname libglfw.so.3
.
GLFW 2 | GLFW 3 | Notes |
---|---|---|
glfwOpenWindow | glfwCreateWindow | All channel bit depths are now hints |
glfwCloseWindow | glfwDestroyWindow | |
glfwOpenWindowHint | glfwWindowHint | Now accepts all GLFW_*_BITS tokens |
glfwEnable | glfwSetInputMode | |
glfwDisable | glfwSetInputMode | |
glfwGetMousePos | glfwGetCursorPos | |
glfwSetMousePos | glfwSetCursorPos | |
glfwSetMousePosCallback | glfwSetCursorPosCallback | |
glfwSetMouseWheelCallback | glfwSetScrollCallback | Accepts two-dimensional scroll offsets as doubles |
glfwGetJoystickPos | glfwGetJoystickAxes | |
glfwGetWindowParam | glfwGetWindowAttrib | |
glfwGetGLVersion | glfwGetWindowAttrib | Use GLFW_CONTEXT_VERSION_MAJOR , GLFW_CONTEXT_VERSION_MINOR and GLFW_CONTEXT_REVISION |
glfwGetDesktopMode | glfwGetVideoMode | Returns the current mode of a monitor |
glfwGetJoystickParam | glfwJoystickPresent | The axis and button counts are provided by glfwGetJoystickAxes and glfwGetJoystickButtons |
GLFW 2 | GLFW 3 | Notes |
---|---|---|
GLFW_OPENGL_VERSION_MAJOR | GLFW_CONTEXT_VERSION_MAJOR | Renamed as it applies to OpenGL ES as well |
GLFW_OPENGL_VERSION_MINOR | GLFW_CONTEXT_VERSION_MINOR | Renamed as it applies to OpenGL ES as well |
GLFW_FSAA_SAMPLES | GLFW_SAMPLES | Renamed to match the OpenGL API |
GLFW_ACTIVE | GLFW_FOCUSED | Renamed to match the window focus callback |
GLFW_WINDOW_NO_RESIZE | GLFW_RESIZABLE | The default has been inverted |
GLFW_MOUSE_CURSOR | GLFW_CURSOR | Used with glfwSetInputMode |
GLFW_KEY_ESC | GLFW_KEY_ESCAPE | |
GLFW_KEY_DEL | GLFW_KEY_DELETE | |
GLFW_KEY_PAGEUP | GLFW_KEY_PAGE_UP | |
GLFW_KEY_PAGEDOWN | GLFW_KEY_PAGE_DOWN | |
GLFW_KEY_KP_NUM_LOCK | GLFW_KEY_NUM_LOCK | |
GLFW_KEY_LCTRL | GLFW_KEY_LEFT_CONTROL | |
GLFW_KEY_LSHIFT | GLFW_KEY_LEFT_SHIFT | |
GLFW_KEY_LALT | GLFW_KEY_LEFT_ALT | |
GLFW_KEY_LSUPER | GLFW_KEY_LEFT_SUPER | |
GLFW_KEY_RCTRL | GLFW_KEY_RIGHT_CONTROL | |
GLFW_KEY_RSHIFT | GLFW_KEY_RIGHT_SHIFT | |
GLFW_KEY_RALT | GLFW_KEY_RIGHT_ALT | |
GLFW_KEY_RSUPER | GLFW_KEY_RIGHT_SUPER |
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
GLFW now uses the CMake build system instead of the various makefiles and project files used by earlier versions. CMake is available for all platforms supported by GLFW, is present in most package systems and can generate makefiles and/or project files for most popular development environments.
-For more information on how to use CMake, see the CMake manual.
-GLFW now supports the creation of multiple windows, each with their own OpenGL or OpenGL ES context, and all window functions now take a window handle. Event callbacks are now per-window and are provided with the handle of the window that received the event. The glfwMakeContextCurrent function has been added to select which context is current on a given thread.
-GLFW now explicitly supports multiple monitors. They can be enumerated with glfwGetMonitors, queried with glfwGetVideoModes, glfwGetMonitorPos, glfwGetMonitorName and glfwGetMonitorPhysicalSize, and specified at window creation to make the newly created window full screen on that specific monitor.
-All string arguments to GLFW functions and all strings returned by GLFW now use the UTF-8 encoding. This includes the window title, error string, clipboard text, monitor and joystick names as well as the extension function arguments (as ASCII is a subset of UTF-8).
-GLFW now supports reading and writing plain text to and from the system clipboard, with the glfwGetClipboardString and glfwSetClipboardString functions.
-GLFW now supports setting and reading back the gamma ramp of monitors, with the glfwGetGammaRamp and glfwSetGammaRamp functions. There is also glfwSetGamma, which generates a ramp from a gamma value and then sets it.
-GLFW now supports the creation of OpenGL ES contexts, by setting the GLFW_CLIENT_API
window hint to GLFW_OPENGL_ES_API
, where creation of such contexts are supported. Note that GLFW does not implement OpenGL ES, so your driver must provide support in a way usable by GLFW. Modern nVidia and Intel drivers support creation of OpenGL ES context using the GLX and WGL APIs, while AMD provides an EGL implementation instead.
GLFW now has an experimental EGL context creation back end that can be selected through CMake options.
-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, glfwGetFramebufferSize and glfwSetFramebufferSizeCallback have been added. These work with pixels, while the rest of the GLFW API work with screen coordinates.
-GLFW now has an error callback, which can provide your application with much more detailed diagnostics than was previously possible. The callback is passed an error code and a description string.
-Each window now has a user-defined pointer, retrieved with glfwGetWindowUserPointer and set with glfwSetWindowUserPointer, to make it easier to integrate GLFW into C++ code.
-Each window now has a callback for iconification and restoration events, which is set with glfwSetWindowIconifyCallback.
-Each window now has a callback for position events, which is set with glfwSetWindowPosCallback.
-The position of a window can now be retrieved using glfwGetWindowPos.
-Each windows now has a callback for focus events, which is set with glfwSetWindowFocusCallback.
-Each window now has a callback for when the mouse cursor enters or leaves its client area, which is set with glfwSetCursorEnterCallback.
-The title of a window is now specified at creation time, as one of the arguments to glfwCreateWindow.
-Windows can now be hidden with glfwHideWindow, shown using glfwShowWindow and created initially hidden with the GLFW_VISIBLE
window hint. This allows for off-screen rendering in a way compatible with most drivers, as well as moving a window to a specific position before showing it.
Windowed mode windows can now be created without decorations, i.e. things like a frame, a title bar, with the GLFW_DECORATED
window hint. This allows for the creation of things like splash screens.
Modifier key bit mask parameters have been added to the mouse button and key callbacks.
-A scancode parameter has been added to the key callback. Keys that don't have a key token still get passed on with the key parameter set to GLFW_KEY_UNKNOWN
. These scancodes will vary between machines and are intended to be used for key bindings.
The name of a joystick can now be retrieved using glfwGetJoystickName.
-You are reading it.
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
This guide will show how to write simple OpenGL applications using GLFW 3. It will introduce a few of the most commonly used functions, but there are many others. To see detailed documentation on any GLFW function, just click on its name.
-This guide assumes no experience with earlier versions of GLFW. If you have used GLFW 2.x in the past, you should also read the transition guide.
-In the files of your program where you use OpenGL or GLFW, you need to include the GLFW 3 header file.
-This defines all the constants, types and function prototypes of the GLFW API. It also includes the OpenGL header, and defines all the constants and types necessary for it to work on your platform.
-For example, under Windows you are normally required to include windows.h
before including GL/gl.h
. This would make your source file tied to Windows and pollute your code's namespace with the whole Win32 API.
Instead, the GLFW header takes care of this for you, not by including windows.h
, but rather by itself duplicating only the necessary parts of it. It does this only where needed, so if windows.h
is included, the GLFW header does not try to redefine those symbols.
In other words:
-windows.h
or other platform-specific headers unless you plan on using those APIs directlyStarting with version 3.0, the GLU header glu.h
is no longer included by default. If you wish to include it, define GLFW_INCLUDE_GLU
before the inclusion of the GLFW header.
Before you can use most GLFW functions, the library must be initialized. This is done with glfwInit, which returns non-zero if successful, or zero if an error occurred.
-When you are done using GLFW, typically at the very end of the program, you need to call glfwTerminate.
-This destroys any remaining windows and releases any other resources allocated by GLFW. After this call, you must call glfwInit again before using any GLFW functions that require it.
-Most events are reported through callbacks, whether it's a key being pressed, a GLFW window being moved, or an error occurring. Callbacks are simply C functions (or C++ static methods) that are called by GLFW with arguments describing the event.
-In case glfwInit or any other GLFW function fails, an error is reported to the GLFW error callback. You can receive these reports by setting the error callback. The callback function itself should match the signature of GLFWerrorfun. Here is a simple error callback that just prints the error description to stderr
.
Setting the callback, so GLFW knows to call it, is done with glfwSetErrorCallback. This is one of the few GLFW functions that may be called before glfwInit, which lets you be notified of errors during initialization, so you should set it before you do anything else with GLFW.
-The window (and its context) is created with glfwCreateWindow, which returns a handle to the created window. For example, this creates a 640 by 480 windowed mode window:
-If window creation fails, NULL
will be returned, so you need to check whether it did.
This handle is then passed to all window related functions, and is provided to you along with input events, so you know which window received the input.
-To create a full screen window, you need to specify which monitor the window should use. In most cases, the user's primary monitor is a good choice. You can get this with glfwGetPrimaryMonitor. To make the above window full screen, just pass along the monitor handle:
-Full screen windows cover the entire display area of a monitor, have no border or decorations, and change the monitor's resolution to the one most closely matching the requested window size.
-When you are done with the window, destroy it with the glfwDestroyWindow function.
-Once this function is called, no more events will be delivered for that window and its handle becomes invalid.
-Before you can use the OpenGL API, it must have a current OpenGL context. You make a window's context current with glfwMakeContextCurrent. It will then remain as the current context until you make another context current or until the window owning it is destroyed.
-Each window has a flag indicating whether the window should be closed. This can be checked with glfwWindowShouldClose.
-When the user attempts to close the window, either by pressing the close widget in the title bar or using a key combination like Alt+F4, this flag is set to 1. Note that the window isn't actually closed, so you are expected to monitor this flag and either destroy the window or give some kind of feedback to the user.
-You can be notified when user is attempting to close the window by setting a close callback with glfwSetWindowCloseCallback. The callback will be called immediately after the close flag has been set.
-You can also set it yourself with glfwSetWindowShouldClose. This can be useful if you want to interpret other kinds of input as closing the window, like for example pressing the escape key.
-Each window has a large number of callbacks that can be set to receive all the various kinds of events. To receive key press and release events, a key callback is set using glfwSetKeyCallback.
-For event callbacks to actually be called when an event occurs, you need to process events as described below.
-Once you have a current OpenGL context, you can use OpenGL normally. In this tutorial, a multi-colored rotating triangle will be rendered. The framebuffer size, needed by this example for glViewport
and glOrtho
, is retrieved with glfwGetFramebufferSize.
However, you can also set a framebuffer size callback using glfwSetFramebufferSizeCallback and call glViewport
from there.
For the triangle to rotate properly, a time source is needed. GLFW provides glfwGetTime, which returns the number of seconds since glfwInit as a double
. The time source used is the most accurate on each platform and generally has micro- or nanosecond resolution.
GLFW windows always use double-buffering. That means that you have two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.
-When the entire frame has been rendered, it is time to swap the back and the front buffers in order to display the rendered frame, and begin rendering a new frame. This is done with glfwSwapBuffers.
-GLFW needs to communicate regularly with the window system both in order to receive events and to show that it hasn't locked up. Event processing must be done regularly and is normally done each frame before rendering but after buffer swap.
-There are two ways to process pending events. glfwPollEvents processes only those events that have already been received and then returns immediately. This is the best choice when rendering continually, like most games do.
-If instead you only need to update your rendering once you have received new input, glfwWaitEvents is a better choice. It waits until at least one event has been received, putting the thread to sleep in the meantime, and then processes all received events just like glfwPollEvents does. This saves a great deal of CPU cycles and is useful for, for example, many kinds of editing tools.
-Now that you know how to initialize GLFW, create a window and poll for keyboard input, it's possible to create a simple program.
- This program creates a 640 by 480 windowed mode window and runs a loop clearing the screen, rendering a triangle and processing events until the user closes the window. It can be found in the source distribution as examples/simple.c
, and is by default compiled along with all other examples when you build GLFW.
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
Gamma ramp. - More...
--Data Fields | |
unsigned short * | red |
unsigned short * | green |
unsigned short * | blue |
unsigned int | size |
This describes the gamma ramp for a monitor.
-unsigned short* GLFWgammaramp::blue | -
An array of value describing the response of the blue channel.
- -unsigned short* GLFWgammaramp::green | -
An array of value describing the response of the green channel.
- -unsigned short* GLFWgammaramp::red | -
An array of value describing the response of the red channel.
- -unsigned int GLFWgammaramp::size | -
The number of elements in each array.
- -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
Video mode type. - More...
--Data Fields | |
int | width |
int | height |
int | redBits |
int | greenBits |
int | blueBits |
int | refreshRate |
This describes a single video mode.
-int GLFWvidmode::blueBits | -
The bit depth of the blue channel of the video mode.
- -int GLFWvidmode::greenBits | -
The bit depth of the green channel of the video mode.
- -int GLFWvidmode::height | -
The height, in screen coordinates, of the video mode.
- -int GLFWvidmode::redBits | -
The bit depth of the red channel of the video mode.
- -int GLFWvidmode::refreshRate | -
The refresh rate, in Hz, of the video mode.
- -int GLFWvidmode::width | -
The width, in screen coordinates, of the video mode.
- -
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-
The primary purpose of GLFW is to provide a simple interface to window management and OpenGL and OpenGL ES context creation. GLFW supports multiple windows, which can be either a normal desktop window or a full screen window.
-The GLFWwindow object encapsulates both a window and a context. They are created with glfwCreateWindow and destroyed with glfwDestroyWindow (or glfwTerminate, if any remain). As the window and context are inseparably linked, the object pointer is used as both a context and window handle.
-The window and its context are created with glfwCreateWindow, which returns a handle to the created window object. For example, this creates a 640 by 480 windowed mode window:
-If window creation fails, NULL
will be returned, so you need to check whether it did.
This handle is then passed to all window related functions, and is provided to you along with input events, so you know which window received the input.
-To create a full screen window, you need to specify which monitor the window should use. In most cases, the user's primary monitor is a good choice. For more information about monitors, see the Multi-monitor guide.
-Full screen windows cover the entire display area of a monitor, have no border or decorations, and change the monitor's resolution to the one most closely matching the requested window size.
-For more control over how the window and its context are created, see Window creation hints below.
-When you are done with the window, destroy it with the glfwDestroyWindow function.
-Once this function is called, no more events will be delivered for that window and its handle becomes invalid.
-There are a number of hints that can be set before the creation of a window and context. Some affect the window itself, others affect the framebuffer or context. These hints are set to their default values each time the library is initialized with glfwInit, can be set individually with glfwWindowHint and reset all at once to their defaults with glfwDefaultWindowHints.
-Note that hints need to be set before the creation of the window and context you wish to have the specified attributes.
-Some window hints are hard constraints. These must match the available capabilities exactly for window and context creation to succeed. Hints that are not hard constraints are matched as closely as possible, but the resulting window and context may differ from what these hints requested. To find out the actual attributes of the created window and context, use the glfwGetWindowAttrib function.
-The following hints are hard constraints:
-GLFW_STEREO
GLFW_CLIENT_API
The following additional hints are hard constraints if requesting an OpenGL context:
-GLFW_OPENGL_FORWARD_COMPAT
GLFW_OPENGL_PROFILE
Hints that do not apply to a given type of window or context are ignored.
-The GLFW_RESIZABLE
hint specifies whether the window will be resizable by the user. The window will still be resizable using the glfwSetWindowSize function. This hint is ignored for full screen windows.
The GLFW_VISIBLE
hint specifies whether the window will be initially visible. This hint is ignored for full screen windows.
The GLFW_DECORATED
hint specifies whether the window will have window decorations such as a border, a close widget, etc. This hint is ignored for full screen windows. Note that even though a window may lack a close widget, it is usually still possible for the user to generate close events.
The GLFW_RED_BITS
, GLFW_GREEN_BITS
, GLFW_BLUE_BITS
, GLFW_ALPHA_BITS
, GLFW_DEPTH_BITS
and GLFW_STENCIL_BITS
hints specify the desired bit depths of the various components of the default framebuffer.
The GLFW_ACCUM_RED_BITS
, GLFW_ACCUM_GREEN_BITS
, GLFW_ACCUM_BLUE_BITS
and GLFW_ACCUM_ALPHA_BITS
hints specify the desired bit depths of the various components of the accumulation buffer.
The GLFW_AUX_BUFFERS
hint specifies the desired number of auxiliary buffers.
The GLFW_STEREO
hint specifies whether to use stereoscopic rendering.
The GLFW_SAMPLES
hint specifies the desired number of samples to use for multisampling. Zero disables multisampling.
The GLFW_SRGB_CAPABLE
hint specifies whether the framebuffer should be sRGB capable.
The GLFW_REFRESH_RATE
hint specifies the desired refresh rate for full screen windows. If set to zero, the highest available refresh rate will be used. This hint is ignored for windowed mode windows.
The GLFW_CLIENT_API
hint specifies which client API to create the context for. Possible values are GLFW_OPENGL_API
and GLFW_OPENGL_ES_API
.
The GLFW_CONTEXT_VERSION_MAJOR
and GLFW_CONTEXT_VERSION_MINOR
hints specify the client API version that the created context must be compatible with.
For OpenGL, these hints are not hard constraints, as they don't have to match exactly, but glfwCreateWindow will still fail if the resulting OpenGL version is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you may still get backwards-compatible contexts of version 3.0 and above when available.
-While there is no way to ask the driver for a context of the highest supported version, most drivers provide this when you ask GLFW for a version 1.0 context.
-For OpenGL ES, these hints are hard constraints.
-If an OpenGL context is requested, the GLFW_OPENGL_FORWARD_COMPAT
hint specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This may only be used if the requested OpenGL version is 3.0 or above. If another client API is requested, this hint is ignored.
If an OpenGL context is requested, the GLFW_OPENGL_DEBUG_CONTEXT
hint specifies whether to create a debug OpenGL context, which may have additional error and performance issue reporting functionality. If another client API is requested, this hint is ignored.
If an OpenGL context is requested, the GLFW_OPENGL_PROFILE
hint specifies which OpenGL profile to create the context for. Possible values are one of GLFW_OPENGL_CORE_PROFILE
or GLFW_OPENGL_COMPAT_PROFILE
, or GLFW_OPENGL_ANY_PROFILE
to not request a specific profile. If requesting an OpenGL version below 3.2, GLFW_OPENGL_ANY_PROFILE
must be used. If another client API is requested, this hint is ignored.
The GLFW_CONTEXT_ROBUSTNESS
hint specifies the robustness strategy to be used by the context. This can be one of GLFW_NO_RESET_NOTIFICATION
or GLFW_LOSE_CONTEXT_ON_RESET
, or GLFW_NO_ROBUSTNESS
to not request a robustness strategy.
Name | Default value | Supported values |
---|---|---|
GLFW_RESIZABLE | GL_TRUE | GL_TRUE or GL_FALSE |
GLFW_VISIBLE | GL_TRUE | GL_TRUE or GL_FALSE |
GLFW_DECORATED | GL_TRUE | GL_TRUE or GL_FALSE |
GLFW_RED_BITS | 8 | 0 to INT_MAX |
GLFW_GREEN_BITS | 8 | 0 to INT_MAX |
GLFW_BLUE_BITS | 8 | 0 to INT_MAX |
GLFW_ALPHA_BITS | 8 | 0 to INT_MAX |
GLFW_DEPTH_BITS | 24 | 0 to INT_MAX |
GLFW_STENCIL_BITS | 8 | 0 to INT_MAX |
GLFW_ACCUM_RED_BITS | 0 | 0 to INT_MAX |
GLFW_ACCUM_GREEN_BITS | 0 | 0 to INT_MAX |
GLFW_ACCUM_BLUE_BITS | 0 | 0 to INT_MAX |
GLFW_ACCUM_ALPHA_BITS | 0 | 0 to INT_MAX |
GLFW_AUX_BUFFERS | 0 | 0 to INT_MAX |
GLFW_SAMPLES | 0 | 0 to INT_MAX |
GLFW_REFRESH_RATE | 0 | 0 to INT_MAX |
GLFW_STEREO | GL_FALSE | GL_TRUE or GL_FALSE |
GLFW_SRGB_CAPABLE | GL_FALSE | GL_TRUE or GL_FALSE |
GLFW_CLIENT_API | GLFW_OPENGL_API | GLFW_OPENGL_API or GLFW_OPENGL_ES_API |
GLFW_CONTEXT_VERSION_MAJOR | 1 | Any valid major version number of the chosen client API |
GLFW_CONTEXT_VERSION_MINOR | 0 | Any valid minor version number of the chosen client API |
GLFW_CONTEXT_ROBUSTNESS | GLFW_NO_ROBUSTNESS | GLFW_NO_ROBUSTNESS , GLFW_NO_RESET_NOTIFICATION or GLFW_LOSE_CONTEXT_ON_RESET |
GLFW_OPENGL_FORWARD_COMPAT | GL_FALSE | GL_TRUE or GL_FALSE |
GLFW_OPENGL_DEBUG_CONTEXT | GL_FALSE | GL_TRUE or GL_FALSE |
GLFW_OPENGL_PROFILE | GLFW_OPENGL_ANY_PROFILE | GLFW_OPENGL_ANY_PROFILE , GLFW_OPENGL_COMPAT_PROFILE or GLFW_OPENGL_CORE_PROFILE |
When the user attempts to close the window, for example by clicking the close widget or using a key chord like Alt+F4, the close flag of the window is set. The window is however not actually destroyed and, unless you watch for this state change, nothing further happens.
-The current state of the close flag is returned by glfwWindowShouldClose and can be set or cleared directly with glfwSetWindowShouldClose. A common pattern is to use the close flag as a main loop condition.
-If you wish to be notified when the user attempts to close a window, you can set the close callback with glfwSetWindowCloseCallback. This callback is called directly after the close flag has been set.
-The callback function can be used for example to filter close requests and clear the close flag again unless certain conditions are met.
-The size of a window can be changed with glfwSetWindowSize. For windowed mode windows, this resizes the specified window so that its client area has the specified size. Note that the window system may put limitations on size. For full screen windows, it selects and sets the video mode most closely matching the specified size.
-If you wish to be notified when a window is resized, whether by the user or the system, you can set the size callback with glfwSetWindowSizeCallback.
-The callback function receives the new size of the client area of the window.
-There is also glfwGetWindowSize for directly retrieving the current size of a window.
-While the size of a window is measured in screen coordinates, OpenGL works with pixels. The size you pass into glViewport
, for example, should be in pixels and not screen coordinates. On some platforms screen coordinates and pixels are the same, but this is not the case on all platforms supported by GLFW. There is a second set of functions to retrieve the size in pixels of the framebuffer of a window.
If you wish to be notified when the framebuffer of a window is resized, whether by the user or the system, you can set the size callback with glfwSetFramebufferSizeCallback.
-The callback function receives the new size of the client area of the window, which can for example be used to update the OpenGL viewport.
-There is also glfwGetFramebufferSize for directly retrieving the current size of the framebuffer of a window.
-Note that the size of a framebuffer may change independently of the size of a window, for example if the window is dragged between a regular monitor and a high-DPI one.
-The position of a windowed-mode window can be changed with glfwSetWindowPos. This moves the window so that the upper-left corner of its client area has the specified screen coordinates. Note that the window system may put limitations on placement.
-If you wish to be notified when a window is moved, whether by the user or the system, you can set the position callback with glfwSetWindowPosCallback.
-The callback function receives the new position of the upper-left corner of its client area.
-There is also glfwGetWindowPos for directly retrieving the current position of the client area of the window.
-All GLFW windows have a title, although undecorated or full screen windows may not display it or only display it in a task bar or similar interface. To change the title of a window, use glfwSetWindowTitle.
-The window title is a regular C string using the UTF-8 encoding. This means for example that, as long as your source file is encoded as UTF-8, you can use any Unicode characters.
-Windows have a number of attributes that can be returned using glfwGetWindowAttrib. Some reflect state that may change during the lifetime of the window, while others reflect the corresponding hints and are fixed at the time of creation.
-The GLFW_FOCUSED
attribute indicates whether the specified window currently has input focus.
The GLFW_ICONIFIED
attribute indicates whether the specified window is currently iconified, whether by the user or with glfwIconifyWindow.
The GLFW_VISIBLE
attribute indicates whether the specified window is currently visible. Window visibility can be controlled with glfwShowWindow and glfwHideWindow and initial visibility is controlled by the window hint with the same name.
The GLFW_RESIZABLE
attribute indicates whether the specified window is resizable by the user. This is controlled by the window hint with the same name.
The GLFW_DECORATED
attribute indicates whether the specified window has decorations such as a border, a close widget, etc. This is controlled by the window hint with the same name.
The GLFW_CLIENT_API
attribute indicates the client API provided by the window's context; either GLFW_OPENGL_API
or GLFW_OPENGL_ES_API
.
The GLFW_CONTEXT_VERSION_MAJOR
, GLFW_CONTEXT_VERSION_MINOR
and GLFW_CONTEXT_REVISION
attributes indicate the client API version of the window's context.
The GLFW_OPENGL_FORWARD_COMPAT
attribute is GL_TRUE
if the window's context is an OpenGL forward-compatible one, or GL_FALSE
otherwise.
The GLFW_OPENGL_DEBUG_CONTEXT
attribute is GL_TRUE
if the window's context is an OpenGL debug context, or GL_FALSE
otherwise.
The GLFW_OPENGL_PROFILE
attribute indicates the OpenGL profile used by the context. This is GLFW_OPENGL_CORE_PROFILE
or GLFW_OPENGL_COMPAT_PROFILE
if the context uses a known profile, or GLFW_OPENGL_ANY_PROFILE
if the OpenGL profile is unknown or the context is for another client API.
The GLFW_CONTEXT_ROBUSTNESS
attribute indicates the robustness strategy used by the context. This is GLFW_LOSE_CONTEXT_ON_RESET
or GLFW_NO_RESET_NOTIFICATION
if the window's context supports robustness, or GLFW_NO_ROBUSTNESS
otherwise.
GLFW windows are always double buffered. That means that you have two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.
-When the entire frame has been rendered, it is time to swap the back and the front buffers in order to display what has been rendered and begin rendering a new frame. This is done with glfwSwapBuffers.
-Sometimes it can be useful to select when the buffer swap will occur. With the function glfwSwapInterval it is possible to select the minimum number of monitor refreshes the driver should wait before swapping the buffers:
-If the interval is zero, the swap will take place immediately when glfwSwapBuffers is called without waiting for a refresh. Otherwise at least interval retraces will pass between each buffer swap. Using a swap interval of zero can be useful for benchmarking purposes, when it is not desirable to measure the time it takes to wait for the vertical retrace. However, a swap interval of one lets you avoid tearing.
-Note that not all OpenGL implementations properly implement this function, in which case glfwSwapInterval will have no effect. Some drivers also have user settings that override requests by GLFW.
-
- GLFW
- 3.0.2
-
- A multi-platform library for OpenGL, window and input
- |
-