I have a problem with the allegro 5 and opengl combination
I want to use al_draw_textf for my fps counter. But it is always behind the perspective of opengl.
I use the functions in given sequence.
Can somebody please help me???
Code:
Easiest way will be a brute foce method like:
// Just pseudocode, look up documentationf or all functions. // right after al_create_display glGetDoublev(GL_MODELVIEW_MATRIX, modelview) glGetDoublev(GL_PROJECTION_MATRIX, projection) glGetDoublev(GL_VIEWPORT, viewport) // then later, before using Allegro functions glViewport(viewport[0], viewport[1], viewport[2], viewport[3]) glMatrixMode(GL_PROJECTION) gLoadMatrixd(projection) glMatrixMode(GL_MODELVIEW) gLoadMatrixd(modelview)
Basically, store whatever is the current transformation setup Allegro uses, then restore to that whenever using Allegro functions.
Alternatively you could check Allegro's source code and just set up the same matrices.
ok thanks for the reaction but is there no way to not brute force it I wass thinking something like making one viewport transparant
or else is there a way to use text in opengl
If you want the text to not be affected by the perspective transform, you need to disable that transform, no matter how you draw it.
Why not just push and pop the relevant matrices?
ok that is something I am going to try