diff options
Diffstat (limited to 'documentation/src/opengl.dox')
| -rw-r--r-- | documentation/src/opengl.dox | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/documentation/src/opengl.dox b/documentation/src/opengl.dox index 91983f0c9..b0c6b3d65 100644 --- a/documentation/src/opengl.dox +++ b/documentation/src/opengl.dox @@ -25,9 +25,9 @@ the file \p <GL/gl.h> (on macOS: \p <OpenGL/gl.h>), define some extra drawing functions provided by FLTK, and include the \p <windows.h> header file needed by Windows applications. -Some simple coding rules (see \ref osissues_retina) allow to write -cross-platform code that will draw high resolution -OpenGL graphics if run on 'retina' displays with MacOS. +Some simple coding rules (see \ref opengl_highdpi) allow to write +cross-platform code that will support OpenGL run on HighDPI displays +(including the 'retina' displays of Apple hardware). \section opengl_subclass Making a Subclass of Fl_Gl_Window @@ -179,6 +179,24 @@ You must put <tt>glwindow->show()</tt> in your main code after calling \p show() on the window containing the OpenGL window. +\section opengl_highdpi OpenGL and support of HighDPI displays + +HighDPI displays (including the so-called 'retina' displays of Apple +hardware) are supported by FLTK in such a way that 1 unit of an FLTK +quantity (say, the value given by Fl_Gl_Window::w()) corresponds to more +than 1 pixel on the display. Conversely, when a program specifies the width and height of the +OpenGL viewport, it is necessary to use an API that returns quantities expressed in pixels +as follows: +\code + Fl_Gl_Window *glw = ...; + glViewport(0, 0, glw->pixel_w(), glw->pixel_h()); +\endcode +which makes use of the Fl_Gl_Window::pixel_w() and Fl_Gl_Window::pixel_h() functions giving +the size in pixels of an Fl_Gl_Window that is potentially mapped to a HighDPI display. +Method Fl_Gl_Window::pixels_per_unit() can also be useful in this context. +\note A further coding rule is necessary to properly support retina displays +and OpenGL under macOS (see \ref osissues_retina) + \section opengl_normal Using OpenGL in Normal FLTK Windows You can put OpenGL code into the \p draw() method, as described in |
