monitor.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.3.1"/>
  7. <title>GLFW: Multi-monitor guide</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  12. <script type="text/javascript" src="search/search.js"></script>
  13. <script type="text/javascript">
  14. $(document).ready(function() { searchBox.OnSelectItem(0); });
  15. </script>
  16. <link href="doxygen.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. <table cellspacing="0" cellpadding="0">
  22. <tbody>
  23. <tr style="height: 56px;">
  24. <td style="padding-left: 0.5em;">
  25. <div id="projectname">GLFW
  26. &#160;<span id="projectnumber">3.0.2</span>
  27. </div>
  28. <div id="projectbrief">A multi-platform library for OpenGL, window and input</div>
  29. </td>
  30. </tr>
  31. </tbody>
  32. </table>
  33. </div>
  34. <!-- end header part -->
  35. <!-- Generated by Doxygen 1.8.3.1 -->
  36. <script type="text/javascript">
  37. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  38. </script>
  39. <div id="navrow1" class="tabs">
  40. <ul class="tablist">
  41. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  42. <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  43. <li><a href="modules.html"><span>Modules</span></a></li>
  44. <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
  45. <li><a href="files.html"><span>Files</span></a></li>
  46. <li>
  47. <div id="MSearchBox" class="MSearchBoxInactive">
  48. <span class="left">
  49. <img id="MSearchSelect" src="search/mag_sel.png"
  50. onmouseover="return searchBox.OnSearchSelectShow()"
  51. onmouseout="return searchBox.OnSearchSelectHide()"
  52. alt=""/>
  53. <input type="text" id="MSearchField" value="Search" accesskey="S"
  54. onfocus="searchBox.OnSearchFieldFocus(true)"
  55. onblur="searchBox.OnSearchFieldFocus(false)"
  56. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  57. </span><span class="right">
  58. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  59. </span>
  60. </div>
  61. </li>
  62. </ul>
  63. </div>
  64. <!-- window showing the filter options -->
  65. <div id="MSearchSelectWindow"
  66. onmouseover="return searchBox.OnSearchSelectShow()"
  67. onmouseout="return searchBox.OnSearchSelectHide()"
  68. onkeydown="return searchBox.OnSearchSelectKey(event)">
  69. <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>
  70. <!-- iframe showing the search results (closed by default) -->
  71. <div id="MSearchResultsWindow">
  72. <iframe src="javascript:void(0)" frameborder="0"
  73. name="MSearchResults" id="MSearchResults">
  74. </iframe>
  75. </div>
  76. </div><!-- top -->
  77. <div class="header">
  78. <div class="headertitle">
  79. <div class="title">Multi-monitor guide </div> </div>
  80. </div><!--header-->
  81. <div class="contents">
  82. <div class="toc"><h3>Table of Contents</h3>
  83. <ul><li class="level1"><a href="#monitor_objects">Monitor objects</a></li>
  84. <li class="level1"><a href="#monitor_monitors">Retrieving monitors</a></li>
  85. <li class="level1"><a href="#monitor_modes">Retrieving video modes</a></li>
  86. <li class="level1"><a href="#monitor_size">Monitor physical size</a></li>
  87. <li class="level1"><a href="#monitor_name">Monitor name</a></li>
  88. <li class="level1"><a href="#monitor_gamma">Monitor gamma ramp</a></li>
  89. </ul>
  90. </div>
  91. <div class="textblock"><h1><a class="anchor" id="monitor_objects"></a>
  92. Monitor objects</h1>
  93. <p>The <a class="el" href="group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3">GLFWmonitor</a> object represents a currently connected monitor.</p>
  94. <h1><a class="anchor" id="monitor_monitors"></a>
  95. Retrieving monitors</h1>
  96. <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>
  97. <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>
  98. </div><!-- fragment --><p>You can retrieve all currently connected monitors with <a class="el" href="group__monitor.html#ga3fba51c8bd36491d4712aa5bd074a537">glfwGetMonitors</a>.</p>
  99. <div class="fragment"><div class="line"><span class="keywordtype">int</span> count;</div>
  100. <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>(&amp;count);</div>
  101. </div><!-- fragment --><h1><a class="anchor" id="monitor_modes"></a>
  102. Retrieving video modes</h1>
  103. <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>
  104. <div class="fragment"><div class="line"><span class="keywordtype">int</span> count;</div>
  105. <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, &amp;count);</div>
  106. </div><!-- fragment --><p>To get the current video mode of a monitor call <a class="el" href="group__monitor.html#gafc1bb972a921ad5b3bd5d63a95fc2d52">glfwGetVideoMode</a>.</p>
  107. <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>
  108. </div><!-- fragment --><h1><a class="anchor" id="monitor_size"></a>
  109. Monitor physical size</h1>
  110. <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>
  111. <div class="fragment"><div class="line"><span class="keywordtype">int</span> widthMM, heightMM;</div>
  112. <div class="line"><a class="code" href="group__monitor.html#gaa2d6107f4a35771b99812d1260c6056d" title="Returns the physical size of the monitor.">glfwGetMonitorPhysicalSize</a>(monitor, &amp;widthMM, &amp;heightMM);</div>
  113. </div><!-- fragment --><p>This can, for example, be used together with the current video mode to calculate the DPI of a monitor.</p>
  114. <div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">double</span> dpi = mode-&gt;<a class="code" href="structGLFWvidmode.html#a698dcb200562051a7249cb6ae154c71d">width</a> / (widthMM / 25.4);</div>
  115. </div><!-- fragment --><h1><a class="anchor" id="monitor_name"></a>
  116. Monitor name</h1>
  117. <p>The name of a monitor is returned by <a class="el" href="group__monitor.html#ga79a34ee22ff080ca954a9663e4679daf">glfwGetMonitorName</a>.</p>
  118. <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>
  119. </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>
  120. <h1><a class="anchor" id="monitor_gamma"></a>
  121. Monitor gamma ramp</h1>
  122. <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>
  123. <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, &amp;ramp);</div>
  124. </div><!-- fragment --><p>The current gamma ramp for a monitor is returned by <a class="el" href="group__monitor.html#gab7c41deb2219bde3e1eb756ddaa9ec80">glfwGetGammaRamp</a>.</p>
  125. <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>
  126. </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>
  127. <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>
  128. </div><!-- fragment --> </div></div><!-- contents -->
  129. <!-- start footer part -->
  130. <hr class="footer"/><address class="footer"><small>
  131. Generated on Sun Aug 25 2013 21:45:13 for GLFW by &#160;<a href="http://www.doxygen.org/index.html">
  132. <img class="footer" src="doxygen.png" alt="doxygen"/>
  133. </a> 1.8.3.1
  134. </small></address>
  135. </body>
  136. </html>