summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Choice.H
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-12-20 07:19:23 +0000
committerManolo Gouy <Manolo>2014-12-20 07:19:23 +0000
commitf3a84c0ee5f88fe664d759106724f786c706f817 (patch)
tree3541953164e2d24c31ae46ef11f2c2e86b3873a3 /src/Fl_Gl_Choice.H
parenta7dc3ea9e24399f318a9478fbcffe04ff2870de6 (diff)
Changed OpenGL support for the Mac OS X platform: use cocoa instead of deprecated AGL.
All changes are mac-specific, except a very minor change in file src/gl_draw.cxx where string drawing wrongly claimed to support @symbol, not possible because symbols are drawn using non-GL primitives. Unchanged application code can use the new FLTK code. In addition, the new code allows mac applications to draw OpenGL scenes at high resolution on so-called 'retina' displays, but this requires some support from app code. They must call, before opening GL windows, Fl::use_high_resolution(1); and change their glViewport() calls as follows glViewport(0, 0, pxel_w(), pixel_h()); This uses 2 new member functions of the Fl_Gl_Window class, pixel_w() and pixel_h() returning the window dimensions in pixel units, that is, twice the w() and h() when the window is mapped on a retina display. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10498 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Gl_Choice.H')
-rw-r--r--src/Fl_Gl_Choice.H16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Fl_Gl_Choice.H b/src/Fl_Gl_Choice.H
index caca3ce42..2d5e2fcb9 100644
--- a/src/Fl_Gl_Choice.H
+++ b/src/Fl_Gl_Choice.H
@@ -51,10 +51,16 @@
# include <FL/gl.h>
# define GLContext HGLRC
#elif defined(__APPLE_QUARTZ__)
-// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
# include <OpenGL/gl.h>
-# include <AGL/agl.h>
-# define GLContext AGLContext
+#ifdef __OBJC__
+@class NSOpenGLPixelFormat;
+@class NSOpenGLContext;
+#else
+class NSOpenGLPixelFormat;
+class NSOpenGLContext;
+#endif // __OBJC__
+typedef NSOpenGLContext* FLOpenGLContextPtr;
+# define GLContext FLOpenGLContextPtr
#else
# include <GL/glx.h>
# define GLContext GLXContext
@@ -70,8 +76,7 @@ public:
int pixelformat; // the visual to use
PIXELFORMATDESCRIPTOR pfd; // some wgl calls need this thing
#elif defined(__APPLE_QUARTZ__)
- // warning: the Quartz version should probably use Core GL (CGL) instead of AGL
- AGLPixelFormat pixelformat;
+ NSOpenGLPixelFormat* pixelformat;
#else
XVisualInfo *vis; // the visual to use
Colormap colormap; // a colormap for that visual
@@ -89,7 +94,6 @@ class Fl_Window;
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
#elif defined(__APPLE_QUARTZ__)
-// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);