summaryrefslogtreecommitdiff
path: root/documentation/src
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/src')
-rw-r--r--documentation/src/opengl.dox24
-rw-r--r--documentation/src/osissues.dox3
2 files changed, 23 insertions, 4 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
diff --git a/documentation/src/osissues.dox b/documentation/src/osissues.dox
index 790899765..86b05b9c0 100644
--- a/documentation/src/osissues.dox
+++ b/documentation/src/osissues.dox
@@ -857,7 +857,8 @@ the GL scene in pixels: if the Fl_Gl_Window is mapped on a retina display, these
reported by Fl_Widget::w() and Fl_Widget::h(); if it's mapped on a regular display, they return the same values
as w() and h(). These methods dynamically change their values if the window is moved into/out from a retina
display. If Fl::use_high_res_GL(1) is not called, all Fl_Gl_Window 's are drawn at low resolution.
-These methods are synonyms of w() and h() on non-Mac OS X platforms, so the source code remains cross-platform.
+These methods are useful on all platforms because Fl_Gl_Window::w() and Fl_Gl_Window::h() don't return,
+on HighDPI displays, the quantitites in pixels necessary to OpenGL functions .
The Fl_Gl_Window::pixels_per_unit() method is useful when the OpenGL code depends on the pixel dimension
of the GL scene. This occurs, e.g., if a window's handle() method uses Fl::event_x() and Fl::event_y()