Hi all .I am trying to display a text for FPS using
glutBitmapCharacter()
If I use an old OpenGL pipeline that is ok.The text renders.But Running it within a project where I load shader programs it doesn’t show.Should I pass something into Vertex/Fragment shaders in order to get glutBitmapCharacter() working.My functions for FPS rendering are as follows:
void drawString(float x, float y, float z, string &string)
{
unsigned int len, i;
glRasterPos2f(x, y);
len = string.length();
for (i = 0; i < len; i++) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, string[i]);
}
}
void CalculateFrameRate()
{
static float framesPerSecond = 0.0f;
static float lastTime = 0.0f;
static string result;
float currentTime = GetTickCount() * 0.001f;
++framesPerSecond;
if( currentTime - lastTime > 1.0f )
{
lastTime = currentTime;
fprintf(stderr, "
frames Per Second: %d
", (int)framesPerSecond);//console print
stringstream str;
str << framesPerSecond;
str >> result;
framesPerSecond = 0;
}
drawString(-30,30,0,result+"frames");
}
CalculateFrameRate() method gets called on each redisplay .
Thanks for help.