void COLLADA_Viewer::onRender() { // base implementation clears screen and sets up camera FWGLApplication::onRender(); if (!load_ok) { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); Browser.onRender(); cellDbgFontPuts(0.5f, 0.5f, 1.0f, 0xff00ffff, "Load Error!"); cellDbgFontDraw(); return; } if (mRunning==false) return; glPushMatrix(); glEnable(GL_DEPTH_TEST); _CrtRender.Render(); glPopMatrix(); // FPS REPORTING glDisable(GL_VSYNC_SCE); // get current timing info FWTimeVal timeNow = FWTime::getCurrentTime(); float fElapsedInFrame = (float)(timeNow - mLastTime); mLastTime = timeNow; ++frames; timeElapsed+=fElapsedInFrame; // report fps at appropriate interval if (timeElapsed>=timeReport) { //printf("FPS: %.2f\n",(frames-framesLastReport)*1.f/(float)(timeElapsed-timeLastReport)); timeReport+=REPORT_TIME; timeLastReport=timeElapsed; framesLastReport=frames; } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); Browser.onRender(); cellDbgFontDraw(); }
//---------------------------------------------------------------------------------------------------- // Main Render CrtInt32 DrawGLScene(GLvoid) { // Clear The Screen And The Depth Buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); CrtMaterial mat; mat.Ambient = CrtColor3f( 1,1,1 ); mat.Diffuse = CrtColor3f( 1,1,1 ); glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, (GLfloat *)&mat.Diffuse ); glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, (GLfloat *)&mat.Ambient ); glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, (GLfloat *)&mat.Specular ); glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, (GLfloat )mat.Shininess ); _CrtRender.Render(); return TRUE; }