void CUI::drawUI(void) { if (data->debugMode) { float color[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color); } else { float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color); } //reset light float amb[] = { 1.0f, 1.0f, 1.0f }; float dif[] = { 0.0f, 0.0f, 0.0f }; float spe[] = { 0.0f, 0.0f, 0.0f }; glMaterialfv(GL_FRONT, GL_AMBIENT, amb); glMaterialfv(GL_FRONT, GL_DIFFUSE, dif); glMaterialfv(GL_FRONT, GL_SPECULAR, spe); glDisable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0.0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT), 0.0, -1.0, 10.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClear(GL_DEPTH_BUFFER_BIT); glColor3f(0.1f, 0.1f, 0.1f); displayHUD(); displayFPS(); displayDebug(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glEnable(GL_DEPTH_TEST); textLines = 0; }
void display(void) { keyOperations(); glClearColor (skyColor[0],skyColor[1],skyColor[2],skyColor[3]); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); resetStats(); glMatrixMode(GL_MODELVIEW); camera->Render(); RenderSky(camera->GetX(),camera->GetZ()); Island->Render(camera->GetX(),camera->GetZ()); drawFPS(); writeString(10, 80,"Camera Position: %.2f %.2f %.2f",camera->GetX(),camera->GetY(),camera->GetZ()); displayHUD(); glutSwapBuffers(); }