19,468
社区成员
发帖
与我相关
我的任务
分享
void CEGuiOpenGLBaseApplication::drawFrame(void)
{
CEGUI::System& guiSystem = CEGUI::System::getSingleton();
// do time based updates
int thisTime = glutGet(GLUT_ELAPSED_TIME);
float elapsed = static_cast<float>(thisTime - d_lastFrameTime);
d_lastFrameTime = thisTime;
// inject the time pulse
guiSystem.injectTimePulse(elapsed / 1000.0f);
// update fps fields
doFPSUpdate();
// update logo rotation
static float rot = 0.0f;
d_logo_geometry->setRotation(CEGUI::Vector3(rot, 0, 0));
rot += 180.0f * (elapsed / 1000.0f);
if (rot > 360.0f)
rot -= 360.0f;
// do rendering for this frame.
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); // 在这里画线但是没有反应,在另外一个测试程序里面去掉cegui的相关代码,可以画出来
glLineWidth( 2.0 );
glBegin( GL_LINES );
glVertex3f( .0 , .0 , .0 );
glVertex3f( 100.0 , 100.0 , .0 );
glEnd();
guiSystem.renderGUI();
glutPostRedisplay();
glutSwapBuffers();
// here we check the 'quitting' state and cleanup as required.
// this is probably not the best way to do this, but since we're
// using glut, and glutMainLoop can never return, we need some
// way of checking when to exit. And this is it...
if (d_quitFlag)
{
CEGUI::OpenGLRenderer::destroySystem();
// exit
exit(0);
}
}