From 8813f93ac105e2ae58282f1d4fc5552591423712 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 8 May 2016 16:20:24 +0000 Subject: Fix gl_draw() used in simple window under Mac OS X. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11719 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/gl_draw.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 2a4722fe3..b33844dbd 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -369,7 +369,8 @@ static int has_texture_rectangle = 0; // true means GL_EXT_texture_rectangle is #include // for gluUnProject() and gluCheckExtension() #include // for glutStrokeString() and glutStrokeLength() -#include +#include +#include // manages a fifo pile of pre-computed string textures class gl_texture_fifo { @@ -554,7 +555,13 @@ static gl_texture_fifo *gl_fifo = NULL; // points to the texture pile class inst // draws a utf8 string using pre-computed texture if available void Fl_Cocoa_Gl_Window_Driver::draw_string(const char* str, int n) { - gl_scale = Fl_Window::current()->as_gl_window()->pixels_per_unit(); + Fl_Window *win = Fl_Window::current(); + if (win->as_gl_window()) + gl_scale = win->as_gl_window()->pixels_per_unit(); + else + gl_scale = (fl_mac_os_version >= 100700 && win->shown() && + Fl_Cocoa_Window_Driver::driver(win)->mapped_to_retina()) ? 2 : 1; + //fprintf(stderr,"gl_scale=%d\n",gl_scale); if (! gl_fifo) gl_fifo = new gl_texture_fifo(); if (!gl_fifo->textures_generated) { -- cgit v1.2.3