void GLPanel::paintGL()
{
.....
.....
// Drawing code emitted
double dElapsed = time->elapsed();
time->restart();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_dFrameTimes += dElapsed/1000.0;
if ( ++m_nFrames == FRAME_RATE_CALC )
{
m_dFrameRate = FRAME_RATE_CALC/m_dFrameTimes;
m_nFrames = 0;
m_dFrameTimes = 0.0;
}
if ( m_bShowInfo )
{
glPushMatrix();
glTranslated(0.0,0.0,0.0);
renderText
(10.0,
10.0,
0.0,
QString("%1").
arg(m_dFrameRate,
0,
'f',
2),
QFont("Times",
10,
QFont::Bold));
glPopMatrix();
}
glFlush();
}
void GLPanel::paintGL()
{
.....
.....
// Drawing code emitted
double dElapsed = time->elapsed();
time->restart();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_dFrameTimes += dElapsed/1000.0;
if ( ++m_nFrames == FRAME_RATE_CALC )
{
m_dFrameRate = FRAME_RATE_CALC/m_dFrameTimes;
m_nFrames = 0;
m_dFrameTimes = 0.0;
}
if ( m_bShowInfo )
{
glPushMatrix();
qglColor(QColor(0,0,0));
glTranslated(0.0,0.0,0.0);
renderText(10.0,10.0,0.0,QString("%1").arg(m_dFrameRate,0,'f',2),QFont("Times",10,QFont::Bold));
glPopMatrix();
}
glFlush();
}
To copy to clipboard, switch view to plain text mode
Bookmarks