sandyrepope
28-03-2008, 02:58
In the help file for the TBGL module it says that the texture mapping should be disabled before using TBGL_PrintFont.
Why?
Thanks
Sandy
Petr Schreiber
28-03-2008, 09:22
Hi Sandy,
it is recommendation, not a must. But good to get rid of side effects.
How does TTF font rendering work in TBGL?
First you create font handle like:
TBGL_BuildFont TBGL_FontHandle("Arial", 16)
This command is the key - it takes the classic Windows font, analyses its characters and internally converts them to little bitmaps, which OpenGL can manipulate.
So if you would not disable texturing before drawing them, TBGL/OpenGL would try to texture them. And as those little character primitives do not have texturing coordinates specified, it provides odd results.
OpenGL works as state machine - you enable texturing, and all following commands are affected by it, until you disable it.
Font you operate using TBGL_PrintFont is no longer GDI object, but OpenGL one.
Microsoft claims mixing OpenGL and GDI drawing a sin :), it is possible, but means dancing on the edge ad bad practise for future.
Hope I made the situation clear now :),
thanks for the question,
Petr
P.S. Will add this info to the help file