Lanzers escribió:Si, los alinea mejor que el otro sistema de grh font que hay.
Lo que yo quiero saber es si por ejemplo, le doy tamaño 8 a la font, de altura tiene ese tamaño, pero de ancho? Es regular..? El problema con mi sistema es que habria que hacerlo más preciso, porque con el tamaño de ancho falla a veces..
Mira mi render:
- void FontRender(FontTexture * Font, float x, float y, char * text, GLubyte * Color)
- {
- char * ch;
-
- glPushAttrib(GL_LIST_BIT|GL_CURRENT_BIT|GL_ENABLE_BIT|GL_TRANSFORM_BIT);
- glMatrixMode(GL_MODELVIEW);
- glDisable(GL_LIGHTING);
- glEnable(GL_TEXTURE_2D);
- glDisable(GL_DEPTH_TEST);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glColor4ubv(Color);
-
- glPushMatrix();
- glScalef(1,-1,1);
-
- for (ch = text; *ch; ch++)
- {
- glPushMatrix();
- glTranslatef(x,-y - Font->pt-Font->hoss[(UInt32)*ch], 0);
- glBindTexture(GL_TEXTURE_2D, Font->textures[(UInt32)*ch]);
-
- glBegin(GL_TRIANGLE_STRIP);
- glTexCoord2f(0,Font->qths[(UInt32)*ch]); glVertex2i(0,0);
- glTexCoord2i(0,0); glVertex2i(0,Font->qvhs[(UInt32)*ch]);
- glTexCoord2f(Font->qtws[(UInt32)*ch], Font->qths[(UInt32)*ch]); glVertex2i(Font->qvws[(UInt32)*ch],0);
- glTexCoord2f(Font->qtws[(UInt32)*ch],0); glVertex2i(Font->qvws[(UInt32)*ch],Font->qvhs[(UInt32)*ch]);
- glEnd();
-
- glPopMatrix();
- glTranslatef(Font->wids[(UInt32)*ch],0,0);
- }
-
- glPopMatrix();
- glPopAttrib();
- }
-
Es más sencillo, no da tantos rodeos como el otro.
Realmente el problema no se nota si vas a renderizar texto, o similares. Pero cuando vas a centrarlo bien con la GUI por ejemplo, ahi si que se nota..