示例#1
0
文件: game.c 项目: rlt3/fast
void
display_essentials(struct Game *game)
{
  display_stars(game);
  display_asteroids(game);
  display_player(game);
}
示例#2
0
void display(void)
{
 GLfloat postition[]={0.0,0.0,1.5,1.0};
 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
 glColor3f(1.0,0.5,0.0);
 glPushMatrix();
 glRotatef((GLfloat)z,1.0,1.0,1.0);
 
 glDisable(GL_LIGHTING);
 glutSolidSphere(0.8,40,16);
 glPopMatrix();
 glPushMatrix();
 
 glDisable(GL_LIGHTING);
 glEnable(GL_LIGHTING);
 glColor3f(1.5,0.5,0.0);
 glutSolidTorus(0.2,0.9,6,20);
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)M,0.0,1.0,0.0);
 glTranslatef(1.5,0.0,0.0);
 glRotatef((GLfloat)m,0.0,1.0,0.0);
 glColor3f(1.0,0.0,0.0);
 glutSolidSphere(0.2,20,8);
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)V,0.0,1.0,0.0);
 glTranslatef(2.0,0.0,1.0);
 glRotatef((GLfloat)v,0.0,1.0,0.0);
 glColor3f(7.5,9.5,1.0);
 glutSolidSphere(0.2,20,8);
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)E,0.0,1.0,0.0);
 glTranslatef(3.5,0.0,0.0);
 glRotatef((GLfloat)e,0.0,1.0,0.0);
 glColor3f(0.1,6.5,2.0);
 glutSolidSphere(0.2,20,8);
 glRotatef((GLfloat)X,0.0,1.0,0.0);
 glTranslatef(0.3,0.2,0.0);
 glColor3f(4.3,3.5,8.0);
 glutSolidSphere(0.1,20,14);
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)R,0.0,1.0,0.0);
 glTranslatef(5.0,0.0,3.0);
 glRotatef((GLfloat)r,0.0,1.0,0.0);
 glColor3f(1.0,2.0,0.0);
 glutSolidSphere(0.2,20,8);
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)J,0.0,1.0,0.0);
 glTranslatef(-2.5,0.0,1.0);
 glRotatef((GLfloat)j,0.0,1.0,0.0);
 glColor3f(0.9,0.7,0.3);
 glutSolidSphere(0.2,20,8);
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)S,0.0,1.0,0.0);
 glTranslatef(-5.0,0.0,0.0);
// gluLookAt(0.0,10.0,2.0,1.0,0.0,0.0,0.0,1.0,0.0);
 glRotatef((GLfloat)s,0.0,0.0,5.0);
 glColor3f(4.5,0.5,0.0);
 glutSolidSphere(0.5,20,16);
 int i=0;
 glBegin(GL_QUAD_STRIP);
 for(i=0;i<=360;i++)
 {
   glVertex3f(sin(i*3.1416/180)*0.5,cos(i*3.1416/180)*0.5,0);
   glVertex3f(sin(i*3.1416/180)*0.7,cos(i*3.1416/180)*0.7,0);
 }
 glEnd();
 glPopMatrix();
 glPushMatrix();
 glRotatef((GLfloat)U,0.0,1.0,0.0);
 glTranslatef(-6.5,0.0,0.0);
 //gluLookAt(10.0,0.0,0.0,0.0,0.0,0.0,0.0,10.0,1.0);
 glRotatef((GLfloat)u,0.0,0.0,5.0);
 glColor3f(1.2,0.0,0.2);
 glutSolidSphere(0.5,20,16);
 glBegin(GL_QUAD_STRIP);
 for(i=0;i<=360;i++)
 {
  glVertex3f(sin(i*3.1416/180)*0.5,cos(i*3.1416/180)*0.5,0);
  glVertex3f(sin(i*3.1416/180)*0.7,cos(i*3.1416/180)*0.7,0);
 }
glEnd();
glPopMatrix();
glPushMatrix();
glRotatef((GLfloat)N,0.0,1.0,0.0);
glTranslatef(-8.0,0.0,0.0);
glRotatef((GLfloat)n,0.0,1.0,0.0);
glColor3f(1.0,2.0,0.0);
glutSolidSphere(0.4,20,8);
glPopMatrix();
glPushMatrix();
glRotatef((GLfloat)M,0.0,1.0,0.0);
glTranslatef(1.5,0.0,0.0);
glRotatef((GLfloat)m,0.0,1.0,0.0);
glColor3f(1.0,0.0,0.0);
glutSolidSphere(0.2,20,8);
glPopMatrix();
glPushMatrix();
glRotatef((GLfloat)c,6.0,-14.0,-6.0);
glTranslatef(5.0,3.0,-1.0);
glScalef(0.60,0.0,2.5);
glColor3f(7.5,9.5,2.0);
glutSolidSphere(0.2,12,6);
glPopMatrix();
glPushMatrix();

glTranslatef(0,0,-8);
glScalef(0.3,0.3,0.3);
glutSolidSphere(0.1, 16,16);

glTranslatef(7,-9,14);

glutSolidSphere(0.1, 16,16);

glTranslatef(-8,11,6);

glutSolidSphere(0.1, 16,16);

glTranslatef(15,14,-14);

glutSolidSphere(0.1, 16,16);

glTranslatef(.20,.36,.9);

glutSolidSphere(0.1, 16,16);

glPopMatrix();

display_stars();
glutSwapBuffers();
}