Added documentation about the new support for high resolution OpenGL graphics

on Apple retina displays.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10503 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2014-12-20 16:52:48 +00:00
parent 006d86b7e9
commit 1a6790b219
2 changed files with 24 additions and 0 deletions

View File

@ -26,6 +26,9 @@ some extra drawing functions provided by FLTK, and include the
\p <windows.h> header file needed by WIN32
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 Mac OS X.
\section opengl_subclass Making a Subclass of Fl_Gl_Window
To make a subclass of Fl_Gl_Window, you must provide:

View File

@ -824,6 +824,27 @@ Set <tt>"Print Front Window" = "";</tt> therein so the application menu doesn't
To localize the application name itself, create a file <tt>InfoPlist.strings</tt> in each .lproj directory
and put <tt>CFBundleName = "localized name";</tt> in each such file.
\subsection osissues_retina OpenGL and 'retina' displays
It is possible to have OpenGL produce graphics at the high pixel resolution allowed by the so-called 'retina' displays
present on recent Apple hardware.
For this, call
\verbatim
Fl::use_high_res_GL(1);
\endverbatim
before any Fl_Gl_Window is shown. Also, adapt your Fl_Gl_Window::draw() and Fl_Gl_Window::draw_overlay() methods replacing
\verbatim
glViewport(0, 0, w(), h());
\endverbatim
by
\verbatim
glViewport(0, 0, pixel_w(), pixel_h());
\endverbatim
making use of the Fl_Gl_Window::pixel_w() and Fl_Gl_Window::pixel_h() functions that return the width and height of
the GL scene in pixels: if the Fl_Gl_Window is mapped on a retina display, these functions return twice as much as
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().
If you don't call Fl::use_high_res_GL(1), your Fl_Gl_Window 's will be drawn with low resolution.
These functions are synonyms of w() and h() on non-Mac OS X platforms, so your source code remains cross-platform.
Fl_Double_Window
OS X double-buffers all windows automatically. On OS X,