//Called to update the display. //You should call glutSwapBuffers after all of your rendering to display what you rendered. //If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function. void display() { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glutil::MatrixStack currMatrix; currMatrix.Translate(glm::vec3(0.0f, 0.0f, -200.0f)); currMatrix.RotateX(g_angles.fAngleX); DrawGimbal(currMatrix, GIMBAL_X_AXIS, glm::vec4(0.4f, 0.4f, 1.0f, 1.0f)); currMatrix.RotateY(g_angles.fAngleY); DrawGimbal(currMatrix, GIMBAL_Y_AXIS, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f)); currMatrix.RotateZ(g_angles.fAngleZ); DrawGimbal(currMatrix, GIMBAL_Z_AXIS, glm::vec4(1.0f, 0.3f, 0.3f, 1.0f)); glUseProgram(theProgram); currMatrix.Scale(3.0, 3.0, 3.0); currMatrix.RotateX(-90); //Set the base color for this object. glUniform4f(baseColorUnif, 1.0, 1.0, 1.0, 1.0); glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(currMatrix.Top())); g_pObject->Render("tint"); glUseProgram(0); glutSwapBuffers(); }
void AscentApMfd::UpdatePg_Gbl (oapi::Sketchpad *skp) { double pitch, yaw; int i; int s2 = W/16; int s1 = s2*2; int cx = W/2; int cy = ch*3+s1; int ssme_cx[3] = {(2*W)/10, (8*W)/10, cx}; int ssme_cy[3] = {cy+(3*s1)/2, cy+(3*s1)/2, cy}; skp->SetTextAlign (oapi::Sketchpad::CENTER); skp->Text (W/2, cy-s1-(3*ch)/2, "Gimbal SSME", 11); for (i = 0; i < 3; i++) { ap->GetVessel()->GetSSMEGimbalPos (i, pitch, yaw); DrawGimbal (skp, ssme_cx[i], ssme_cy[i], pitch, yaw); } if (ap->GetVessel()->status < 2) { int srb_cy = H-s1-ch; int srb_cx[2] = {(2*W)/10, (8*W)/10}; skp->Line (0, srb_cy-s1-ch*2, W, srb_cy-s1-ch*2); skp->Text (W/2, srb_cy-s1-(3*ch)/2, "Gimbal SRB", 10); for (i = 0; i < 2; i++) { ap->GetVessel()->GetSRBGimbalPos (i, pitch, yaw); DrawGimbal (skp, srb_cx[i], srb_cy, pitch, yaw); } } }