glutBitmapString mess with my OpenGL ES App


I know its a little offtopic but i dont know where else to ask.

Im using GLUT|ES and i wanna show the FPS.
I alreay calculate the FPS, but when i try show the FPS using glutBitmapString or glutTrueTypeString, the FPS appear but my model looks weird.

And when i try show the FPS with a bigger model, the application stuck (without the glutBitmapString procedure, the model is well rendered).

Im using the code below, before the “glutSwapBuffers()” in the method display()

glutBitmapString(GLUT_BITMAP_8_BY_13, 5, 5, "Test");

What im doing wrong?

Thank you

Wendel B Silva

The problem is likely that glutBitmapString does not reset all GL state it changes.

If you look at the source, you can see that e.g. glutBitmapStringPoints does push and pop the matrices, however it fails to reset DEPTH_TEST and ALPHA_TEST enable, MatrixMode, AlphaFunc, as well as all the vertex array enables and VertexPointer to their previous values.

Most importantly the pointer to the vertex position array will be invalid after glutBitmapString returns. So even if you’re rendering only a single object you can’t set it just once in your init code.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.