mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 14:49:19 +02:00
maintenance: glew update to v 2.1.0, glfw update to v3.3
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.11"/>
|
||||
<meta name="generator" content="Doxygen 1.8.15"/>
|
||||
<title>GLFW: Context guide</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
@@ -11,9 +11,6 @@
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() { init_search(); });
|
||||
</script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="extra.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
@@ -21,45 +18,31 @@
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<div class="glfwheader">
|
||||
<a href="http://www.glfw.org/" id="glfwhome">GLFW</a>
|
||||
<a href="https://www.glfw.org/" id="glfwhome">GLFW</a>
|
||||
<ul class="glfwnavbar">
|
||||
<li><a href="http://www.glfw.org/documentation.html">Documentation</a></li>
|
||||
<li><a href="http://www.glfw.org/download.html">Download</a></li>
|
||||
<li><a href="http://www.glfw.org/media.html">Media</a></li>
|
||||
<li><a href="http://www.glfw.org/community.html">Community</a></li>
|
||||
<li><a href="https://www.glfw.org/documentation.html">Documentation</a></li>
|
||||
<li><a href="https://www.glfw.org/download.html">Download</a></li>
|
||||
<li><a href="https://www.glfw.org/community.html">Community</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.11 -->
|
||||
<!-- Generated by Doxygen 1.8.15 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="navrow1" class="tabs">
|
||||
<ul class="tablist">
|
||||
<li><a href="index.html"><span>Main Page</span></a></li>
|
||||
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
|
||||
<li><a href="modules.html"><span>Modules</span></a></li>
|
||||
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
||||
<li><a href="files.html"><span>Files</span></a></li>
|
||||
<li>
|
||||
<div id="MSearchBox" class="MSearchBoxInactive">
|
||||
<span class="left">
|
||||
<img id="MSearchSelect" src="search/mag_sel.png"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
alt=""/>
|
||||
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
||||
onfocus="searchBox.OnSearchFieldFocus(true)"
|
||||
onblur="searchBox.OnSearchFieldFocus(false)"
|
||||
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
||||
</span><span class="right">
|
||||
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
@@ -75,7 +58,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
</div>
|
||||
|
||||
</div><!-- top -->
|
||||
<div class="header">
|
||||
<div class="PageDoc"><div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Context guide </div> </div>
|
||||
</div><!--header-->
|
||||
@@ -112,7 +95,7 @@ Context objects</h1>
|
||||
<p>A window object encapsulates both a top-level window and an OpenGL or OpenGL ES context. It is created with <a class="el" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a> and destroyed with <a class="el" href="group__window.html#gacdf43e51376051d2c091662e9fe3d7b2">glfwDestroyWindow</a> or <a class="el" href="group__init.html#gaaae48c0a18607ea4a4ba951d939f0901">glfwTerminate</a>. See <a class="el" href="window_guide.html#window_creation">Window creation</a> for more information.</p>
|
||||
<p>As the window and context are inseparably linked, the window object also serves as the context handle.</p>
|
||||
<p>To test the creation of various kinds of contexts and see their properties, run the <code>glfwinfo</code> test program.</p>
|
||||
<dl class="section note"><dt>Note</dt><dd>Vulkan does not have a context and the Vulkan instance is created via the Vulkan API itself. If you will be using Vulkan to render to a window, disable context creation by setting the <a class="el" href="window_guide.html#window_hints_ctx">GLFW_CLIENT_API</a> hint to <code>GLFW_NO_API</code>. For more information, see the <a class="el" href="vulkan_guide.html">Vulkan guide</a>.</dd></dl>
|
||||
<dl class="section note"><dt>Note</dt><dd>Vulkan does not have a context and the Vulkan instance is created via the Vulkan API itself. If you will be using Vulkan to render to a window, disable context creation by setting the <a class="el" href="window_guide.html#GLFW_CLIENT_API_hint">GLFW_CLIENT_API</a> hint to <code>GLFW_NO_API</code>. For more information, see the <a class="el" href="vulkan_guide.html">Vulkan guide</a>.</dd></dl>
|
||||
<h2><a class="anchor" id="context_hints"></a>
|
||||
Context creation hints</h2>
|
||||
<p>There are a number of hints, specified using <a class="el" href="group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033">glfwWindowHint</a>, related to what kind of context is created. See <a class="el" href="window_guide.html#window_hints_ctx">context related hints</a> in the window guide.</p>
|
||||
@@ -120,20 +103,21 @@ Context creation hints</h2>
|
||||
Context object sharing</h2>
|
||||
<p>When creating a window and its OpenGL or OpenGL ES context with <a class="el" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>, you can specify another window whose context the new one should share its objects (textures, vertex and element buffers, etc.) with.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__window.html#ga3c96d80d363e67d13a41b5d1821f3242">GLFWwindow</a>* second_window = <a class="code" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>(640, 480, <span class="stringliteral">"Second Window"</span>, NULL, first_window);</div></div><!-- fragment --><p>Object sharing is implemented by the operating system and graphics driver. On platforms where it is possible to choose which types of objects are shared, GLFW requests that all types are shared.</p>
|
||||
<p>See the relevant chapter of the <a href="https://www.opengl.org/registry/">OpenGL</a> or <a href="http://www.khronos.org/opengles/">OpenGL ES</a> reference documents for more information. The name and number of this chapter unfortunately varies between versions and APIs, but has at times been named <em>Shared Objects and Multiple Contexts</em>.</p>
|
||||
<p>GLFW comes with a simple object sharing test program called <code>sharing</code>.</p>
|
||||
<p>See the relevant chapter of the <a href="https://www.opengl.org/registry/">OpenGL</a> or <a href="https://www.khronos.org/opengles/">OpenGL ES</a> reference documents for more information. The name and number of this chapter unfortunately varies between versions and APIs, but has at times been named <em>Shared Objects and Multiple Contexts</em>.</p>
|
||||
<p>GLFW comes with a barebones object sharing example program called <code>sharing</code>.</p>
|
||||
<h2><a class="anchor" id="context_offscreen"></a>
|
||||
Offscreen contexts</h2>
|
||||
<p>GLFW doesn't support creating contexts without an associated window. However, contexts with hidden windows can be created with the <a class="el" href="window_guide.html#window_hints_wnd">GLFW_VISIBLE</a> window hint.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033">glfwWindowHint</a>(<a class="code" href="glfw3_8h.html#afb3cdc45297e06d8f1eb13adc69ca6c4">GLFW_VISIBLE</a>, <a class="code" href="glfw3_8h.html#ac877fe3b627d21ef3a0a23e0a73ba8c5">GLFW_FALSE</a>);</div><div class="line"></div><div class="line"><a class="code" href="group__window.html#ga3c96d80d363e67d13a41b5d1821f3242">GLFWwindow</a>* offscreen_context = <a class="code" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>(640, 480, <span class="stringliteral">""</span>, NULL, NULL);</div></div><!-- fragment --><p>The window never needs to be shown and its context can be used as a plain offscreen context. Depending on the window manager, the size of a hidden window's framebuffer may not be usable or modifiable, so framebuffer objects are recommended for rendering with such contexts.</p>
|
||||
<p>GLFW doesn't support creating contexts without an associated window. However, contexts with hidden windows can be created with the <a class="el" href="window_guide.html#GLFW_VISIBLE_hint">GLFW_VISIBLE</a> window hint.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__window.html#ga7d9c8c62384b1e2821c4dc48952d2033">glfwWindowHint</a>(<a class="code" href="group__window.html#gafb3cdc45297e06d8f1eb13adc69ca6c4">GLFW_VISIBLE</a>, <a class="code" href="group__init.html#gac877fe3b627d21ef3a0a23e0a73ba8c5">GLFW_FALSE</a>);</div><div class="line"></div><div class="line"><a class="code" href="group__window.html#ga3c96d80d363e67d13a41b5d1821f3242">GLFWwindow</a>* offscreen_context = <a class="code" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>(640, 480, <span class="stringliteral">""</span>, NULL, NULL);</div></div><!-- fragment --><p>The window never needs to be shown and its context can be used as a plain offscreen context. Depending on the window manager, the size of a hidden window's framebuffer may not be usable or modifiable, so framebuffer objects are recommended for rendering with such contexts.</p>
|
||||
<p>You should still <a class="el" href="input_guide.html#events">process events</a> as long as you have at least one window, even if none of them are visible.</p>
|
||||
<p><b>OS X:</b> The first time a window is created the menu bar is populated with common commands like Hide, Quit and About. This is not desirable for example when writing a command-line only application. The menu bar setup can be disabled with a <a class="el" href="compile_guide.html#compile_options_osx">compile-time option</a>.</p>
|
||||
<p><b>macOS:</b> The first time a window is created the menu bar is created. This is not desirable for example when writing a command-line only application. Menu bar creation can be disabled with the <a class="el" href="group__init.html#ga71e0b4ce2f2696a84a9b8c5e12dc70cf">GLFW_COCOA_MENUBAR</a> init hint.</p>
|
||||
<h2><a class="anchor" id="context_less"></a>
|
||||
Windows without contexts</h2>
|
||||
<p>You can disable context creation by setting the <a class="el" href="window_guide.html#window_hints_ctx">GLFW_CLIENT_API</a> hint to <code>GLFW_NO_API</code>. Windows without contexts must not be passed to <a class="el" href="group__context.html#ga1c04dc242268f827290fe40aa1c91157">glfwMakeContextCurrent</a> or <a class="el" href="group__window.html#ga15a5a1ee5b3c2ca6b15ca209a12efd14">glfwSwapBuffers</a>.</p>
|
||||
<p>You can disable context creation by setting the <a class="el" href="window_guide.html#GLFW_CLIENT_API_hint">GLFW_CLIENT_API</a> hint to <code>GLFW_NO_API</code>. Windows without contexts must not be passed to <a class="el" href="group__context.html#ga1c04dc242268f827290fe40aa1c91157">glfwMakeContextCurrent</a> or <a class="el" href="group__window.html#ga15a5a1ee5b3c2ca6b15ca209a12efd14">glfwSwapBuffers</a>.</p>
|
||||
<h1><a class="anchor" id="context_current"></a>
|
||||
Current context</h1>
|
||||
<p>Before you can make OpenGL or OpenGL ES calls, you need to have a current context of the correct type. A context can only be current for a single thread at a time, and a thread can only have a single context current at a time.</p>
|
||||
<p>When moving a context between threads, you must make it non-current on the old thread before making it current on the new one.</p>
|
||||
<p>The context of a window is made current with <a class="el" href="group__context.html#ga1c04dc242268f827290fe40aa1c91157">glfwMakeContextCurrent</a>.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__context.html#ga1c04dc242268f827290fe40aa1c91157">glfwMakeContextCurrent</a>(window);</div></div><!-- fragment --><p>The window of the current context is returned by <a class="el" href="group__context.html#gac84759b1f6c2d271a4fea8ae89ec980d">glfwGetCurrentContext</a>.</p>
|
||||
<div class="fragment"><div class="line"><a class="code" href="group__window.html#ga3c96d80d363e67d13a41b5d1821f3242">GLFWwindow</a>* window = <a class="code" href="group__context.html#gac84759b1f6c2d271a4fea8ae89ec980d">glfwGetCurrentContext</a>();</div></div><!-- fragment --><p>The following GLFW functions require a context to be current. Calling any these functions without a current context will generate a <a class="el" href="group__errors.html#gaa8290386e9528ccb9e42a3a4e16fc0d0">GLFW_NO_CURRENT_CONTEXT</a> error.</p>
|
||||
@@ -144,7 +128,7 @@ Current context</h1>
|
||||
</ul>
|
||||
<h1><a class="anchor" id="context_swap"></a>
|
||||
Buffer swapping</h1>
|
||||
<p>Buffer swapping is part of the window and framebuffer, not the context. See <a class="el" href="window_guide.html#buffer_swap">Buffer swapping</a>.</p>
|
||||
<p>See <a class="el" href="window_guide.html#buffer_swap">Buffer swapping</a> in the window guide.</p>
|
||||
<h1><a class="anchor" id="context_glext"></a>
|
||||
OpenGL and OpenGL ES extensions</h1>
|
||||
<p>One of the benefits of OpenGL and OpenGL ES is their extensibility. Hardware vendors may include extensions in their implementations that extend the API before that functionality is included in a new version of the OpenGL or OpenGL ES specification, and some extensions are never included and remain as extensions until they become obsolete.</p>
|
||||
@@ -154,13 +138,13 @@ OpenGL and OpenGL ES extensions</h1>
|
||||
<li>New OpenGL tokens (e.g. <code>GL_DEBUG_SEVERITY_HIGH_ARB</code>)</li>
|
||||
<li>New OpenGL functions (e.g. <code>glGetDebugMessageLogARB</code>)</li>
|
||||
</ul>
|
||||
<p>Note the <code>ARB</code> affix, which stands for Architecture Review Board and is used for official extensions. The extension above was created by the ARB, but there are many different affixes, like <code>NV</code> for Nvidia and <code>AMD</code> for, well, AMD. Any group may also use the generic <code>EXT</code> affix. Lists of extensions, together with their specifications, can be found at the <a href="http://www.opengl.org/registry/">OpenGL Registry</a> and <a href="https://www.khronos.org/registry/gles/">OpenGL ES Registry</a>.</p>
|
||||
<p>Note the <code>ARB</code> affix, which stands for Architecture Review Board and is used for official extensions. The extension above was created by the ARB, but there are many different affixes, like <code>NV</code> for Nvidia and <code>AMD</code> for, well, AMD. Any group may also use the generic <code>EXT</code> affix. Lists of extensions, together with their specifications, can be found at the <a href="https://www.opengl.org/registry/">OpenGL Registry</a> and <a href="https://www.khronos.org/registry/gles/">OpenGL ES Registry</a>.</p>
|
||||
<h2><a class="anchor" id="context_glext_auto"></a>
|
||||
Loading extension with a loader library</h2>
|
||||
<p>An extension loader library is the easiest and best way to access both OpenGL and OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs. They will take care of all the details of declaring and loading everything you need. One such library is <a href="https://github.com/Dav1dde/glad">glad</a> and there are several others.</p>
|
||||
<p>The following example will use glad but all extension loader libraries work similarly.</p>
|
||||
<p>First you need to generate the source files using the glad Python script. This example generates a loader for any version of OpenGL, which is the default for both GLFW and glad, but loaders for OpenGL ES, as well as loaders for specific API versions and extension sets can be generated. The generated files are written to the <code>output</code> directory.</p>
|
||||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> python main.py --generator c --no-loader --out-path output</div></div><!-- fragment --><p>The <code>--no-loader</code> option is added because GLFW already provides a function for loading OpenGL and OpenGL ES function pointers, one that automatically uses the selected context creation API, and glad can call this instead of having to implement its own. There are several other command-line options as well. See the glad documentation for details.</p>
|
||||
<div class="fragment"><div class="line">python main.py --generator c --no-loader --out-path output</div></div><!-- fragment --><p>The <code>--no-loader</code> option is added because GLFW already provides a function for loading OpenGL and OpenGL ES function pointers, one that automatically uses the selected context creation API, and glad can call this instead of having to implement its own. There are several other command-line options as well. See the glad documentation for details.</p>
|
||||
<p>Add the generated <code>output/src/glad.c</code>, <code>output/include/glad/glad.h</code> and <code>output/include/KHR/khrplatform.h</code> files to your build. Then you need to include the glad header file, which will replace the OpenGL header of your development environment. By including the glad header before the GLFW header, it suppresses the development environment's OpenGL or OpenGL ES header.</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#include <glad/glad.h></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="glfw3_8h.html">GLFW/glfw3.h</a>></span></div></div><!-- fragment --><p>Finally you need to initialize glad once you have a suitable current context.</p>
|
||||
<div class="fragment"><div class="line">window = <a class="code" href="group__window.html#ga5c336fddf2cbb5b92f65f10fb6043344">glfwCreateWindow</a>(640, 480, <span class="stringliteral">"My Window"</span>, NULL, NULL);</div><div class="line"><span class="keywordflow">if</span> (!window)</div><div class="line">{</div><div class="line"> ...</div><div class="line">}</div><div class="line"></div><div class="line"><a class="code" href="group__context.html#ga1c04dc242268f827290fe40aa1c91157">glfwMakeContextCurrent</a>(window);</div><div class="line"></div><div class="line">gladLoadGLLoader((GLADloadproc) <a class="code" href="group__context.html#ga35f1837e6f666781842483937612f163">glfwGetProcAddress</a>);</div></div><!-- fragment --><p>Once glad has been loaded, you have access to all OpenGL core and extension functions supported by both the context you created and the glad loader you generated and you are ready to start rendering.</p>
|
||||
@@ -173,9 +157,9 @@ Loading extensions manually</h2>
|
||||
<p>This section will demonstrate manual loading of OpenGL extensions. The loading of OpenGL ES extensions is identical except for the name of the extension header.</p>
|
||||
<h3><a class="anchor" id="context_glext_header"></a>
|
||||
The glext.h header</h3>
|
||||
<p>The <code>glext.h</code> extension 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 <a href="http://www.opengl.org/registry/">OpenGL Registry</a>. There are also extension headers for the various versions of OpenGL ES at the <a href="https://www.khronos.org/registry/gles/">OpenGL ES Registry</a>. It it strongly recommended that you use your own copy of the extension header, as the one included in your development environment may be several years out of date and may not include the extensions you wish to use.</p>
|
||||
<p>The <code>glext.h</code> extension 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 <a href="https://www.opengl.org/registry/">OpenGL Registry</a>. There are also extension headers for the various versions of OpenGL ES at the <a href="https://www.khronos.org/registry/gles/">OpenGL ES Registry</a>. It it strongly recommended that you use your own copy of the extension header, as the one included in your development environment may be several years out of date and may not include the extensions you wish to use.</p>
|
||||
<p>The header defines function pointer types for all functions of all extensions it supports. These have names like <code>PFNGLGETDEBUGMESSAGELOGARBPROC</code> (for <code>glGetDebugMessageLogARB</code>), i.e. the name is made uppercase and <code>PFN</code> (pointer to function) and <code>PROC</code> (procedure) are added to the ends.</p>
|
||||
<p>To include the extension header, define <a class="el" href="build_guide.html#build_macros">GLFW_INCLUDE_GLEXT</a> before including the GLFW header.</p>
|
||||
<p>To include the extension header, define <a class="el" href="build_guide.html#GLFW_INCLUDE_GLEXT">GLFW_INCLUDE_GLEXT</a> before including the GLFW header.</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#define GLFW_INCLUDE_GLEXT</span></div><div class="line"><span class="preprocessor">#include <GLFW/glfw3.h></span></div></div><!-- fragment --><h3><a class="anchor" id="context_glext_string"></a>
|
||||
Checking for extensions</h3>
|
||||
<p>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 at run-time whether the context supports the extension. This is done with <a class="el" href="group__context.html#ga87425065c011cef1ebd6aac75e059dfa">glfwExtensionSupported</a>.</p>
|
||||
@@ -185,10 +169,11 @@ Fetching function pointers</h3>
|
||||
<p>Many extensions, though not all, require the use of new OpenGL functions. These functions often do not have entry points in the client API libraries of your operating system, making it necessary to fetch them at run time. You can retrieve pointers to these functions with <a class="el" href="group__context.html#ga35f1837e6f666781842483937612f163">glfwGetProcAddress</a>.</p>
|
||||
<div class="fragment"><div class="line">PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = <a class="code" href="group__context.html#ga35f1837e6f666781842483937612f163">glfwGetProcAddress</a>(<span class="stringliteral">"glGetDebugMessageLogARB"</span>);</div></div><!-- fragment --><p>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.</p>
|
||||
<p>Now that all the pieces have been introduced, here is what they might look like when used together.</p>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#define GLFW_INCLUDE_GLEXT</span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="glfw3_8h.html">GLFW/glfw3.h</a>></span></div><div class="line"></div><div class="line"><span class="preprocessor">#define glGetDebugMessageLogARB pfnGetDebugMessageLog</span></div><div class="line">PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;</div><div class="line"></div><div class="line"><span class="comment">// Flag indicating whether the extension is supported</span></div><div class="line"><span class="keywordtype">int</span> has_ARB_debug_output = 0;</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> load_extensions(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group__context.html#ga87425065c011cef1ebd6aac75e059dfa">glfwExtensionSupported</a>(<span class="stringliteral">"GL_ARB_debug_output"</span>))</div><div class="line"> {</div><div class="line"> pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC)</div><div class="line"> <a class="code" href="group__context.html#ga35f1837e6f666781842483937612f163">glfwGetProcAddress</a>(<span class="stringliteral">"glGetDebugMessageLogARB"</span>);</div><div class="line"> has_ARB_debug_output = 1;</div><div class="line"> }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> some_function(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> (has_ARB_debug_output)</div><div class="line"> {</div><div class="line"> <span class="comment">// Now the extension function can be called as usual</span></div><div class="line"> glGetDebugMessageLogARB(...);</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --> </div></div><!-- contents -->
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#define GLFW_INCLUDE_GLEXT</span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="glfw3_8h.html">GLFW/glfw3.h</a>></span></div><div class="line"></div><div class="line"><span class="preprocessor">#define glGetDebugMessageLogARB pfnGetDebugMessageLog</span></div><div class="line">PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;</div><div class="line"></div><div class="line"><span class="comment">// Flag indicating whether the extension is supported</span></div><div class="line"><span class="keywordtype">int</span> has_ARB_debug_output = 0;</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> load_extensions(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> (<a class="code" href="group__context.html#ga87425065c011cef1ebd6aac75e059dfa">glfwExtensionSupported</a>(<span class="stringliteral">"GL_ARB_debug_output"</span>))</div><div class="line"> {</div><div class="line"> pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC)</div><div class="line"> <a class="code" href="group__context.html#ga35f1837e6f666781842483937612f163">glfwGetProcAddress</a>(<span class="stringliteral">"glGetDebugMessageLogARB"</span>);</div><div class="line"> has_ARB_debug_output = 1;</div><div class="line"> }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> some_function(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> (has_ARB_debug_output)</div><div class="line"> {</div><div class="line"> <span class="comment">// Now the extension function can be called as usual</span></div><div class="line"> glGetDebugMessageLogARB(...);</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --> </div></div><!-- PageDoc -->
|
||||
</div><!-- contents -->
|
||||
<address class="footer">
|
||||
<p>
|
||||
Last update on Thu Aug 18 2016 for GLFW 3.2.1
|
||||
Last update on Tue Apr 16 2019 for GLFW 3.3.0
|
||||
</p>
|
||||
</address>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user