When I tried that last time, all my images were displayed as white boxes if I printed something.
So I edited Gpyph.cpp to add glBindTexture(GL_TEXTURE_2D, 0) after glDisableClientState. The white box problem was fixed, but for some reason, I noticed the texts had wrong offsets.
For example, if I draw a string at (0, 10), on windows its upper border is at 10, but on android, its lower border is at 10. Any ideas?
Code: Select all
void Glyph::draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const
{
static Matrix t;
t.setTransformation(x, y, angle, sx, sy, ox, oy);
if(texture != 0)
glBindTexture(GL_TEXTURE_2D,texture);
glPushMatrix();
glMultMatrixf((const GLfloat*)t.getElements());
glTranslatef(static_cast<float>(data->getBearingX()), static_cast<float>(-data->getBearingY()), 0.0f);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)&vertices[0].x);
glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)&vertices[0].s);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glBindTexture(GL_TEXTURE_2D, 0);
glPopMatrix();
}