Menu

#27 Change GLUT_* font macros to do function calls

open
nobody
None
5
2005-09-30
2005-09-30
No

To simplify internal structure, and to allow custom font
data to be pased from the user, I think that it would be
a good thing to make, e.g., GLUT_BITMAP_SYMBOL_24
expand into a function call such as glutLookupFont("GLUT
Bitmap Symbol 24").

Font lookup will return a font data structure as defined
by by openglean's internal.h (the format can then be
exported to gleanfonts.h for clients to use).

Font-using functions will then take such a structure
pointer. This opens the door for client font data.

It also may improve the rendering speed slightly by
letting the client cache the font pointer. (Currently,
everytime a font operation is done, OpenGLEAN must do a
linear search of approximately 100 fonts to find the
requested font. Organizing the search into a tree or
similar is problematic because if we change the
numbering of fonts, we lose backwards-compatible ABI
support, and trying to manually keep track of somewhat
randomized font ordering to manualy build a search tree
is...not very apetizing.)

Of course, if the GLUT_* font symbols expand into
function calls that do a string search, many legacy
applications will run a little more slowly, as they
won't know to cache the font reference. Directly
referencing the font data, as old GLUT did on UNIX_X11
may not work on WIN32...WIN32 DLLs do not seem to like
to export data references.

Discussion


Log in to post a comment.