aboutsummaryrefslogtreecommitdiff
path: root/contrib/glfw/glfw-3.3.5.bin.WIN64/docs/html/intro_guide.html
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/glfw/glfw-3.3.5.bin.WIN64/docs/html/intro_guide.html')
-rw-r--r--contrib/glfw/glfw-3.3.5.bin.WIN64/docs/html/intro_guide.html329
1 files changed, 329 insertions, 0 deletions
diff --git a/contrib/glfw/glfw-3.3.5.bin.WIN64/docs/html/intro_guide.html b/contrib/glfw/glfw-3.3.5.bin.WIN64/docs/html/intro_guide.html
new file mode 100644
index 0000000..710a4b8
--- /dev/null
+++ b/contrib/glfw/glfw-3.3.5.bin.WIN64/docs/html/intro_guide.html
@@ -0,0 +1,329 @@
1<!DOCTYPE html>
2<html lang="en">
3<head>
4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5<meta name="viewport" content="width=device-width, initial-scale=1.0">
6<meta http-equiv="X-UA-Compatible" content="IE=9"/>
7<meta name="generator" content="Doxygen 1.9.2"/>
8<title>GLFW: Introduction to the API</title>
9<link href="tabs.css" rel="stylesheet" type="text/css"/>
10<script type="text/javascript" src="jquery.js"></script>
11<script type="text/javascript" src="dynsections.js"></script>
12<link href="search/search.css" rel="stylesheet" type="text/css"/>
13<script type="text/javascript" src="search/searchdata.js"></script>
14<script type="text/javascript" src="search/search.js"></script>
15<link href="doxygen.css" rel="stylesheet" type="text/css" />
16<link href="extra.css" rel="stylesheet" type="text/css"/>
17</head>
18<body>
19<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
20<div id="titlearea">
21 <div class="glfwheader">
22 <a href="https://www.glfw.org/" id="glfwhome">GLFW</a>
23 <ul class="glfwnavbar">
24 <li><a href="https://www.glfw.org/documentation.html">Documentation</a></li>
25 <li><a href="https://www.glfw.org/download.html">Download</a></li>
26 <li><a href="https://www.glfw.org/community.html">Community</a></li>
27 </ul>
28 </div>
29</div>
30<!-- end header part -->
31<!-- Generated by Doxygen 1.9.2 -->
32<script type="text/javascript">
33/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
34var searchBox = new SearchBox("searchBox", "search",'Search','.html');
35/* @license-end */
36</script>
37<script type="text/javascript" src="menudata.js"></script>
38<script type="text/javascript" src="menu.js"></script>
39<script type="text/javascript">
40/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
41$(function() {
42 initMenu('',true,false,'search.php','Search');
43 $(document).ready(function() { init_search(); });
44});
45/* @license-end */
46</script>
47<div id="main-nav"></div>
48<!-- window showing the filter options -->
49<div id="MSearchSelectWindow"
50 onmouseover="return searchBox.OnSearchSelectShow()"
51 onmouseout="return searchBox.OnSearchSelectHide()"
52 onkeydown="return searchBox.OnSearchSelectKey(event)">
53</div>
54
55<!-- iframe showing the search results (closed by default) -->
56<div id="MSearchResultsWindow">
57<iframe src="javascript:void(0)" frameborder="0"
58 name="MSearchResults" id="MSearchResults">
59</iframe>
60</div>
61
62</div><!-- top -->
63<div><div class="header">
64 <div class="headertitle"><div class="title">Introduction to the API </div></div>
65</div><!--header-->
66<div class="contents">
67<div class="toc"><h3>Table of Contents</h3>
68<ul><li class="level1"><a href="#intro_init">Initialization and termination</a><ul><li class="level2"><a href="#intro_init_init">Initializing GLFW</a></li>
69<li class="level2"><a href="#init_hints">Initialization hints</a><ul><li class="level3"><a href="#init_hints_shared">Shared init hints</a></li>
70<li class="level3"><a href="#init_hints_osx">macOS specific init hints</a></li>
71<li class="level3"><a href="#init_hints_values">Supported and default values</a></li>
72</ul>
73</li>
74<li class="level2"><a href="#intro_init_terminate">Terminating GLFW</a></li>
75</ul>
76</li>
77<li class="level1"><a href="#error_handling">Error handling</a></li>
78<li class="level1"><a href="#coordinate_systems">Coordinate systems</a></li>
79<li class="level1"><a href="#guarantees_limitations">Guarantees and limitations</a><ul><li class="level2"><a href="#lifetime">Pointer lifetimes</a></li>
80<li class="level2"><a href="#reentrancy">Reentrancy</a></li>
81<li class="level2"><a href="#thread_safety">Thread safety</a></li>
82<li class="level2"><a href="#compatibility">Version compatibility</a></li>
83<li class="level2"><a href="#event_order">Event order</a></li>
84</ul>
85</li>
86<li class="level1"><a href="#intro_version">Version management</a><ul><li class="level2"><a href="#intro_version_compile">Compile-time version</a></li>
87<li class="level2"><a href="#intro_version_runtime">Run-time version</a></li>
88<li class="level2"><a href="#intro_version_string">Version string</a></li>
89</ul>
90</li>
91</ul>
92</div>
93<div class="textblock"><p >This guide introduces the basic concepts of GLFW and describes initialization, error handling and API guarantees and limitations. For a broad but shallow tutorial, see <a class="el" href="quick_guide.html">Getting started</a> instead. For details on a specific function in this category, see the <a class="el" href="group__init.html">Initialization, version and error reference</a>.</p>
94<p >There are also guides for the other areas of GLFW.</p>
95<ul>
96<li><a class="el" href="window_guide.html">Window guide</a></li>
97<li><a class="el" href="context_guide.html">Context guide</a></li>
98<li><a class="el" href="vulkan_guide.html">Vulkan guide</a></li>
99<li><a class="el" href="monitor_guide.html">Monitor guide</a></li>
100<li><a class="el" href="input_guide.html">Input guide</a></li>
101</ul>
102<h1><a class="anchor" id="intro_init"></a>
103Initialization and termination</h1>
104<p >Before most GLFW functions may be called, the library must be initialized. This initialization checks what features are available on the machine, enumerates monitors and joysticks, initializes the timer and performs any required platform-specific initialization.</p>
105<p >Only the following functions may be called before the library has been successfully initialized, and only from the main thread.</p>
106<ul>
107<li><a class="el" href="group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197">glfwGetVersion</a></li>
108<li><a class="el" href="group__init.html#ga026abd003c8e6501981ab1662062f1c0">glfwGetVersionString</a></li>
109<li><a class="el" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a></li>
110<li><a class="el" href="group__init.html#gaff45816610d53f0b83656092a4034f40">glfwSetErrorCallback</a></li>
111<li><a class="el" href="group__init.html#ga110fd1d3f0412822b4f1908c026f724a">glfwInitHint</a></li>
112<li><a class="el" href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a></li>
113<li><a class="el" href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a></li>
114</ul>
115<p >Calling any other function before successful initialization will cause a <a class="el" href="group__errors.html#ga2374ee02c177f12e1fa76ff3ed15e14a">GLFW_NOT_INITIALIZED</a> error.</p>
116<h2><a class="anchor" id="intro_init_init"></a>
117Initializing GLFW</h2>
118<p >The library is initialized with <a class="el" href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a>, which returns <code>GLFW_FALSE</code> if an error occurred.</p>
119<div class="fragment"><div class="line"><span class="keywordflow">if</span> (!<a class="code hl_function" href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a>())</div>
120<div class="line">{</div>
121<div class="line"> <span class="comment">// Handle initialization failure</span></div>
122<div class="line">}</div>
123<div class="ttc" id="agroup__init_html_ga317aac130a235ab08c6db0834907d85e"><div class="ttname"><a href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a></div><div class="ttdeci">int glfwInit(void)</div><div class="ttdoc">Initializes the GLFW library.</div></div>
124</div><!-- fragment --><p >If any part of initialization fails, any parts that succeeded are terminated as if <a class="el" href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a> had been called. The library only needs to be initialized once and additional calls to an already initialized library will return <code>GLFW_TRUE</code> immediately.</p>
125<p >Once the library has been successfully initialized, it should be terminated before the application exits. Modern systems are very good at freeing resources allocated by programs that exit, but GLFW sometimes has to change global system settings and these might not be restored without termination.</p>
126<h2><a class="anchor" id="init_hints"></a>
127Initialization hints</h2>
128<p >Initialization hints are set before <a class="el" href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a> and affect how the library behaves until termination. Hints are set with <a class="el" href="group__init.html#ga110fd1d3f0412822b4f1908c026f724a">glfwInitHint</a>.</p>
129<div class="fragment"><div class="line"><a class="code hl_function" href="group__init.html#ga110fd1d3f0412822b4f1908c026f724a">glfwInitHint</a>(<a class="code hl_define" href="group__init.html#gab9c0534709fda03ec8959201da3a9a18">GLFW_JOYSTICK_HAT_BUTTONS</a>, <a class="code hl_define" href="group__init.html#gac877fe3b627d21ef3a0a23e0a73ba8c5">GLFW_FALSE</a>);</div>
130<div class="ttc" id="agroup__init_html_ga110fd1d3f0412822b4f1908c026f724a"><div class="ttname"><a href="group__init.html#ga110fd1d3f0412822b4f1908c026f724a">glfwInitHint</a></div><div class="ttdeci">void glfwInitHint(int hint, int value)</div><div class="ttdoc">Sets the specified init hint to the desired value.</div></div>
131<div class="ttc" id="agroup__init_html_gab9c0534709fda03ec8959201da3a9a18"><div class="ttname"><a href="group__init.html#gab9c0534709fda03ec8959201da3a9a18">GLFW_JOYSTICK_HAT_BUTTONS</a></div><div class="ttdeci">#define GLFW_JOYSTICK_HAT_BUTTONS</div><div class="ttdoc">Joystick hat buttons init hint.</div><div class="ttdef"><b>Definition:</b> glfw3.h:1116</div></div>
132<div class="ttc" id="agroup__init_html_gac877fe3b627d21ef3a0a23e0a73ba8c5"><div class="ttname"><a href="group__init.html#gac877fe3b627d21ef3a0a23e0a73ba8c5">GLFW_FALSE</a></div><div class="ttdeci">#define GLFW_FALSE</div><div class="ttdoc">Zero.</div><div class="ttdef"><b>Definition:</b> glfw3.h:322</div></div>
133</div><!-- fragment --><p >The values you set hints to are never reset by GLFW, but they only take effect during initialization. Once GLFW has been initialized, any values you set will be ignored until the library is terminated and initialized again.</p>
134<p >Some hints are platform specific. These may be set on any platform but they will only affect their specific platform. Other platforms will ignore them. Setting these hints requires no platform specific headers or functions.</p>
135<h3><a class="anchor" id="init_hints_shared"></a>
136Shared init hints</h3>
137<p ><a class="anchor" id="GLFW_JOYSTICK_HAT_BUTTONS"></a><b>GLFW_JOYSTICK_HAT_BUTTONS</b> specifies whether to also expose joystick hats as buttons, for compatibility with earlier versions of GLFW that did not have <a class="el" href="group__input.html#ga06e660841b3e79c54da4f54a932c5a2c">glfwGetJoystickHats</a>. Possible values are <code>GLFW_TRUE</code> and <code>GLFW_FALSE</code>.</p>
138<h3><a class="anchor" id="init_hints_osx"></a>
139macOS specific init hints</h3>
140<p ><a class="anchor" id="GLFW_COCOA_CHDIR_RESOURCES_hint"></a><b>GLFW_COCOA_CHDIR_RESOURCES</b> specifies whether to set the current directory to the application to the <code>Contents/Resources</code> subdirectory of the application's bundle, if present. Set this with <a class="el" href="group__init.html#ga110fd1d3f0412822b4f1908c026f724a">glfwInitHint</a>.</p>
141<p ><a class="anchor" id="GLFW_COCOA_MENUBAR_hint"></a><b>GLFW_COCOA_MENUBAR</b> specifies whether to create a basic menu bar, either from a nib or manually, when the first window is created, which is when AppKit is initialized. Set this with <a class="el" href="group__init.html#ga110fd1d3f0412822b4f1908c026f724a">glfwInitHint</a>.</p>
142<h3><a class="anchor" id="init_hints_values"></a>
143Supported and default values</h3>
144<table class="markdownTable">
145<tr class="markdownTableHead">
146<th class="markdownTableHeadNone">Initialization hint </th><th class="markdownTableHeadNone">Default value </th><th class="markdownTableHeadNone">Supported values </th></tr>
147<tr class="markdownTableRowOdd">
148<td class="markdownTableBodyNone"><a class="el" href="intro_guide.html#GLFW_JOYSTICK_HAT_BUTTONS">GLFW_JOYSTICK_HAT_BUTTONS</a> </td><td class="markdownTableBodyNone"><code>GLFW_TRUE</code> </td><td class="markdownTableBodyNone"><code>GLFW_TRUE</code> or <code>GLFW_FALSE</code> </td></tr>
149<tr class="markdownTableRowEven">
150<td class="markdownTableBodyNone"><a class="el" href="group__init.html#gab937983147a3158d45f88fad7129d9f2">GLFW_COCOA_CHDIR_RESOURCES</a> </td><td class="markdownTableBodyNone"><code>GLFW_TRUE</code> </td><td class="markdownTableBodyNone"><code>GLFW_TRUE</code> or <code>GLFW_FALSE</code> </td></tr>
151<tr class="markdownTableRowOdd">
152<td class="markdownTableBodyNone"><a class="el" href="group__init.html#ga71e0b4ce2f2696a84a9b8c5e12dc70cf">GLFW_COCOA_MENUBAR</a> </td><td class="markdownTableBodyNone"><code>GLFW_TRUE</code> </td><td class="markdownTableBodyNone"><code>GLFW_TRUE</code> or <code>GLFW_FALSE</code> </td></tr>
153</table>
154<h2><a class="anchor" id="intro_init_terminate"></a>
155Terminating GLFW</h2>
156<p >Before your application exits, you should terminate the GLFW library if it has been initialized. This is done with <a class="el" href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a>.</p>
157<div class="fragment"><div class="line"><a class="code hl_function" href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a>();</div>
158<div class="ttc" id="agroup__init_html_gaaae48c0a18607ea4a4ba951d939f0901"><div class="ttname"><a href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a></div><div class="ttdeci">void glfwTerminate(void)</div><div class="ttdoc">Terminates the GLFW library.</div></div>
159</div><!-- fragment --><p >This will destroy any remaining window, monitor and cursor objects, restore any modified gamma ramps, re-enable the screensaver if it had been disabled and free any other resources allocated by GLFW.</p>
160<p >Once the library is terminated, it is as if it had never been initialized and you will need to initialize it again before being able to use GLFW. If the library was not initialized or had already been terminated, it return immediately.</p>
161<h1><a class="anchor" id="error_handling"></a>
162Error handling</h1>
163<p >Some GLFW functions have return values that indicate an error, but this is often not very helpful when trying to figure out what happened or why it occurred. Other functions have no return value reserved for errors, so error notification needs a separate channel. Finally, far from all GLFW functions have return values.</p>
164<p >The last <a class="el" href="group__errors.html">error code</a> for the calling thread can be queried at any time with <a class="el" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a>.</p>
165<div class="fragment"><div class="line"><span class="keywordtype">int</span> code = <a class="code hl_function" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a>(NULL);</div>
166<div class="line"> </div>
167<div class="line"><span class="keywordflow">if</span> (code != <a class="code hl_define" href="group__errors.html#gafa30deee5db4d69c4c93d116ed87dbf4">GLFW_NO_ERROR</a>)</div>
168<div class="line"> handle_error(code);</div>
169<div class="ttc" id="agroup__errors_html_gafa30deee5db4d69c4c93d116ed87dbf4"><div class="ttname"><a href="group__errors.html#gafa30deee5db4d69c4c93d116ed87dbf4">GLFW_NO_ERROR</a></div><div class="ttdeci">#define GLFW_NO_ERROR</div><div class="ttdoc">No error has occurred.</div><div class="ttdef"><b>Definition:</b> glfw3.h:671</div></div>
170<div class="ttc" id="agroup__init_html_ga944986b4ec0b928d488141f92982aa18"><div class="ttname"><a href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a></div><div class="ttdeci">int glfwGetError(const char **description)</div><div class="ttdoc">Returns and clears the last error for the calling thread.</div></div>
171</div><!-- fragment --><p >If no error has occurred since the last call, <a class="el" href="group__errors.html#gafa30deee5db4d69c4c93d116ed87dbf4">GLFW_NO_ERROR</a> (zero) is returned. The error is cleared before the function returns.</p>
172<p >The error code indicates the general category of the error. Some error codes, such as <a class="el" href="group__errors.html#ga2374ee02c177f12e1fa76ff3ed15e14a">GLFW_NOT_INITIALIZED</a> has only a single meaning, whereas others like <a class="el" href="group__errors.html#gad44162d78100ea5e87cdd38426b8c7a1">GLFW_PLATFORM_ERROR</a> are used for many different errors.</p>
173<p >GLFW often has more information about an error than its general category. You can retrieve a UTF-8 encoded human-readable description along with the error code. If no error has occurred since the last call, the description is set to <code>NULL</code>.</p>
174<div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* description;</div>
175<div class="line"><span class="keywordtype">int</span> code = <a class="code hl_function" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a>(&amp;description);</div>
176<div class="line"> </div>
177<div class="line"><span class="keywordflow">if</span> (description)</div>
178<div class="line"> display_error_message(code, description);</div>
179</div><!-- fragment --><p >The retrieved description string is only valid until the next error occurs. This means you must make a copy of it if you want to keep it.</p>
180<p >You can also set an error callback, which will be called each time an error occurs. It is set with <a class="el" href="group__init.html#gaff45816610d53f0b83656092a4034f40">glfwSetErrorCallback</a>.</p>
181<div class="fragment"><div class="line"><a class="code hl_function" href="group__init.html#gaff45816610d53f0b83656092a4034f40">glfwSetErrorCallback</a>(error_callback);</div>
182<div class="ttc" id="agroup__init_html_gaff45816610d53f0b83656092a4034f40"><div class="ttname"><a href="group__init.html#gaff45816610d53f0b83656092a4034f40">glfwSetErrorCallback</a></div><div class="ttdeci">GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback)</div><div class="ttdoc">Sets the error callback.</div></div>
183</div><!-- fragment --><p >The error callback receives the same error code and human-readable description returned by <a class="el" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a>.</p>
184<div class="fragment"><div class="line"><span class="keywordtype">void</span> error_callback(<span class="keywordtype">int</span> code, <span class="keyword">const</span> <span class="keywordtype">char</span>* description)</div>
185<div class="line">{</div>
186<div class="line"> display_error_message(code, description);</div>
187<div class="line">}</div>
188</div><!-- fragment --><p >The error callback is called after the error is stored, so calling <a class="el" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a> from within the error callback returns the same values as the callback argument.</p>
189<p >The description string passed to the callback is only valid until the error callback returns. This means you must make a copy of it if you want to keep it.</p>
190<p ><b>Reported errors are never fatal.</b> As long as GLFW was successfully initialized, it will remain initialized and in a safe state until terminated regardless of how many errors occur. If an error occurs during initialization that causes <a class="el" href="group__init.html#ga317aac130a235ab08c6db0834907d85e">glfwInit</a> to fail, any part of the library that was initialized will be safely terminated.</p>
191<p >Do not rely on a currently invalid call to generate a specific error, as in the future that same call may generate a different error or become valid.</p>
192<h1><a class="anchor" id="coordinate_systems"></a>
193Coordinate systems</h1>
194<p >GLFW has two primary coordinate systems: the <em>virtual screen</em> and the window <em>content area</em> or <em>content area</em>. Both use the same unit: <em>virtual screen coordinates</em>, or just <em>screen coordinates</em>, which don't necessarily correspond to pixels.</p>
195<p ><img src="spaces.svg" alt="" style="pointer-events: none;" width="90%" class="inline"/></p>
196<p >Both the virtual screen and the content area coordinate systems have the X-axis pointing to the right and the Y-axis pointing down.</p>
197<p >Window and monitor positions are specified as the position of the upper-left corners of their content areas relative to the virtual screen, while cursor positions are specified relative to a window's content area.</p>
198<p >Because the origin of the window's content area coordinate system is also the point from which the window position is specified, you can translate content area coordinates to the virtual screen by adding the window position. The window frame, when present, extends out from the content area but does not affect the window position.</p>
199<p >Almost all positions and sizes in GLFW are measured in screen coordinates relative to one of the two origins above. This includes cursor positions, window positions and sizes, window frame sizes, monitor positions and video mode resolutions.</p>
200<p >Two exceptions are the <a class="el" href="monitor_guide.html#monitor_size">monitor physical size</a>, which is measured in millimetres, and <a class="el" href="window_guide.html#window_fbsize">framebuffer size</a>, which is measured in pixels.</p>
201<p >Pixels and screen coordinates may map 1:1 on your machine, but they won't on every other machine, for example on a Mac with a Retina display. The ratio between screen coordinates and pixels may also change at run-time depending on which monitor the window is currently considered to be on.</p>
202<h1><a class="anchor" id="guarantees_limitations"></a>
203Guarantees and limitations</h1>
204<p >This section describes the conditions under which GLFW can be expected to function, barring bugs in the operating system or drivers. Use of GLFW outside of these limits may work on some platforms, or on some machines, or some of the time, or on some versions of GLFW, but it may break at any time and this will not be considered a bug.</p>
205<h2><a class="anchor" id="lifetime"></a>
206Pointer lifetimes</h2>
207<p >GLFW will never free any pointer you provide to it and you must never free any pointer it provides to you.</p>
208<p >Many GLFW functions return pointers to dynamically allocated structures, strings or arrays, and some callbacks are provided with strings or arrays. These are always managed by GLFW and should never be freed by the application. The lifetime of these pointers is documented for each GLFW function and callback. If you need to keep this data, you must copy it before its lifetime expires.</p>
209<p >Many GLFW functions accept pointers to structures or strings allocated by the application. These are never freed by GLFW and are always the responsibility of the application. If GLFW needs to keep the data in these structures or strings, it is copied before the function returns.</p>
210<p >Pointer lifetimes are guaranteed not to be shortened in future minor or patch releases.</p>
211<h2><a class="anchor" id="reentrancy"></a>
212Reentrancy</h2>
213<p >GLFW event processing and object destruction are not reentrant. This means that the following functions must not be called from any callback function:</p>
214<ul>
215<li><a class="el" href="group__window.html#gacdf43e51376051d2c091662e9fe3d7b2">glfwDestroyWindow</a></li>
216<li><a class="el" href="group__input.html#ga81b952cd1764274d0db7fb3c5a79ba6a">glfwDestroyCursor</a></li>
217<li><a class="el" href="group__window.html#ga37bd57223967b4211d60ca1a0bf3c832">glfwPollEvents</a></li>
218<li><a class="el" href="group__window.html#ga554e37d781f0a997656c26b2c56c835e">glfwWaitEvents</a></li>
219<li><a class="el" href="group__window.html#ga605a178db92f1a7f1a925563ef3ea2cf">glfwWaitEventsTimeout</a></li>
220<li><a class="el" href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a></li>
221</ul>
222<p >These functions may be made reentrant in future minor or patch releases, but functions not on this list will not be made non-reentrant.</p>
223<h2><a class="anchor" id="thread_safety"></a>
224Thread safety</h2>
225<p >Most GLFW functions must only be called from the main thread (the thread that calls main), but some may be called from any thread once the library has been initialized. Before initialization the whole library is thread-unsafe.</p>
226<p >The reference documentation for every GLFW function states whether it is limited to the main thread.</p>
227<p >Initialization, termination, event processing and the creation and destruction of windows, cursors and OpenGL and OpenGL ES contexts are all restricted to the main thread due to limitations of one or several platforms.</p>
228<p >Because event processing must be performed on the main thread, all callbacks except for the error callback will only be called on that thread. The error callback may be called on any thread, as any GLFW function may generate errors.</p>
229<p >The error code and description may be queried from any thread.</p>
230<ul>
231<li><a class="el" href="group__init.html#ga944986b4ec0b928d488141f92982aa18">glfwGetError</a></li>
232</ul>
233<p >Empty events may be posted from any thread.</p>
234<ul>
235<li><a class="el" href="group__window.html#gab5997a25187e9fd5c6f2ecbbc8dfd7e9">glfwPostEmptyEvent</a></li>
236</ul>
237<p >The window user pointer and close flag may be read and written from any thread, but this is not synchronized by GLFW.</p>
238<ul>
239<li><a class="el" href="group__window.html#gae77a4add0d2023ca21ff1443ced01653">glfwGetWindowUserPointer</a></li>
240<li><a class="el" href="group__window.html#ga3d2fc6026e690ab31a13f78bc9fd3651">glfwSetWindowUserPointer</a></li>
241<li><a class="el" href="group__window.html#ga24e02fbfefbb81fc45320989f8140ab5">glfwWindowShouldClose</a></li>
242<li><a class="el" href="group__window.html#ga49c449dde2a6f87d996f4daaa09d6708">glfwSetWindowShouldClose</a></li>
243</ul>
244<p >These functions for working with OpenGL and OpenGL ES contexts may be called from any thread, but the window object is not synchronized by GLFW.</p>
245<ul>
246<li><a class="el" href="group__context.html#ga1c04dc242268f827290fe40aa1c91157">glfwMakeContextCurrent</a></li>
247<li><a class="el" href="group__context.html#gad94e80185397a6cf5fe2ab30567af71c">glfwGetCurrentContext</a></li>
248<li><a class="el" href="group__window.html#ga15a5a1ee5b3c2ca6b15ca209a12efd14">glfwSwapBuffers</a></li>
249<li><a class="el" href="group__context.html#ga6d4e0cdf151b5e579bd67f13202994ed">glfwSwapInterval</a></li>
250<li><a class="el" href="group__context.html#ga87425065c011cef1ebd6aac75e059dfa">glfwExtensionSupported</a></li>
251<li><a class="el" href="group__context.html#ga35f1837e6f666781842483937612f163">glfwGetProcAddress</a></li>
252</ul>
253<p >The raw timer functions may be called from any thread.</p>
254<ul>
255<li><a class="el" href="group__input.html#ga3289ee876572f6e91f06df3a24824443">glfwGetTimerFrequency</a></li>
256<li><a class="el" href="group__input.html#ga09b2bd37d328e0b9456c7ec575cc26aa">glfwGetTimerValue</a></li>
257</ul>
258<p >The regular timer may be used from any thread, but reading and writing the timer offset is not synchronized by GLFW.</p>
259<ul>
260<li><a class="el" href="group__input.html#gaa6cf4e7a77158a3b8fd00328b1720a4a">glfwGetTime</a></li>
261<li><a class="el" href="group__input.html#gaf59589ef6e8b8c8b5ad184b25afd4dc0">glfwSetTime</a></li>
262</ul>
263<p >Library version information may be queried from any thread.</p>
264<ul>
265<li><a class="el" href="group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197">glfwGetVersion</a></li>
266<li><a class="el" href="group__init.html#ga026abd003c8e6501981ab1662062f1c0">glfwGetVersionString</a></li>
267</ul>
268<p >All Vulkan related functions may be called from any thread.</p>
269<ul>
270<li><a class="el" href="group__vulkan.html#ga2e7f30931e02464b5bc8d0d4b6f9fe2b">glfwVulkanSupported</a></li>
271<li><a class="el" href="group__vulkan.html#ga99ad342d82f4a3421e2864978cb6d1d6">glfwGetRequiredInstanceExtensions</a></li>
272<li><a class="el" href="group__vulkan.html#gadf228fac94c5fd8f12423ec9af9ff1e9">glfwGetInstanceProcAddress</a></li>
273<li><a class="el" href="group__vulkan.html#gaff3823355cdd7e2f3f9f4d9ea9518d92">glfwGetPhysicalDevicePresentationSupport</a></li>
274<li><a class="el" href="group__vulkan.html#ga1a24536bec3f80b08ead18e28e6ae965">glfwCreateWindowSurface</a></li>
275</ul>
276<p >GLFW uses synchronization objects internally only to manage the per-thread context and error states. Additional synchronization is left to the application.</p>
277<p >Functions that may currently be called from any thread will always remain so, but functions that are currently limited to the main thread may be updated to allow calls from any thread in future releases.</p>
278<h2><a class="anchor" id="compatibility"></a>
279Version compatibility</h2>
280<p >GLFW uses <a href="https://semver.org/">Semantic Versioning</a>. This guarantees source and binary backward compatibility with earlier minor versions of the API. This means that you can drop in a newer version of the library and existing programs will continue to compile and existing binaries will continue to run.</p>
281<p >Once a function or constant has been added, the signature of that function or value of that constant will remain unchanged until the next major version of GLFW. No compatibility of any kind is guaranteed between major versions.</p>
282<p >Undocumented behavior, i.e. behavior that is not described in the documentation, may change at any time until it is documented.</p>
283<p >If the reference documentation and the implementation differ, the reference documentation will almost always take precedence and the implementation will be fixed in the next release. The reference documentation will also take precedence over anything stated in a guide.</p>
284<h2><a class="anchor" id="event_order"></a>
285Event order</h2>
286<p >The order of arrival of related events is not guaranteed to be consistent across platforms. The exception is synthetic key and mouse button release events, which are always delivered after the window defocus event.</p>
287<h1><a class="anchor" id="intro_version"></a>
288Version management</h1>
289<p >GLFW provides mechanisms for identifying what version of GLFW your application was compiled against as well as what version it is currently running against. If you are loading GLFW dynamically (not just linking dynamically), you can use this to verify that the library binary is compatible with your application.</p>
290<h2><a class="anchor" id="intro_version_compile"></a>
291Compile-time version</h2>
292<p >The compile-time version of GLFW is provided by the GLFW header with the <code>GLFW_VERSION_MAJOR</code>, <code>GLFW_VERSION_MINOR</code> and <code>GLFW_VERSION_REVISION</code> macros.</p>
293<div class="fragment"><div class="line">printf(<span class="stringliteral">&quot;Compiled against GLFW %i.%i.%i\n&quot;</span>,</div>
294<div class="line"> <a class="code hl_define" href="group__init.html#ga6337d9ea43b22fc529b2bba066b4a576">GLFW_VERSION_MAJOR</a>,</div>
295<div class="line"> <a class="code hl_define" href="group__init.html#gaf80d40f0aea7088ff337606e9c48f7a3">GLFW_VERSION_MINOR</a>,</div>
296<div class="line"> <a class="code hl_define" href="group__init.html#gab72ae2e2035d9ea461abc3495eac0502">GLFW_VERSION_REVISION</a>);</div>
297<div class="ttc" id="agroup__init_html_ga6337d9ea43b22fc529b2bba066b4a576"><div class="ttname"><a href="group__init.html#ga6337d9ea43b22fc529b2bba066b4a576">GLFW_VERSION_MAJOR</a></div><div class="ttdeci">#define GLFW_VERSION_MAJOR</div><div class="ttdoc">The major version number of the GLFW header.</div><div class="ttdef"><b>Definition:</b> glfw3.h:288</div></div>
298<div class="ttc" id="agroup__init_html_gab72ae2e2035d9ea461abc3495eac0502"><div class="ttname"><a href="group__init.html#gab72ae2e2035d9ea461abc3495eac0502">GLFW_VERSION_REVISION</a></div><div class="ttdeci">#define GLFW_VERSION_REVISION</div><div class="ttdoc">The revision number of the GLFW header.</div><div class="ttdef"><b>Definition:</b> glfw3.h:302</div></div>
299<div class="ttc" id="agroup__init_html_gaf80d40f0aea7088ff337606e9c48f7a3"><div class="ttname"><a href="group__init.html#gaf80d40f0aea7088ff337606e9c48f7a3">GLFW_VERSION_MINOR</a></div><div class="ttdeci">#define GLFW_VERSION_MINOR</div><div class="ttdoc">The minor version number of the GLFW header.</div><div class="ttdef"><b>Definition:</b> glfw3.h:295</div></div>
300</div><!-- fragment --><h2><a class="anchor" id="intro_version_runtime"></a>
301Run-time version</h2>
302<p >The run-time version can be retrieved with <a class="el" href="group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197">glfwGetVersion</a>, a function that may be called regardless of whether GLFW is initialized.</p>
303<div class="fragment"><div class="line"><span class="keywordtype">int</span> major, minor, revision;</div>
304<div class="line"><a class="code hl_function" href="group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197">glfwGetVersion</a>(&amp;major, &amp;minor, &amp;revision);</div>
305<div class="line"> </div>
306<div class="line">printf(<span class="stringliteral">&quot;Running against GLFW %i.%i.%i\n&quot;</span>, major, minor, revision);</div>
307<div class="ttc" id="agroup__init_html_ga9f8ffaacf3c269cc48eafbf8b9b71197"><div class="ttname"><a href="group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197">glfwGetVersion</a></div><div class="ttdeci">void glfwGetVersion(int *major, int *minor, int *rev)</div><div class="ttdoc">Retrieves the version of the GLFW library.</div></div>
308</div><!-- fragment --><h2><a class="anchor" id="intro_version_string"></a>
309Version string</h2>
310<p >GLFW 3 also provides a compile-time generated version string that describes the version, platform, compiler and any platform-specific compile-time options. This is primarily intended for submitting bug reports, to allow developers to see which code paths are enabled in a binary.</p>
311<p >The version string is returned by <a class="el" href="group__init.html#ga026abd003c8e6501981ab1662062f1c0">glfwGetVersionString</a>, a function that may be called regardless of whether GLFW is initialized.</p>
312<p ><b>Do not use the version string</b> to parse the GLFW library version. The <a class="el" href="group__init.html#ga9f8ffaacf3c269cc48eafbf8b9b71197">glfwGetVersion</a> function already provides the version of the running library binary.</p>
313<p >The format of the string is as follows:</p><ul>
314<li>The version of GLFW</li>
315<li>The name of the window system API</li>
316<li>The name of the context creation API</li>
317<li>Any additional options or APIs</li>
318</ul>
319<p >For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL back ends, the version string may look something like this:</p>
320<div class="fragment"><div class="line">3.0.0 Win32 WGL MinGW</div>
321</div><!-- fragment --> </div></div><!-- contents -->
322</div><!-- PageDoc -->
323<address class="footer">
324<p>
325Last update on Thu Oct 28 2021 for GLFW 3.3.5
326</p>
327</address>
328</body>
329</html>