1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-12-04 16:08:52 -05:00
glfw/docs/monitor.dox

106 lines
2.6 KiB
Plaintext
Raw Normal View History

2013-05-27 11:10:34 -04:00
/*!
@page monitor Multi-monitor guide
2013-05-27 15:58:33 -04:00
@tableofcontents
2013-05-27 11:10:34 -04:00
@section monitor_objects Monitor objects
2013-05-27 15:58:33 -04:00
The @ref GLFWmonitor object represents a currently connected monitor.
2013-07-07 06:06:59 -04:00
@section monitor_monitors Retrieving monitors
2013-05-27 15:58:33 -04:00
The primary monitor is returned by @ref glfwGetPrimaryMonitor. It is usually
the user's preferred monitor and the one with global UI elements like task bar
or menu bar.
@code
GLFWmonitor* primary = glfwGetPrimaryMonitor();
@endcode
You can retrieve all currently connected monitors with @ref glfwGetMonitors.
@code
int count;
GLFWmonitor** monitors = glfwGetMonitors(&count);
@endcode
2013-05-27 11:10:34 -04:00
2013-07-07 06:06:59 -04:00
@section monitor_modes Retrieving video modes
2013-05-27 11:10:34 -04:00
Although GLFW generally does a good job at selecting a suitable video
2013-05-27 15:58:33 -04:00
mode for you when you open a full screen window, it is sometimes useful to
2013-05-27 11:10:34 -04:00
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
@ref glfwGetVideoModes.
@code
int count;
GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
@endcode
To get the current video mode of a monitor call @ref glfwGetVideoMode.
@code
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
@endcode
2013-05-27 15:58:33 -04:00
@section monitor_size Monitor physical size
The physical size in millimetres of a monitor, or an approximation of it, can be
2013-06-17 06:56:36 -04:00
retrieved with @ref glfwGetMonitorPhysicalSize.
2013-05-27 15:58:33 -04:00
@code
int widthMM, heightMM;
glfwGetMonitorPhysicalSize(monitor, &widthMM, &heightMM);
@endcode
2013-06-17 06:56:36 -04:00
This can, for example, be used together with the current video mode to calculate
the DPI of a monitor.
@code
const double dpi = mode->width / (widthMM / 25.4);
@endcode
2013-05-27 15:58:33 -04:00
@section monitor_name Monitor name
The name of a monitor is returned by @ref glfwGetMonitorName.
@code
const char* name = glfwGetMonitorName(monitor);
@endcode
The monitor name is a regular C string using the UTF-8 encoding. Note that
monitor names are not guaranteed to be unique.
@section monitor_gamma Monitor gamma ramp
The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts
a monitor handle and a pointer to a @ref GLFWgammaramp structure.
@code
glfwSetGammaRamp(monitor, &ramp);
@endcode
The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp.
@code
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
@endcode
If you wish to set a regular gamma ramp, you can have GLFW calculate it for you
from the desired exponent with @ref glfwSetGamma, which in turn calls @ref
glfwSetGammaRamp with the resulting ramp.
@code
glfwSetGamma(monitor, 1.0);
@endcode
2013-05-27 11:10:34 -04:00
*/