void drawing() { glLightModelfv(GL_LIGHT_MODEL_AMBIENT,SUNLIGHT_MODEL_AMBIENT); glEnable(GL_LIGHTING); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(50, 1.5, 1.5, 10000.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(EYE1, EYE2, EYE3, 0, 0, 0, 0.0, 1.0, 0.020); drawAllPlanets(); glDisable(GL_LIGHTING); glutSwapBuffers(); glFlush(); }
static void DrawCube(void) { if (guss == 99){ } else if (gCharacter[0].patt_found){ glPushMatrix(); //Applying // coordinate transformation matrix arglCameraViewRH(gCharacter[0].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScalef(7.8, 4.8, 4.8); //glTranslated(3, 0, -30); //glRotated(90, 1, 0, 0); //sky(); //glTranslated(-3, 0, 20); //glScalef(xx, yy, z); //drawElephant2(); if (wire){ OnDraw(); } else OnDraw1(); glPopMatrix(); glPopMatrix(); if (skyflag){ } //FSOUND_Stream_Play(0, g_mp3_stream1); //PlaySound(data1, NULL, SND_ASYNC | SND_NOSTOP );*/ } else if (gCharacter[4].patt_found){ glPushMatrix(); //Applying // coordinate transformation matrix arglCameraViewRH(gCharacter[4].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); //sky(); glTranslated(-3, 0, 20); glScalef(xx, yy, z); //drawElephant2(); FSOUND_Stream_Play(0, g_mp3_stream1); //PlaySound(data1, NULL, SND_ASYNC | SND_NOSTOP );*/ } else if(gCharacter[1].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[1].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, LIGHT_MODEL_AMBIENT); glEnable(GL_LIGHTING); //gluPerspective(60.0, ASPECT_RATIO, 0.2, 100.0); gluLookAt(LOOK_AT_POSITION[0] + ViewerDistance * sin(viewerZenith) * sin(viewerAzimuth), LOOK_AT_POSITION[1] + ViewerDistance * cos(viewerZenith), LOOK_AT_POSITION[2] + ViewerDistance * sin(viewerZenith) * cos(viewerAzimuth), LOOK_AT_POSITION[0], LOOK_AT_POSITION[1], LOOK_AT_POSITION[2], 0.0, 1.0, 0.20); glScalef(xx, yy, z); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_NORMALIZE); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); FSOUND_Stream_Play(0, g_mp3_stream2); glRotated(90, 1, 0, 0); glScaled(2, 2, 2); UpdateLight(); drawEarthAndMoon(); drawAllPlanets(); drawSaturnRing(); drawSun(); if (blendFlag){ glEnable(GL_BLEND); glDepthMask(GL_FALSE); glBlendFunc(GL_SRC_COLOR, GL_ONE); } if (particleFlag) drawAllParticles(); glDepthMask(GL_TRUE); glDisable(GL_BLEND); glDisable(GL_LIGHTING); //drawElephant(); //glTranslated(0, 0, -2); glPopMatrix(); glPopMatrix(); //OnDraw2(); } else if (gCharacter[3].patt_found) { glPushMatrix(); arglCameraViewRH(gCharacter[3].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, LIGHT_MODEL_AMBIENT); glEnable(GL_LIGHTING); //gluPerspective(60.0, ASPECT_RATIO, 0.2, 100.0); gluLookAt(LOOK_AT_POSITION[0] + ViewerDistance * sin(viewerZenith) * sin(viewerAzimuth), LOOK_AT_POSITION[1] + ViewerDistance * cos(viewerZenith), LOOK_AT_POSITION[2] + ViewerDistance * sin(viewerZenith) * cos(viewerAzimuth), LOOK_AT_POSITION[0], LOOK_AT_POSITION[1], LOOK_AT_POSITION[2], 0.0, 1.0, 0.020); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glEnable(GL_NORMALIZE); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTranslated(0, 0, 0); glScalef(xx, yy, z); UpdateLight(); glRotated(90, 1, 0, 0); drawOne(); glDepthMask(GL_TRUE); glDisable(GL_BLEND); glDisable(GL_LIGHTING); guss1 = 1; glPopMatrix(); glPopMatrix(); } /* if (gCharacter[4].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[4].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScaled(xx, yy, z); glColor3d(1, 1, 1); glBegin(GL_QUADS); glVertex2f(-3, 3); glVertex2f(-3, -3); glVertex2f(3, -3); glVertex2f(3, 3); glEnd(); glPopMatrix(); glPushMatrix(); glTranslated(0, 0, 2); glScaled(25, 25, 25); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); glPopMatrix(); glPopMatrix(); //printf("found"); } if (gCharacter[5].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[5].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScaled(xx, yy, z); glColor3d(1, 1, 1); glBegin(GL_QUADS); glVertex2f(-3, 3); glVertex2f(-3, -3); glVertex2f(3, -3); glVertex2f(3, 3); glEnd(); glPopMatrix(); glPushMatrix(); glTranslated(0, 0, 2); glScaled(25, 25, 25); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); glPopMatrix(); glPopMatrix(); //printf("found"); }*/else if (gCharacter[5].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[6].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScalef(13, 13, 13); glColor3f(1, 1, 1); glTranslated(-10, 0, 0); cube(); FSOUND_Stream_Play(0, g_mp3_stream16); glPopMatrix(); glPopMatrix(); } /* if (gCharacter[7].patt_found){ glPushMatrix(); arglCameraViewRH(gCharacter[7].trans, m, gViewScaleFactor); glLoadMatrixd(m); glPushMatrix(); glScaled(xx, yy, z); glColor3d(1, 1, 1); glBegin(GL_QUADS); glVertex2f(-3, 3); glVertex2f(-3, -3); glVertex2f(3, -3); glVertex2f(3, 3); glEnd(); glPopMatrix(); if (pause){ glPushMatrix(); glTranslated(0, 0, 2); glScaled(25, 25, 25); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 0.0f); glEnd(); glPopMatrix(); } else if (!pause){ glPushMatrix(); glScaled(8, 8, 8); glTranslated(0, -1 , 3); glRotated(90, 0, 0, 1); glColor3d(0, 1, 1); glBegin(GL_QUADS); glVertex2f(-0.6, 3); glVertex2f(-0.6, -3); glVertex2f(0.6, -3); glVertex2f(0.6, 3); glEnd(); glPopMatrix(); glPushMatrix(); glScaled(8, 8, 8); glTranslated(0, 1 , 3); glRotated(90, 0, 0, 1); glColor3d(0, 1, 1); glBegin(GL_QUADS); glVertex2f(-0.6, 3); glVertex2f(-0.6, -3); glVertex2f(0.6, -3); glVertex2f(0.6, 3); glEnd(); glPopMatrix(); } glPopMatrix(); }*/ }