Cleaned up some code and added some comments.
This commit is contained in:
parent
eb8e9e1dad
commit
75c46dcf7f
1 changed files with 12 additions and 13 deletions
|
@ -841,6 +841,9 @@ void GfxOpenGL::createFont(Font *font) {
|
||||||
int width = font->getCharDataWidth(i), height = font->getCharDataHeight(i);
|
int width = font->getCharDataWidth(i), height = font->getCharDataHeight(i);
|
||||||
int32 d = font->getCharOffset(i);
|
int32 d = font->getCharOffset(i);
|
||||||
for (int x = 0; x < height; ++x) {
|
for (int x = 0; x < height; ++x) {
|
||||||
|
// a is the offset to get to the correct row.
|
||||||
|
// b is the offset to get to the correct line in the character.
|
||||||
|
// c is the offset of the character from the start of the row.
|
||||||
uint a = row * size * size * bpp * charsHigh;
|
uint a = row * size * size * bpp * charsHigh;
|
||||||
uint b = x * size * charsWide * bpp;
|
uint b = x * size * charsWide * bpp;
|
||||||
uint c = 0;
|
uint c = 0;
|
||||||
|
@ -896,8 +899,6 @@ void GfxOpenGL::drawTextObject(TextObject *text) {
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
|
|
||||||
const Color *color = text->getFGColor();
|
const Color *color = text->getFGColor();
|
||||||
|
@ -922,18 +923,18 @@ void GfxOpenGL::drawTextObject(TextObject *text) {
|
||||||
int z = x + font->getCharStartingCol(character);
|
int z = x + font->getCharStartingCol(character);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
float width = 1/16.f;
|
float width = 1 / 16.f;
|
||||||
float cx = ((character-1)%16)/16.0f;
|
float cx = ((character-1) % 16) / 16.0f;
|
||||||
float cy = ((character-1)/16)/16.0f;
|
float cy = ((character-1) / 16) / 16.0f;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(cx, cy);
|
glTexCoord2f(cx, cy);
|
||||||
glVertex2i(z, w);
|
glVertex2i(z, w);
|
||||||
glTexCoord2f(cx+width, cy);
|
glTexCoord2f(cx + width, cy);
|
||||||
glVertex2i(z+size, w);
|
glVertex2i(z + size, w);
|
||||||
glTexCoord2f(cx+width, cy+width);
|
glTexCoord2f(cx + width, cy + width);
|
||||||
glVertex2i(z+size, w+size);
|
glVertex2i(z + size, w + size);
|
||||||
glTexCoord2f(cx, cy+width);
|
glTexCoord2f(cx, cy + width);
|
||||||
glVertex2i(z, w+size);
|
glVertex2i(z, w + size);
|
||||||
glEnd();
|
glEnd();
|
||||||
x += font->getCharWidth(character);
|
x += font->getCharWidth(character);
|
||||||
}
|
}
|
||||||
|
@ -941,10 +942,8 @@ void GfxOpenGL::drawTextObject(TextObject *text) {
|
||||||
|
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glDepthMask(GL_TRUE);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue