FLTK logo

Re: Problems with gl_draw on Mac OSX

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.opengl  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Problems with gl_draw on Mac OSX Manolo Gouy Jul 21, 2011  
 
> I checked the docs and found gl_texture_pile_height, it is set by default to 100 so I lowered to 1. The problem is gone.
>
> I'm sure this affects performance so if the problem is a bug that is fixable that would be great.
>
> Any clues?
>
> Thanks.
> Daniel

FLTK 1.3 uses textures under Mac OS X because that's the only way to draw non-ascii text and to make 64-bit applications.

The algorithm is as follows:
- a number N of texture names is allocated the first time gl_draw() is called by N calls to glGenTextures(1, .). N is 100 by default, but can be changed calling gl_texture_pile_height(int);
- all strings are then drawn into one of these textures and mapped to the display with calls to glBindTexture();
- when a new string is to be drawn, a new texture is used, and if no more texture is available, a previous one is replaced by the new string;
- when a string is to be drawn, the matching texture is re-used if present, that is, if the same string had been drawn already;
- glDeleteTextures() calls are made on all N textures only when any Fl_Gl_Window is deleted, or when gl_texture_pile_height(int) is called.

Can you understand why this interferes with your application ?

As a workaround, you can change line 55 of file src/gl_draw.cxx of the FLTK library from
#define GL_DRAW_USES_TEXTURES  (defined(__APPLE__) && !__ppc__)
to
#define GL_DRAW_USES_TEXTURES 0
and recompile the library. This will return it to the previous way of drawing text on OpenGL (that is still used on powerPC Macs) that doesn't use textures but can't draw non ascii text.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.