diff options
| author | Manolo Gouy <Manolo> | 2014-12-20 16:52:48 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2014-12-20 16:52:48 +0000 |
| commit | 1a6790b219e80fdb4ebcae32532dad884a552424 (patch) | |
| tree | d1ff0112f0f8f6a85d7db40752ddcba3a5a49b88 | |
| parent | 006d86b7e904525ee060426dd9ac4ee3ef2c4dfc (diff) | |
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
| -rw-r--r-- | documentation/src/opengl.dox | 3 | ||||
| -rw-r--r-- | documentation/src/osissues.dox | 21 |
2 files changed, 24 insertions, 0 deletions
diff --git a/documentation/src/opengl.dox b/documentation/src/opengl.dox index 566ec6ddb..0b5374ad8 100644 --- a/documentation/src/opengl.dox +++ b/documentation/src/opengl.dox @@ -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: diff --git a/documentation/src/osissues.dox b/documentation/src/osissues.dox index cc6f466f4..80edb3624 100644 --- a/documentation/src/osissues.dox +++ b/documentation/src/osissues.dox @@ -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, |
