void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the screen - any drawing before here will not display glLoadIdentity(); // set up the camera here camera.setCamera(); // camera is set up - any drawing before here will display incorrectly // Draw Skybox glPushMatrix(); glTranslatef(camera.getPosition().x, camera.getPosition().y, camera.getPosition().z); glDepthMask(GL_FALSE); skybox.draw(); glDepthMask(GL_TRUE); glPopMatrix(); // Draw Saturn glPushMatrix(); glTranslatef(saturnInfo.x, 0.f, saturnInfo.z); glScalef(saturnInfo.radius, saturnInfo.radius, saturnInfo.radius); saturn.draw(); glPopMatrix(); // Draw Moons for (int i = 0; i < 10; i++) { glPushMatrix(); glTranslatef(moonInfo[i].x, 0.f, moonInfo[i].z); glScalef(moonInfo[i].radius, moonInfo[i].radius, moonInfo[i].radius); moons[i].draw(); glPopMatrix(); } // Draw rings glPushMatrix(); glTranslatef(ringInfo.x, 0.f, ringInfo.z); glScalef(ringInfo.radius, ringInfo.radius, ringInfo.radius); ring.draw(); glPopMatrix(); // send the current image to the screen - any drawing after here will not display glutSwapBuffers(); }
void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the screen - any drawing before here will not display glLoadIdentity(); // set up the camera here camera.setCamera(); // Draw the world world.drawSkybox(camera); world.drawSaturn(); world.drawMoons(); world.drawRings(camera); // send the current image to the screen - any drawing after here will not display glutSwapBuffers(); }
void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the screen - any drawing before here will not display glLoadIdentity(); // set up the camera here camera.setCamera(); // camera is set up - any drawing before here will display incorrectly drawOrientationCube(); glColor3f(0.75f, 0.75f, 0.75f); glutSolidSphere(0.5, 20, 15); // send the current image to the screen - any drawing after here will not display glutSwapBuffers(); }