mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 16:44:11 +00:00
Converted docs to hybrid Markdown.
This commit is contained in:
+44
-44
@@ -20,21 +20,21 @@ 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
|
||||
<a href="http://www.tronche.com/gui/x/icccm/">Inter-Client Communication Conventions Manual</a>
|
||||
[Inter-Client Communication Conventions Manual](http://www.tronche.com/gui/x/icccm/)
|
||||
(ICCCM) and
|
||||
<a href="http://standards.freedesktop.org/wm-spec/wm-spec-latest.html">Extended Window Manager Hints</a>
|
||||
[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
|
||||
(EWMH) standards.
|
||||
|
||||
GLFW uses the ICCCM @c WM_DELETE_WINDOW protocol to intercept the user
|
||||
GLFW uses the ICCCM `WM_DELETE_WINDOW` protocol to intercept the user
|
||||
attempting to close the GLFW window. If the running window manager does not
|
||||
support this protocol, the close callback will never be called.
|
||||
|
||||
GLFW uses the EWMH @c _NET_WM_PING protocol, allowing the window manager notify
|
||||
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 @c _NET_WM_STATE protocol to tell the window manager to make
|
||||
GLFW uses the EWMH `_NET_WM_STATE` protocol to tell the window manager to make
|
||||
the GLFW window fullscreen. If the running window manager does not support this
|
||||
protocol, fullscreen windows may not work properly. GLFW has a fallback code
|
||||
path in case this protocol is unavailable, but every window manager behaves
|
||||
@@ -45,63 +45,63 @@ slightly differently in this regard.
|
||||
The GLX API is the default API used to create OpenGL contexts on Unix-like
|
||||
systems using the X Window System.
|
||||
|
||||
GLFW uses the @c GLXFBConfig API to enumerate and select framebuffer pixel
|
||||
formats. This requires either GLX 1.3 or greater, or the @c GLX_SGIX_fbconfig
|
||||
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 @c GLX_MESA_swap_control, @c GLX_EXT_swap_control and @c
|
||||
GLX_SGI_swap_control extensions to provide vertical retrace synchronization (or
|
||||
"vsync"), in that order of preference. Where none of these extension are
|
||||
GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and
|
||||
`GLX_SGI_swap_control` extensions to provide vertical retrace synchronization
|
||||
(or "vsync"), in that order of preference. Where none of these extension are
|
||||
available, calling @ref glfwSwapInterval will have no effect.
|
||||
|
||||
GLFW uses the @c GLX_ARB_multisample extension to create contexts with
|
||||
multisampling anti-aliasing. Where this extension is unavailable, the @c
|
||||
GLFW_SAMPLES hint 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 @c GLX_ARB_create_context extension when available, even when
|
||||
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 @c GLFW_CONTEXT_VERSION_MAJOR and @c GLFW_CONTEXT_VERSION_MINOR
|
||||
hints will only be partially supported, the @c GLFW_OPENGL_DEBUG_CONTEXT hint
|
||||
will have no effect, and setting the @c GLFW_OPENGL_PROFILE or @c
|
||||
GLFW_OPENGL_FORWARD_COMPAT hints to a non-zero value will cause @ref
|
||||
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
|
||||
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
||||
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
|
||||
`GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value will cause @ref
|
||||
glfwCreateWindow to fail.
|
||||
|
||||
GLFW uses the @c GLX_ARB_create_context_profile extension to provide support for
|
||||
context profiles. Where this extension is unavailable, setting the @c
|
||||
GLFW_OPENGL_PROFILE hint to anything but zero, or setting @c GLFW_CLIENT_API to
|
||||
anything but @c GLFW_OPENGL_API will cause @ref glfwCreateWindow to fail.
|
||||
GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
|
||||
context profiles. Where this extension is unavailable, setting the
|
||||
`GLFW_OPENGL_PROFILE` hint to anything but zero, or setting `GLFW_CLIENT_API` to
|
||||
anything but `GLFW_OPENGL_API` will cause @ref glfwCreateWindow to fail.
|
||||
|
||||
@section compat_wgl WGL extensions
|
||||
|
||||
The WGL API is used to create OpenGL contexts on Microsoft Windows and other
|
||||
implementations of the Win32 API, such as Wine.
|
||||
|
||||
GLFW uses either the @c WGL_EXT_extension_string or the @c
|
||||
WGL_ARB_extension_string extension to check for the presence of all other WGL
|
||||
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 @c WGL_EXT_swap_control extension to provide vertical retrace
|
||||
GLFW uses the `WGL_EXT_swap_control` extension to provide vertical retrace
|
||||
synchronization (or "vsync"). Where this extension is unavailable, calling @ref
|
||||
glfwSwapInterval will have no effect.
|
||||
|
||||
GLFW uses the @c WGL_ARB_pixel_format and @c WGL_ARB_multisample extensions to
|
||||
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 @c GLFW_SAMPLES hint will have no effect.
|
||||
unavailable, the `GLFW_SAMPLES` hint will have no effect.
|
||||
|
||||
GLFW uses the @c WGL_ARB_create_context extension when available, even when
|
||||
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 @c GLFW_CONTEXT_VERSION_MAJOR and @c GLFW_CONTEXT_VERSION_MINOR
|
||||
hints will only be partially supported, the @c GLFW_OPENGL_DEBUG_CONTEXT hint
|
||||
will have no effect, and setting the @c GLFW_OPENGL_PROFILE or @c
|
||||
GLFW_OPENGL_FORWARD_COMPAT hints to a non-zero value will cause @ref
|
||||
unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
|
||||
hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
|
||||
will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
|
||||
`GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value will cause @ref
|
||||
glfwCreateWindow to fail.
|
||||
|
||||
GLFW uses the @c WGL_ARB_create_context_profile extension to provide support for
|
||||
context profiles. Where this extension is unavailable, setting the @c
|
||||
GLFW_OPENGL_PROFILE hint to anything but zero will cause @ref glfwCreateWindow
|
||||
GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
|
||||
context profiles. Where this extension is unavailable, setting the
|
||||
`GLFW_OPENGL_PROFILE` hint to anything but zero will cause @ref glfwCreateWindow
|
||||
to fail.
|
||||
|
||||
@section cmopat_osx OpenGL 3.2 on Mac OS X
|
||||
@@ -111,17 +111,17 @@ then only forward-compatible OpenGL 3.2 core profile contexts are supported.
|
||||
There is also still no mechanism for requesting debug contexts. Versions of
|
||||
Mac OS X earlier than 10.7 support at most OpenGL version 2.1.
|
||||
|
||||
Because of this, on Mac OS X 10.7, the @c GLFW_CONTEXT_VERSION_MAJOR and
|
||||
@c GLFW_CONTEXT_VERSION_MINOR hints will fail if given a version above 3.2, the
|
||||
@c GLFW_OPENGL_FORWARD_COMPAT is required for creating OpenGL 3.2 contexts, the
|
||||
@c GLFW_OPENGL_DEBUG_CONTEXT hint is ignored and setting the @c
|
||||
GLFW_OPENGL_PROFILE hint to anything except @c GLFW_OPENGL_CORE_PROFILE will
|
||||
Because of this, on Mac OS X 10.7, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 3.2, the
|
||||
`GLFW_OPENGL_FORWARD_COMPAT` is required for creating OpenGL 3.2 contexts, the
|
||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored and setting the
|
||||
`GLFW_OPENGL_PROFILE` hint to anything except `GLFW_OPENGL_CORE_PROFILE` will
|
||||
cause @ref glfwCreateWindow to fail.
|
||||
|
||||
Also, on Mac OS X 10.6 and below, the @c GLFW_CONTEXT_VERSION_MAJOR and @c
|
||||
GLFW_CONTEXT_VERSION_MINOR hints will fail if given a version above 2.1, the @c
|
||||
GLFW_OPENGL_DEBUG_CONTEXT hint will have no effect, and setting the @c
|
||||
GLFW_OPENGL_PROFILE or @c GLFW_OPENGL_FORWARD_COMPAT hints to a non-zero value
|
||||
Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, the
|
||||
`GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the
|
||||
`GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value
|
||||
will cause @ref glfwCreateWindow to fail.
|
||||
|
||||
*/
|
||||
|
||||
+3
-3
@@ -8,9 +8,9 @@ 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.
|
||||
|
||||
@link quick Quick introduction @endlink is a short tutorial for people new to GLFW.
|
||||
[Quick introduction](@ref quick) is a short tutorial for people new to GLFW.
|
||||
|
||||
@link moving Moving from GLFW 2 to 3 @endlink explains what has changed and how
|
||||
to update existing code to use the GLFW 3 API.
|
||||
[Moving from GLFW 2 to 3](@ref moving) explains what has changed and how to
|
||||
update existing code to use the GLFW 3 API.
|
||||
|
||||
*/
|
||||
|
||||
+51
-191
@@ -2,19 +2,19 @@
|
||||
|
||||
@page moving Moving from GLFW 2 to 3
|
||||
|
||||
This is a guide for people moving from GLFW 2 to 3. It describes API @em
|
||||
changes, but does @em not include entirely new features unless they are required
|
||||
when moving an existing code base onto the new API. One example of this is the
|
||||
new multi-monitor support, which you are now required to use to create
|
||||
fullscreen windows.
|
||||
This is a guide for people moving from GLFW 2 to 3. It describes API *changes*,
|
||||
but does *not* include entirely new features unless they are required when
|
||||
moving an existing code base onto the new API. One example of this is the new
|
||||
multi-monitor support, which you are now required to use to create fullscreen
|
||||
windows.
|
||||
|
||||
@section moving_names Library and header names
|
||||
|
||||
The GLFW 3 header is named @ref glfw3.h, to avoid collisions with the GLFW 2 @c
|
||||
glfw.h header, in case they are both installed. Similarly, the GLFW 3 library
|
||||
is named @c glfw3, except when it's installed as a shared library on
|
||||
Unix-like systems, where it uses the
|
||||
<a href="https://en.wikipedia.org/wiki/soname">soname</a> @c libglfw.so.3 .
|
||||
The GLFW 3 header is named @ref glfw3.h, to avoid collisions with the GLFW 2
|
||||
`glfw.h` header, in case they are both installed. Similarly, the GLFW 3 library
|
||||
is named `glfw3,` except when it's installed as a shared library on Unix-like
|
||||
systems, where it uses the [soname](https://en.wikipedia.org/wiki/soname)
|
||||
`libglfw.so.3`.
|
||||
|
||||
@section moving_threads Removal of threading functions
|
||||
|
||||
@@ -31,11 +31,11 @@ The image and texture loading support has been removed.
|
||||
|
||||
Because GLFW 3 supports multiple windows, window handle parameters have been
|
||||
added to all window-related functions and callbacks. Window handles are of the
|
||||
@c GLFWwindow* type, i.e. a pointer to an opaque struct.
|
||||
`GLFWwindow*` type, i.e. a pointer to an opaque struct.
|
||||
|
||||
@section moving_monitor Multi-monitor support
|
||||
|
||||
GLFW 3 provides support for multiple monitors, adding the @c GLFWmonitor* handle
|
||||
GLFW 3 provides support for multiple monitors, adding the `GLFWmonitor*` handle
|
||||
type and a set of related functions. To request a fullscreen mode window, you
|
||||
need to specify which monitor you wish the window to use. There is @ref
|
||||
glfwGetPrimaryMonitor that provides something similar to the earlier behaviour.
|
||||
@@ -62,12 +62,12 @@ a window but before calling any OpenGL functions.
|
||||
|
||||
GLFW 3 uses the physical key locations named after the symbols they generate
|
||||
using the US keyboard layout, instead of layout-dependent characters like in
|
||||
GLFW 2. This means that (for example) @c GLFW_KEY_BACKSLASH is always a single
|
||||
GLFW 2. This means that (for example) `GLFW_KEY_BACKSLASH` 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.
|
||||
|
||||
GLFW 3 has key tokens for all keys, so instead of trying to remember whether to
|
||||
check for @c 'a' or @c 'A', you now check for @c GLFW_KEY_A.
|
||||
check for `'a'` or `'A'`, you now check for `GLFW_KEY_A`.
|
||||
|
||||
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
|
||||
@@ -76,7 +76,7 @@ give you the characters being input, as opposed to the keys being pressed.
|
||||
|
||||
@section moving_video_modes Video mode enumeration
|
||||
|
||||
Video mode enumeration is now per-monitor. The @c glfwGetDesktopMode function
|
||||
Video mode enumeration is now per-monitor. The `glfwGetDesktopMode` function
|
||||
has been replaced by @ref glfwGetVideoMode, which returns the current mode of
|
||||
a monitor. The @ref glfwGetVideoMode function now returns all available modes
|
||||
for a monitor instead of requiring you to guess how large an array you need.
|
||||
@@ -84,7 +84,7 @@ for a monitor instead of requiring you to guess how large an array you need.
|
||||
@section moving_glu GLU header inclusion
|
||||
|
||||
Unlike GLFW 2, GLFW 3 doesn't include the GLU header by default, but you can
|
||||
make it do so by defining @c GLFW_INCLUDE_GLU before including the GLFW
|
||||
make it do so by defining `GLFW_INCLUDE_GLU` before including the GLFW
|
||||
3 header.
|
||||
|
||||
@section moving_cursor Cursor positioning
|
||||
@@ -97,183 +97,43 @@ function fails silently.
|
||||
|
||||
@subsection moving_renamed_functions Renamed functions
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>GLFW 2</td>
|
||||
<td>GLFW 3</td>
|
||||
<td>Notes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwOpenWindow</td>
|
||||
<td>@ref glfwCreateWindow</td>
|
||||
<td>All channel bit depths are now hints<br />The defaults are 24-bit color
|
||||
and depth buffers<br />Accepts initial window title, optional monitor to go
|
||||
fullscreen on and optional context to share objects with</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwCloseWindow</td>
|
||||
<td>@ref glfwDestroyWindow</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwOpenWindowHint</td>
|
||||
<td>@ref glfwWindowHint</td>
|
||||
<td>Now also accepts @c GLFW_RED_BITS, @c GLFW_GREEN_BITS, @c
|
||||
GLFW_BLUE_BITS, @c GLFW_ALPHA_BITS, @c GLFW_DEPTH_BITS and @c
|
||||
GLFW_STENCIL_BITS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwEnable</td>
|
||||
<td>@ref glfwSetInputMode</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwDisable</td>
|
||||
<td>@ref glfwSetInputMode</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwGetMousePos</td>
|
||||
<td>@ref glfwGetCursorPos</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwSetMousePos</td>
|
||||
<td>@ref glfwSetCursorPos</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwSetMousePosCallback</td>
|
||||
<td>@ref glfwSetCursorPosCallback</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwSetMouseWheelCallback</td>
|
||||
<td>@ref glfwSetScrollCallback</td>
|
||||
<td>Accepts two-dimensional scroll offsets as doubles</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwGetJoystickPos</td>
|
||||
<td>@ref glfwGetJoystickAxes</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwGetGLVersion</td>
|
||||
<td>@ref glfwGetWindowParam</td>
|
||||
<td>Use @c GLFW_OPENGL_VERSION_MAJOR, @c GLFW_OPENGL_VERSION_MINOR and @c
|
||||
GLFW_OPENGL_REVISION</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c glfwGetDesktopMode</td>
|
||||
<td>@ref glfwGetVideoMode</td>
|
||||
<td>Returns the current mode of a monitor</td>
|
||||
</tr>
|
||||
</table>
|
||||
| GLFW 2 | GLFW 3 | Notes |
|
||||
| --------------------------- | ----------------------------- | ----- |
|
||||
| `glfwOpenWindow` | @ref glfwCreateWindow | All channel bit depths are now hints<br />Accepts initial window title, optional monitor to go fullscreen on and optional context to share objects with |
|
||||
| `glfwCloseWindow` | @ref glfwDestroyWindow | |
|
||||
| `glfwOpenWindowHint` | @ref glfwWindowHint | Now accepts all `GLFW_*_BITS` tokens |
|
||||
| `glfwEnable` | @ref glfwSetInputMode | |
|
||||
| `glfwDisable` | @ref glfwSetInputMode | |
|
||||
| `glfwGetMousePos` | @ref glfwGetCursorPos | |
|
||||
| `glfwSetMousePos` | @ref glfwSetCursorPos | |
|
||||
| `glfwSetMousePosCallback` | @ref glfwSetCursorPosCallback | |
|
||||
| `glfwSetMouseWheelCallback` | @ref glfwSetScrollCallback | Accepts two-dimensional scroll offsets as doubles |
|
||||
| `glfwGetJoystickPos` | @ref glfwGetJoystickAxes | |
|
||||
| `glfwGetGLVersion` | @ref glfwGetWindowParam | Use `GLFW_OPENGL_VERSION_MAJOR`, `GLFW_OPENGL_VERSION_MINOR` and `GLFW_OPENGL_REVISION` |
|
||||
| `glfwGetDesktopMode` | @ref glfwGetVideoMode | Returns the current mode of a monitor |
|
||||
|
||||
@subsection moving_renamed_tokens Renamed tokens
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>GLFW 2</td>
|
||||
<td>GLFW 3</td>
|
||||
<td>Notes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_OPENGL_VERSION_MAJOR</td>
|
||||
<td>@c GLFW_CONTEXT_VERSION_MAJOR</td>
|
||||
<td>Renamed as it applies to OpenGL ES as well</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_OPENGL_VERSION_MINOR</td>
|
||||
<td>@c GLFW_CONTEXT_VERSION_MINOR</td>
|
||||
<td>Renamed as it applies to OpenGL ES as well</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_FSAA_SAMPLES</td>
|
||||
<td>@c GLFW_SAMPLES</td>
|
||||
<td>Renamed to match the OpenGL API</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_ACTIVE</td>
|
||||
<td>@c GLFW_FOCUSED</td>
|
||||
<td>Renamed to match the window focus callback</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_WINDOW_NO_RESIZE</td>
|
||||
<td>@c GLFW_RESIZABLE</td>
|
||||
<td>The default has been inverted</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_MOUSE_CURSOR</td>
|
||||
<td>@c GLFW_CURSOR_MODE</td>
|
||||
<td>Used with @c glfwSetInputMode<br />Accepts @c GLFW_CURSOR_NORMAL, @c
|
||||
GLFW_CURSOR_HIDDEN and @c GLFW_CURSOR_CAPTURED</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_ESC</td>
|
||||
<td>@c GLFW_KEY_ESCAPE</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_DEL</td>
|
||||
<td>@c GLFW_KEY_DELETE</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_PAGEUP</td>
|
||||
<td>@c GLFW_KEY_PAGE_UP</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_PAGEDOWN</td>
|
||||
<td>@c GLFW_KEY_PAGE_DOWN</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_KP_NUM_LOCK</td>
|
||||
<td>@c GLFW_KEY_NUM_LOCK</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_LCTRL</td>
|
||||
<td>@c GLFW_KEY_LEFT_CONTROL</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_LSHIFT</td>
|
||||
<td>@c GLFW_KEY_LEFT_SHIFT</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_LALT</td>
|
||||
<td>@c GLFW_KEY_LEFT_ALT</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_LSUPER</td>
|
||||
<td>@c GLFW_KEY_LEFT_SUPER</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_RCTRL</td>
|
||||
<td>@c GLFW_KEY_RIGHT_CONTROL</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_RSHIFT</td>
|
||||
<td>@c GLFW_KEY_RIGHT_SHIFT</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_RALT</td>
|
||||
<td>@c GLFW_KEY_RIGHT_ALT</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@c GLFW_KEY_RSUPER</td>
|
||||
<td>@c GLFW_KEY_RIGHT_SUPER</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
| 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_MODE` | Used with @ref glfwSetInputMode |
|
||||
| `GLFW_KEY_ESC` | `GLFW_KEY_ESCAPE` | |
|
||||
| `GLFW_KEY_DEL` | `GLFW_KEY_DELETE` | |
|
||||
| `GLFW_KEY_PAGEUP` | `GLFW_KEY_PAGE_UP` | |
|
||||
| `GLFW_KEY_PAGEDOWN` | `GLFW_KEY_PAGE_DOWN` | |
|
||||
| `GLFW_KEY_KP_NUM_LOCK` | `GLFW_KEY_NUM_LOCK` | |
|
||||
| `GLFW_KEY_LCTRL` | `GLFW_KEY_LEFT_CONTROL` | |
|
||||
| `GLFW_KEY_LSHIFT` | `GLFW_KEY_LEFT_SHIFT` | |
|
||||
| `GLFW_KEY_LALT` | `GLFW_KEY_LEFT_ALT` | |
|
||||
| `GLFW_KEY_LSUPER` | `GLFW_KEY_LEFT_SUPER` | |
|
||||
| `GLFW_KEY_RCTRL` | `GLFW_KEY_RIGHT_CONTROL` | |
|
||||
| `GLFW_KEY_RSHIFT` | `GLFW_KEY_RIGHT_SHIFT` | |
|
||||
| `GLFW_KEY_RALT` | `GLFW_KEY_RIGHT_ALT` | |
|
||||
| `GLFW_KEY_RSUPER` | `GLFW_KEY_RIGHT_SUPER` | |
|
||||
|
||||
*/
|
||||
|
||||
+20
-20
@@ -23,25 +23,25 @@ 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 @c windows.h
|
||||
before including @c GL/gl.h. This would make your source file tied to Windows
|
||||
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 @c
|
||||
windows.h, but rather by itself duplicating only the necessary parts of it. It
|
||||
does this only where needed, so if @c windows.h @em is included, the GLFW header
|
||||
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:
|
||||
|
||||
@arg Do @em not include the OpenGL headers yourself, as GLFW does this for you
|
||||
@arg Do @em not include @c windows.h or other platform-specific headers unless
|
||||
you plan on using those APIs directly
|
||||
@arg If you @em do need to include such headers, do it @em before including the
|
||||
GLFW and it will detect this
|
||||
* Do *not* include the OpenGL headers yourself, as GLFW does this for you Do
|
||||
* *not* include `windows.h` or other platform-specific headers unless
|
||||
you plan on using those APIs directly
|
||||
* If you *do* need to include such headers, do it *before* including the
|
||||
GLFW and it will detect this
|
||||
|
||||
Starting with version 3.0, the GLU header @c glu.h is no longer included by
|
||||
default. If you wish to include it, define @c GLFW_INCLUDE_GLU before the
|
||||
Starting with version 3.0, the GLU header `glu.h` is no longer included by
|
||||
default. If you wish to include it, define `GLFW_INCLUDE_GLU` before the
|
||||
inclusion of the GLFW header.
|
||||
|
||||
@code
|
||||
@@ -84,7 +84,7 @@ In case @ref glfwInit or any other GLFW function fails, an error is reported to
|
||||
the GLFW error callback. You can receive these reports by setting the error
|
||||
callback. The callback function itself should match the signature of @ref
|
||||
GLFWerrorfun. Here is a simple error callback that just prints the error
|
||||
description to @c stderr.
|
||||
description to `stderr`.
|
||||
|
||||
@code
|
||||
void error_callback(int error, const char* description)
|
||||
@@ -113,7 +113,7 @@ pixels windowed mode window:
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
|
||||
@endcode
|
||||
|
||||
If window creation fails, @c NULL will be returned, so you need to check whether
|
||||
If window creation fails, `NULL` will be returned, so you need to check whether
|
||||
it did.
|
||||
|
||||
@code
|
||||
@@ -170,9 +170,9 @@ be checked with @ref glfwWindowShouldClose.
|
||||
|
||||
When the user attempts to close the window, either by pressing the close widget
|
||||
in the title bar or using a key combination like Alt+F4, this flag is set to 1.
|
||||
Note that <b>the window isn't actually closed</b>, so you are expected to
|
||||
monitor this flag and either destroy the window or give some kind of feedback to
|
||||
the user.
|
||||
Note that **the window isn't actually closed**, so you are expected to monitor
|
||||
this flag and either destroy the window or give some kind of feedback to the
|
||||
user.
|
||||
|
||||
@code
|
||||
while (!glfwWindowShouldClose(window))
|
||||
@@ -194,10 +194,10 @@ for example pressing the escape key.
|
||||
|
||||
Once you have a current OpenGL context, you can use OpenGL normally. In this
|
||||
tutorial, a multi-colored rotating triangle will be rendered. The window size,
|
||||
needed here by @c glViewport and @c glOrtho, is retrieved using @ref
|
||||
needed here by `glViewport` and `glOrtho`, is retrieved using @ref
|
||||
glfwGetWindowSize. However, if you only need it for updating the viewport when
|
||||
the window size changes, you can set a window size callback using @ref
|
||||
glfwSetWindowSizeCallback and call @c glViewport from there.
|
||||
glfwSetWindowSizeCallback and call `glViewport` from there.
|
||||
|
||||
@code
|
||||
void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
@@ -211,7 +211,7 @@ void window_size_callback(GLFWwindow* window, int width, int height)
|
||||
|
||||
For the triangle to rotate properly, a time source is needed. GLFW provides
|
||||
@ref glfwGetTime, which returns the number of seconds since @ref glfwInit as
|
||||
a @c double. The time source used is the most accurate on each platform and
|
||||
a `double`. The time source used is the most accurate on each platform and
|
||||
generally has micro- or nanosecond resolution.
|
||||
|
||||
@code
|
||||
|
||||
Reference in New Issue
Block a user