<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <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.3.1"/> <title>GLFW: Multi-monitor guide</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">GLFW  <span id="projectnumber">3.0.2</span> </div> <div id="projectbrief">A multi-platform library for OpenGL, window and input</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.3.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </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> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Pages</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">Multi-monitor guide </div> </div> </div><!--header--> <div class="contents"> <div class="toc"><h3>Table of Contents</h3> <ul><li class="level1"><a href="#monitor_objects">Monitor objects</a></li> <li class="level1"><a href="#monitor_monitors">Retrieving monitors</a></li> <li class="level1"><a href="#monitor_modes">Retrieving video modes</a></li> <li class="level1"><a href="#monitor_size">Monitor physical size</a></li> <li class="level1"><a href="#monitor_name">Monitor name</a></li> <li class="level1"><a href="#monitor_gamma">Monitor gamma ramp</a></li> </ul> </div> <div class="textblock"><h1><a class="anchor" id="monitor_objects"></a> Monitor objects</h1> <p>The <a class="el" href="group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3">GLFWmonitor</a> object represents a currently connected monitor.</p> <h1><a class="anchor" id="monitor_monitors"></a> Retrieving monitors</h1> <p>The primary monitor is returned by <a class="el" href="group__monitor.html#ga721867d84c6d18d6790d64d2847ca0b1">glfwGetPrimaryMonitor</a>. It is usually the user's preferred monitor and the one with global UI elements like task bar or menu bar.</p> <div class="fragment"><div class="line"><a class="code" href="group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3">GLFWmonitor</a>* primary = <a class="code" href="group__monitor.html#ga721867d84c6d18d6790d64d2847ca0b1" title="Returns the primary monitor.">glfwGetPrimaryMonitor</a>();</div> </div><!-- fragment --><p>You can retrieve all currently connected monitors with <a class="el" href="group__monitor.html#ga3fba51c8bd36491d4712aa5bd074a537">glfwGetMonitors</a>.</p> <div class="fragment"><div class="line"><span class="keywordtype">int</span> count;</div> <div class="line"><a class="code" href="group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3">GLFWmonitor</a>** monitors = <a class="code" href="group__monitor.html#ga3fba51c8bd36491d4712aa5bd074a537" title="Returns the currently connected monitors.">glfwGetMonitors</a>(&count);</div> </div><!-- fragment --><h1><a class="anchor" id="monitor_modes"></a> Retrieving video modes</h1> <p>Although GLFW generally does a good job at selecting a suitable video mode for you when you open a full screen window, it is sometimes useful to know exactly which modes are available on a certain system. For example, you may want to present the user with a list of video modes to select from. To get a list of available video modes, you can use the function <a class="el" href="group__monitor.html#ga820b0ce9a5237d645ea7cbb4bd383458">glfwGetVideoModes</a>.</p> <div class="fragment"><div class="line"><span class="keywordtype">int</span> count;</div> <div class="line"><a class="code" href="structGLFWvidmode.html" title="Video mode type.">GLFWvidmode</a>* modes = <a class="code" href="group__monitor.html#ga820b0ce9a5237d645ea7cbb4bd383458" title="Returns the available video modes for the specified monitor.">glfwGetVideoModes</a>(monitor, &count);</div> </div><!-- fragment --><p>To get the current video mode of a monitor call <a class="el" href="group__monitor.html#gafc1bb972a921ad5b3bd5d63a95fc2d52">glfwGetVideoMode</a>.</p> <div class="fragment"><div class="line"><span class="keyword">const</span> <a class="code" href="structGLFWvidmode.html" title="Video mode type.">GLFWvidmode</a>* mode = <a class="code" href="group__monitor.html#gafc1bb972a921ad5b3bd5d63a95fc2d52" title="Returns the current mode of the specified monitor.">glfwGetVideoMode</a>(monitor);</div> </div><!-- fragment --><h1><a class="anchor" id="monitor_size"></a> Monitor physical size</h1> <p>The physical size in millimetres of a monitor, or an approximation of it, can be retrieved with <a class="el" href="group__monitor.html#gaa2d6107f4a35771b99812d1260c6056d">glfwGetMonitorPhysicalSize</a>.</p> <div class="fragment"><div class="line"><span class="keywordtype">int</span> widthMM, heightMM;</div> <div class="line"><a class="code" href="group__monitor.html#gaa2d6107f4a35771b99812d1260c6056d" title="Returns the physical size of the monitor.">glfwGetMonitorPhysicalSize</a>(monitor, &widthMM, &heightMM);</div> </div><!-- fragment --><p>This can, for example, be used together with the current video mode to calculate the DPI of a monitor.</p> <div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> dpi = mode-><a class="code" href="structGLFWvidmode.html#a698dcb200562051a7249cb6ae154c71d">width</a> / (widthMM / 25.4);</div> </div><!-- fragment --><h1><a class="anchor" id="monitor_name"></a> Monitor name</h1> <p>The name of a monitor is returned by <a class="el" href="group__monitor.html#ga79a34ee22ff080ca954a9663e4679daf">glfwGetMonitorName</a>.</p> <div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* name = <a class="code" href="group__monitor.html#ga79a34ee22ff080ca954a9663e4679daf" title="Returns the name of the specified monitor.">glfwGetMonitorName</a>(monitor);</div> </div><!-- fragment --><p>The monitor name is a regular C string using the UTF-8 encoding. Note that monitor names are not guaranteed to be unique.</p> <h1><a class="anchor" id="monitor_gamma"></a> Monitor gamma ramp</h1> <p>The gamma ramp of a monitor can be set with <a class="el" href="group__monitor.html#ga583f0ffd0d29613d8cd172b996bbf0dd">glfwSetGammaRamp</a>, which accepts a monitor handle and a pointer to a <a class="el" href="structGLFWgammaramp.html">GLFWgammaramp</a> structure.</p> <div class="fragment"><div class="line"><a class="code" href="group__monitor.html#ga583f0ffd0d29613d8cd172b996bbf0dd" title="Sets the current gamma ramp for the specified monitor.">glfwSetGammaRamp</a>(monitor, &ramp);</div> </div><!-- fragment --><p>The current gamma ramp for a monitor is returned by <a class="el" href="group__monitor.html#gab7c41deb2219bde3e1eb756ddaa9ec80">glfwGetGammaRamp</a>.</p> <div class="fragment"><div class="line"><span class="keyword">const</span> <a class="code" href="structGLFWgammaramp.html" title="Gamma ramp.">GLFWgammaramp</a>* ramp = <a class="code" href="group__monitor.html#gab7c41deb2219bde3e1eb756ddaa9ec80" title="Retrieves the current gamma ramp for the specified monitor.">glfwGetGammaRamp</a>(monitor);</div> </div><!-- fragment --><p>If you wish to set a regular gamma ramp, you can have GLFW calculate it for you from the desired exponent with <a class="el" href="group__monitor.html#ga6ac582625c990220785ddd34efa3169a">glfwSetGamma</a>, which in turn calls <a class="el" href="group__monitor.html#ga583f0ffd0d29613d8cd172b996bbf0dd">glfwSetGammaRamp</a> with the resulting ramp.</p> <div class="fragment"><div class="line"><a class="code" href="group__monitor.html#ga6ac582625c990220785ddd34efa3169a" title="Generates a gamma ramp and sets it for the specified monitor.">glfwSetGamma</a>(monitor, 1.0);</div> </div><!-- fragment --> </div></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sun Aug 25 2013 21:45:13 for GLFW by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.3.1 </small></address> </body> </html>