void displayFcn(void) {
	glClear(GL_COLOR_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(x0, yO, z0, 0, 0, 0, 0, 1, 0);
	glColor3f(color[0], color[1], color[2]);

	if (toggle)
		glRotatef(rotTheta += 3, 0.0, 1.0, 0.0);
	glScalef(scale, scale, scale);

	if (solid) {
		switch (poly) {
		case 1:
			glutSolidCube(1.0);
			break;
		case 2:
			glutSolidDodecahedron();
			break;
		case 3:
			glutSolidTetrahedron();
			break;
		case 4:
			glutSolidOctahedron();
			break;
		case 5:
			glutSolidIcosahedron();
			break;
		case 6:
			glutSolidIcosahedron();
			break;
		}
	}
	else {
		switch (poly) {
		case 1:
			glutWireCube(1.0);
			break;
		case 2:
			glutWireDodecahedron();
			break;
		case 3:
			glutWireTetrahedron();
			break;
		case 4:
			glutWireOctahedron();
			break;
		case 5:
			glutWireIcosahedron();
			break;
		case 6:
			glutWireIcosahedron();
			break;
		}
	}
	glPopMatrix();
	glutSwapBuffers();
	glFlush();
}
示例#2
0
void 
display(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();
    glScalef(1.3, 1.3, 1.3);
    glRotatef(20.0, 1.0, 0.0, 0.0);

    glPushMatrix();
    glTranslatef(-0.75, 0.5, 0.0);
    glRotatef(90.0, 1.0, 0.0, 0.0);
    glutSolidTorus(0.275, 0.85, 10, 15);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(-0.75, -0.5, 0.0);
    glRotatef(270.0, 1.0, 0.0, 0.0);
    glutSolidTetrahedron();
    glPopMatrix();

    glPushMatrix();
    glTranslatef(0.75, 0.0, -1.0);
    glutSolidIcosahedron();
    glPopMatrix();

    glPopMatrix();
    glFlush();
}
示例#3
0
void
drawObject(void *context)
{
        static GLfloat xplane[4] = { 1, 0, 0, 0 };
        static GLfloat zplane[4] = { 0, 1, 0, 0 };

        if (!cullBackFaces) {
                glEnable(GL_CULL_FACE);
                glCullFace(GL_FRONT);
        }

	glPushMatrix();
                glTranslatef(obj[0], obj[1], obj[2]);
                if (doSphereMap) {
		        glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
		        glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
		        glEnable(GL_TEXTURE_GEN_S);
		        glEnable(GL_TEXTURE_GEN_T);
		        glEnable(GL_TEXTURE_2D);
		        glBindTexture(GL_TEXTURE_2D, 7);
		        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
			GL_REPLACE);
                } else {
                        glTexGenfv(GL_S, GL_OBJECT_PLANE, xplane);
                        glTexGenfv(GL_T, GL_OBJECT_PLANE, zplane);
                        glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
                        glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
                        glEnable(GL_TEXTURE_GEN_S);
		        glEnable(GL_TEXTURE_GEN_T);
		        glEnable(GL_TEXTURE_2D);
                        glBindTexture(GL_TEXTURE_2D, 100);
                        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
			GL_REPLACE);
                }

		glColor3f(1.0, 1.0, 1.0);
		switch (object) {
		case 0:
			glutSolidSphere(3.0, 20, 20);
			break;
		case 1:
			glScalef(3.0, 3.0, 3.0);
			glRotatef(30.0, 1.0, 1.0, 0.0);
			glutSolidIcosahedron();
			break;
		case 2:
			glFrontFace(GL_CW);
			glutSolidTeapot(3.0);
			glFrontFace(GL_CCW);
			break;
		}

	        glDisable(GL_TEXTURE_GEN_S);
       		glDisable(GL_TEXTURE_GEN_T);
	glPopMatrix();

        if (!cullBackFaces) {
                glCullFace(GL_BACK);
        }
}
void blender()
{
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutCreateWindow("blender");
	glutDisplayFunc(displaycc);
	glutVisibilityFunc(visible);
	glNewList(1, GL_COMPILE);
	glutSolidIcosahedron();
	glEndList();
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
	glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
	glLightfv(GL_LIGHT2, GL_DIFFUSE, light2_diffuse);
	glLightfv(GL_LIGHT2, GL_POSITION, light2_position);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_LINE_SMOOTH);
	glLineWidth(2.0);
	glMatrixMode(GL_PROJECTION);
	gluPerspective( /* field of view in degree */ 40.0,/* aspect ratio */ 1.0,/* Z near */ 1.0, /* Z far */ 10.0);
	glMatrixMode(GL_MODELVIEW);
	gluLookAt(0.0, 0.0, 5.0,/* eye is at (0,0,5) */0.0, 0.0, 0.0, /* center is at (0,0,0) */0.0, 1.0, 0.); /* up is in positive Y direction */
	glTranslatef(0.0, 0.6, -1.0);
	glutMouseFunc(clickx);
	glutMainLoop();
}
示例#5
0
void
render(void)
{
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective( /* field of view in degree */ 30.0,
  /* aspect ratio */ 1.0,
    /* Z near */ 1.0, /* Z far */ 20.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(0.0, 0.0, 10.0,  /* eye is at (0,0,5) */
    0.0, 0.0, 0.0,      /* center is at (0,0,0) */
    0.0, 1.0, 0.);      /* up is in postivie Y direction */

  glPushMatrix();
  glRotatef(angle, 1.0, 0.3, 0.0);
  switch (shape) {
  case M_TORUS:
    glutSolidTorus(0.275, 0.85, 8, 8);
    break;
  case M_CUBE:
    glutSolidCube(1.0);
    break;
  case M_SPHERE:
    glutSolidSphere(1.0, 10, 10);
    break;
  case M_ICO:
    glutSolidIcosahedron();
    break;
  case M_TEAPOT:
    glutSolidTeapot(1.0);
    break;
  }
  glPopMatrix();
}
示例#6
0
/* Initialize material property and light source. */
void
myinit(void)
{
  GLfloat light_ambient[] =
  {0.2, 0.2, 0.2, 1.0};
  GLfloat light_diffuse[] =
  {1.0, 1.0, 1.0, 1.0};
  GLfloat light_specular[] =
  {1.0, 1.0, 1.0, 1.0};
  GLfloat light_position[] =
  {1.0, 1.0, 1.0, 0.0};

  glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
  glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
  glLightfv(GL_LIGHT0, GL_POSITION, light_position);

  glEnable(GL_LIGHT0);
  glDepthFunc(GL_LESS);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHTING);

  glSelectBuffer(BUFSIZE, selectBuf);

  glNewList(TORUS, GL_COMPILE);
  glutSolidTorus(0.275, 0.85, 10, 15);
  glEndList();
  glNewList(TETRAHEDRON, GL_COMPILE);
  glutSolidTetrahedron();
  glEndList();
  glNewList(ICOSAHEDRON, GL_COMPILE);
  glutSolidIcosahedron();
  glEndList();
}
示例#7
0
static void
drawModel(void)
{
  switch(currentModel) {
  case MOD_DINO:
    drawDinosaur();
    break;
  case MOD_SPHERE:
    glMaterialfv(GL_FRONT, GL_DIFFUSE, blueMaterial);
    glutSolidSphere(6.0, 15, 15);
    break;
  case MOD_CUBE:
    glMaterialfv(GL_FRONT, GL_DIFFUSE, redMaterial);
    glutSolidCube(6.0);
    break;
  case MOD_ICO:
    glMaterialfv(GL_FRONT, GL_DIFFUSE, purpleMaterial);
    glPushMatrix();
      glEnable(GL_NORMALIZE);
      glScalef(7.0, 7.0, 7.0);
      glutSolidIcosahedron();
      glDisable(GL_NORMALIZE);
    glPopMatrix();
    break;
  }
}
示例#8
0
void drawHead() {
	glColor3f (1.0, 1.0, 0.0);
	glScalef (HeadR, HeadR, HeadR);
	glutSolidIcosahedron();
	glColor3f (0.0, 0.0, 0.0);
	glScalef (1.01, 1.01, 1.01);
	glutWireIcosahedron();
}
示例#9
0
void
drawView(int drawCenterObject)
{
	/* right green small cube (+5,0,-8) */
	glPushMatrix();
	  glTranslatef(5.0, 0.0, -8.0);
	  glRotatef(-45, 1.0, 0.0, 1.0);
	  glColor3f(0.0, 1.0, 0.0);
	  glutSolidCube(2.0);
	glPopMatrix();
	/* left red cube (-5,0,-8) */
	glPushMatrix();
	  glTranslatef(-5.0, 0.0, -8.0);
	  glRotatef(45, 1.0, 0.0, 1.0);
	  glColor3f(1.0, 0.0, 0.0);
	  glutSolidCube(6.0);
	glPopMatrix();
	/* left blue cube (-7,0,0); */
	glPushMatrix();
	  glTranslatef(-7.0, 0.0, 0.0);
	  glColor3f(0.0, 0.0, 1.0);
	  glutSolidCube(5.0);
	glPopMatrix();
	/* right cyan big cube (+7,0,0) */
	glPushMatrix();
	  glTranslatef(7.0, 0.0, 0.0);
	  glRotatef(30, 1.0, 1.0, 0.0);
	  glColor3f(0.0, 1.0, 1.0);
	  glutSolidCube(5.0);
	glPopMatrix();
	/* distant yellow sphere (0,0,+10) */
	glPushMatrix();
	  glTranslatef(0.0, 0.0, 10.0);
	  glColor3f(1.0, 1.0, 0.0);
	  glutSolidSphere(7.0, 8, 8);
	glPopMatrix();
	/* top white sphere (0,+5,0) */
	glPushMatrix();
	  glTranslatef(0.0, 5.0, 0.0);
	  glColor3f(1.0, 1.0, 1.0);
	  glutSolidSphere(2.0, 8, 8);
	glPopMatrix();
	/* bottom magenta big sphere (0,-6,0) */
	glPushMatrix();
	  glTranslatef(0.0, -6.0, 0.0);
	  glColor3f(1.0, 0.0, 1.0);
	  glutSolidSphere(4.0, 8, 8);
	glPopMatrix();

	if (drawCenterObject) {
		glPushMatrix();
			glScalef(3.0, 3.0, 3.0);
			glColor3f(1.0, 1.0, 1.0);
			glutSolidIcosahedron();
		glPopMatrix();
	}
}
void prisma(){
glPushMatrix();
glEnable(GL_COLOR_MATERIAL);
glTranslated(0.0,0.0,0.0);
glScaled(0.45,0.45,0.45);
glutSolidIcosahedron();
glDisable(GL_COLOR_MATERIAL);
glPopMatrix();
}
示例#11
0
void 
display(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glScalef(1.3, 1.3, 1.3);
  glRotatef(20.0, 1.0, 0.0, 0.0);
  glPushMatrix();
  glTranslatef(-0.65, 0.7, 0.0);
  glRotatef(90.0, 1.0, 0.0, 0.0);
  glCallList(TORUS_MATERIAL);
  glutSolidTorus(0.275, 0.85, 10, 15);
  glPopMatrix();
  glPushMatrix();
  glTranslatef(-0.75, -0.8, 0.0);
  glCallList(TEAPOT_MATERIAL);
  glutSolidTeapot(0.7);
  glPopMatrix();
  glPushMatrix();
  glTranslatef(1.0, 0.0, -1.0);
  glCallList(ICO_MATERIAL);
  glutSolidIcosahedron();
  glPopMatrix();
  glPopMatrix();
  glPushAttrib(GL_ENABLE_BIT);
  glDisable(GL_DEPTH_TEST);
  glDisable(GL_LIGHTING);
  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  gluOrtho2D(0, 3000, 0, 3000);
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();
  output(80, 2800, "Torus: %s", torus_material);
  output(80, 2650, "Icosahedron: %s", ico_material);
  output(80, 2500, "Teapot: %s", teapot_material);
  output(80, 250, "Left light: %s", left_light);
  output(1700, 250, "Right light: %s", right_light);
  output(850, 100, "Shade model: %s",
    shade_model == GL_SMOOTH ? "smooth" : "flat");
  glPopMatrix();
  glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  glPopAttrib();
  glutSwapBuffers();
}
示例#12
0
文件: npglut.c 项目: openantz/antz
//------------------------------------------------------------------------------
void npGlutPrimitive (int primitive)
{
	switch (primitive)
	{
	case kNPgeoCubeWire :
		glScalef (0.6f, 0.6f, 0.6f); 
		glutWireCube(2.0f);
		glScalef (1.666667f, 1.666667f, 1.666667f);
		break;
	case kNPgeoCube :
		glScalef (0.6f, 0.6f, 0.6f);
		glutSolidCube(2.0f);
		glScalef (1.666667f, 1.666667f, 1.666667f);
		break;
	case kNPgeoSphereWire : glutWireSphere( 1.0f, 24, 12); break;//15, 15 ); break;
	case kNPgeoSphere : glutSolidSphere( 1.0f, 24, 12 ); break;

	case kNPgeoConeWire : glutWireCone( 1.0f, 2.0f, 24, 1 ); break;
	case kNPgeoCone : glutSolidCone( 1.0f, 2.0f, 24, 1 ); break;

	case kNPgeoTorusWire : glutWireTorus(kNPtorusRadius * 0.1f, kNPtorusRadius, 7, 16); break;
	case kNPgeoTorus : glutSolidTorus(kNPtorusRadius * 0.1f, kNPtorusRadius, 7, 16); break;

	case kNPgeoDodecahedronWire :
		glScalef (0.6f, 0.6f, 0.6f);
		glutWireDodecahedron();
		glScalef (1.666667f, 1.666667f, 1.666667f);
		break;
	case kNPgeoDodecahedron :
		glScalef (0.6f, 0.6f, 0.6f);
		glutSolidDodecahedron();
		glScalef (1.666667f, 1.666667f, 1.666667f);
		break;
	case kNPgeoOctahedronWire : glutWireOctahedron(); break;
	case kNPgeoOctahedron : glutSolidOctahedron(); break;
	case kNPgeoTetrahedronWire : glutWireTetrahedron(); break;
	case kNPgeoTetrahedron : glutSolidTetrahedron(); break;
	case kNPgeoIcosahedronWire : glutWireIcosahedron(); break;
	case kNPgeoIcosahedron : glutSolidIcosahedron(); break;

//	case kNPglutWireTeapot : glutWireTeapot( 2.0f ); break;
//	case kNPglutSolidTeapot : glutSolidTeapot( 2.0f ); break;

	default : glutWireTetrahedron(); break;
	}
}
示例#13
0
int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutCreateWindow("blender");
  glutDisplayFunc(display);
  glutVisibilityFunc(visible);

  glNewList(1, GL_COMPILE);  /* create ico display list */
  glutSolidIcosahedron();
  glEndList();

  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
  glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
  glLightfv(GL_LIGHT2, GL_DIFFUSE, light2_diffuse);
  glLightfv(GL_LIGHT2, GL_POSITION, light2_position);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_CULL_FACE);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_LINE_SMOOTH);
  glLineWidth(2.0);

  glMatrixMode(GL_PROJECTION);
  gluPerspective( /* field of view in degree */ 40.0,
  /* aspect ratio */ 1.0,
    /* Z near */ 1.0, /* Z far */ 10.0);
  glMatrixMode(GL_MODELVIEW);
  gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.);      /* up is in positive Y direction */
  glTranslatef(0.0, 0.6, -1.0);

  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
示例#14
0
//-------------------------------------------------------------------------
//  Draws our object.
//-------------------------------------------------------------------------
void drawObject ()
{
    //  Draw the object only if the Draw check box is selected
    if (draw)
    {
        //  Push the current matrix into the model view stack
        glPushMatrix ();

        //  Apply the translation
        glTranslatef (translate_xy[0], translate_xy[1], -translate_z);

        //  Apply the rotation matrix
        glMultMatrixf (rotation_matrix);

        //  Apply the scaling
        glScalef (scale, scale, scale);

        //  Get the id of the selected object
        int selected_object = (radiogroup_item_id * 2) + 1 - wireframe;

        switch (selected_object)
        {
            //  draw glut wire cube
            case GLUT_WIRE_CUBE:
                
                glutWireCube (0.5);

                break;
            //  draw glut solid cube
            case GLUT_SOLID_CUBE:
                
                glutSolidCube (0.5);

                break;
            //  draw glut wire sphere
            case GLUT_WIRE_SPHERE:

                glutWireSphere (0.5, 50, 50);

                break;
            //  draw glut solid sphere
            case GLUT_SOLID_SPHERE:

                glutSolidSphere (0.5, 50, 50);

                break;
            //  draw glut wire Cone
            case GLUT_WIRE_CONE:

                glutWireCone (0.5, 0.5, 50, 50);

                break;
            //  draw glut solid cone
            case GLUT_SOLID_CONE:

                glutSolidCone (0.5, 0.5, 50, 50);

                break;
            //  draw glut wire Torus
            case GLUT_WIRE_TORUS:
                
                glutWireTorus (0.15, 0.25, 20, 20);

                break;
            ///  draw glut solid Torus
            case GLUT_SOLID_TORUS:

                glutSolidTorus (0.15, 0.25, 20, 20);

                break;
            //  draw a wire dodecahedron.. The reason why I'm dividing
            //  by 2 * radical (3) when I'm scaling it because I want to fit
            //  the dodecahedron which is centered at the modeling 
            //    coordinates origin with a radius of radical (3).
            case GLUT_WIRE_DODECAHEDRON:
                
                glScalef (1 / sqrt (12), 1 / sqrt (12), 1 / sqrt (12));
                glutWireDodecahedron ();

                break;
            //  draw a solid dodecahedron
            case GLUT_SOLID_DODECAHEDRON:
                glScalef (1 / sqrt (12), 1 / sqrt (12), 1 / sqrt (12));
                glutSolidDodecahedron ();

                break;
            //  draw a wire octahedron.. The reason why I'm dividing
            //  by 2 when I'm scaling is because I want to fit
            //  the octahedron which is centered at the modeling 
            //    coordinates origin with a radius of 1.
            case GLUT_WIRE_OCTAHEDRON:
                
                glScalef (0.5, 0.5, 0.5);
                glutWireOctahedron ();

                break;
            //  draw a solid tetrahedron
            case GLUT_SOLID_OCTAHEDRON:
                glScalef (0.5, 0.5, 0.5);
                glutSolidOctahedron ();

                break;
            //  draw a wire tetrahedron.. 
            case GLUT_WIRE_TETRAHEDRON:
                
                glScalef (1 / sqrt(6), 1 / sqrt(6), 1 / sqrt(6));
                glutWireTetrahedron ();

                break;
            //  draw a solid tetrahedron
            case GLUT_SOLID_TETRAHEDRON:
                glScalef (1 / sqrt(6), 1 / sqrt(6), 1 / sqrt(6));
                glutSolidTetrahedron ();

                break;
            //  draw a wire icosahedron.. The reason why I'm dividing
            //  by 2 when I'm scaling is because I want to fit
            //  the icosahedron which is centered at the modeling 
            //    coordinates origin with a radius of 1.
            case GLUT_WIRE_ICOSAHEDRON:
                
                glScalef (0.5, 0.5, 0.5);
                glutWireIcosahedron ();

                break;
            //  draw a solid icosahedron
            case GLUT_SOLID_ICOSAHEDRON:
                glScalef (0.5, 0.5, 0.5);
                glutSolidIcosahedron ();

                break;
            //  draw Wire Teapot
            case GLUT_WIRE_TEAPOT:
                
                glutWireTeapot (0.5);

                break;
            //  draw a solid Teapot
            case GLUT_SOLID_TEAPOT:

                glutSolidTeapot (0.5);

                break;
            //  Do Nothing
            default:
                break;
        }

        //  Pop our matrix from the model view stack after we finish drawing
        glPopMatrix ();
    }
}
示例#15
0
文件: nave.c 项目: mikedm195/Graficas
void display(void){//Crea la nave
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	GLfloat mat_ambient[] = { 0.7f, 0.0f, 0.0f, 0.5f };
	GLfloat mat_diffuse[] = { 0.1f, 0.5f, 0.8f, 0.5f };
	GLfloat mat_specular[] = { 0.2f, 0.2f, 0.2f, 0.5f };
	GLfloat mat_shininess[] = { 100.0f };

	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
	//glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
	
    glPushMatrix ();
      
      glutSolidSphere (0.75, 20, 20);

	  glPushMatrix ();
         glTranslatef (0.0, 0.0, 3.0);
		 glutSolidSphere(.65,8,8);
      glPopMatrix ();

	  glRotatef (20.0, 1.0, 0.0, 0.0);

      glPushMatrix ();
         glRotatef (90.0, 0.0, 1.0, 0.0);
		 glTranslatef (0.0,0.0,0.7);
         glutSolidTorus (0.1,0.3, 15, 15);
      glPopMatrix ();

	  glPushMatrix ();
         glRotatef (90.0, 0.0, 1.0, 0.0);
		 glTranslatef (0.0,0.0,-0.7);
         glutSolidTorus (0.1,0.3, 15, 15);
      glPopMatrix ();

	  glPushMatrix ();
         glTranslatef (2.0,0.0,0.0);
		 glScalef (0.2,2.5,1.0);
         glutSolidIcosahedron ();
      glPopMatrix ();

      glPushMatrix ();
         glTranslatef (2.0, 0.0, 0.0); 
		 glScalef(0.3,1.0,1.0);
         glRotatef (-90.0, 0.0, 1.0, 0.0);
         glutSolidCone (1.0, 2.0, 15, 15);
      glPopMatrix ();

	  glPushMatrix ();
         glTranslatef (1.0,0.0, 0.0); 
		 glScalef (1.5,.4,0.6);
         glutSolidCube (1.0);
      glPopMatrix ();
	
 	  glPushMatrix ();
         glTranslatef (-2.0,0.0,0.0);
		 glScalef (0.2,2.5,1.0);
         glutSolidIcosahedron ();
      glPopMatrix ();

      glPushMatrix ();
         glTranslatef (-2.0, 0.0, 0.0); 
		 glScalef(0.3,1.0,1.0);
         glRotatef (90.0, 0.0, 1.0, 0.0);
         glutSolidCone (1.0, 2.0, 15, 15);
      glPopMatrix ();

	  glPushMatrix ();
         glTranslatef (-1.0,0.0, 0.0); 
		 glScalef (1.5,.4,0.6);
         glutSolidCube (1.0);
      glPopMatrix ();

    glPopMatrix ();
    glFlush();
}
示例#16
0
static void hugsprim_glutSolidIcosahedron_5(HugsStackPtr hugs_root)
{
    glutSolidIcosahedron();
    
    hugs->returnIO(hugs_root,0);
}
示例#17
0
static void drawSolidIcosahedron(void)         { glutSolidIcosahedron ();                        }
示例#18
0
文件: Shapes.c 项目: HintonBR/scratch
// Called to draw scene
void RenderScene(void)
	{
	// Clear the window
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


    // Save matrix state and do the rotation
	glPushMatrix();
	glRotatef(xRot, 1.0f, 0.0f, 0.0f);
	glRotatef(yRot, 0.0f, 1.0f, 0.0f);

    switch(iShape)
        {
        case 1:
            glutWireSphere(1.0f, 25, 25);
            break;

        case 2:
            glutWireCube(1.0f);
            break;

        case 3:
            glutWireCone(0.30f, 1.1f, 20, 20);
            break;

        case 4:
            glutWireTorus(0.3f, 1.0f, 10, 25);
            break;

        case 5:
            glutWireDodecahedron();
            break;

        case 6:
            glutWireOctahedron();
            break;

        case 7:
            glutWireTetrahedron();
            break;

        case 8:
            glutWireIcosahedron();
            break;

        case 9:
            glutWireTeapot(1.0f);
            break;

        case 11:
            glutSolidSphere(1.0f, 25, 25);
            break;

        case 12:
            glutSolidCube(1.0f);
            break;

        case 13:
            glutSolidCone(0.30, 1.1f, 20, 20);
            break;
    
        case 14:
            glutSolidTorus(0.3f, 1.0f, 10, 25);
            break;

        case 15:
            glutSolidDodecahedron();
            break;

        case 16:
            glutSolidOctahedron();
            break;

        case 17:
            glutSolidTetrahedron();
            break;

        case 18:
            glutSolidIcosahedron();
            break;

        default:
            glutSolidTeapot(1.0f);
            break;
        }


	// Restore transformations
	glPopMatrix();

	// Flush drawing commands
	glutSwapBuffers();
	}
示例#19
0
void DisplayFunc(void)
{
 double xfactor=1.0, yfactor=1.0;
 double Eye =0.0;
 int i;

 if(ps.w < ps.h)
 {
  xfactor = 1.0;
  yfactor = ps.h/ps.w;
 }
 else if(ps.h < ps.w)
 {
  xfactor = ps.w/ps.h;
  yfactor = 1.0;
 }

 glClear(GL_COLOR_BUFFER_BIT);
 for(i=0;i<2;i++)
 {
  glEnable(GL_LIGHT0 + i);
  glClear(GL_DEPTH_BUFFER_BIT);
  if(i==0) /* left eye - RED */
  {
   Eye = ps.eye;
   glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_TRUE);
  }
  else /* if(i==1) right eye - BLUE */
  {
   Eye = -ps.eye;
   glColorMask(GL_FALSE,GL_FALSE,GL_TRUE,GL_TRUE);
  }

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(
   (-(ps.w/(2.0*PIXELS_PER_INCH))+Eye) *(ps.znear/ps.zscreen)*xfactor,
   (ps.w/(2.0*PIXELS_PER_INCH)+Eye)    *(ps.znear/ps.zscreen)*xfactor,
   -(ps.h/(2.0*PIXELS_PER_INCH))*(ps.znear/ps.zscreen)*yfactor,
   (ps.h/(2.0*PIXELS_PER_INCH))*(ps.znear/ps.zscreen)*yfactor,
   ps.znear, ps.zfar);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(Eye,0.0,0.0);
  glTranslated(0,0,-ps.zscreen);

  switch(ps.solidmode)
  {
  case 1:
   {
    glTranslated(cos(ps.RotationY*M_PI/180.0),
     0, -sin(ps.RotationY*M_PI/180.0) );
    glRotated(ps.RotationY, 0.0,0.1,0.0);
    glPushMatrix();
     glScalef(0.5,0.5,0.5);
     glutSolidDodecahedron();
    glPopMatrix();
    break;
   }
  case 2:
   {
    glTranslated(cos(ps.RotationY*M_PI/180.0),
     0, -sin(ps.RotationY*M_PI/180.0) );
    glRotated(ps.RotationY, 0.0,0.1,0.0);
    glutSolidIcosahedron();
    break;
   }
  case 3:
   {
    glRotated(60.0, 1 , 0, 0);
    glTranslated(cos(ps.RotationY*M_PI/180.0),
     0, -sin(ps.RotationY*M_PI/180.0) );
    glRotated(ps.RotationY, 0.0,0.1,0.0);
    glutSolidTeapot(1.0);
    break;
   }
  case 4:
   {
    double SunRadius = 0.2;
    double SunToEarth = 1.0;
    double EarthRadius = 0.15;

    glutSolidSphere(SunRadius, 20, 16);   /* draw sun */
    glRotated(60.0, 1 , 0, 0);
    glPushMatrix();
     glRotated(90.0, 1 , 0, 0);
     glutSolidTorus(0.01,SunToEarth, 10,50);
    glPopMatrix();
    glRotated(ps.RotationY, 0.0,0.1,0.0);
    glTranslatef (SunToEarth, 0.0, 0.0);
    glutSolidSphere(EarthRadius, 10, 8);    /* draw earth */
    break;
   }
  }
  glDisable(GL_LIGHT0 + i);
 }
 glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
 glutSwapBuffers();
}
示例#20
0
文件: lua_glut.c 项目: lubyk/glut
/** SolidIcosahedron () -> None
 */
static int glut_solid_icosahedron(lua_State *L) {
  glutSolidIcosahedron();
}
示例#21
0
/*
		Desenare satelit
*/
int Satellite::drawSatellite(){

	
	glNormal3f(0,1,0);
	glTranslatef(posx, posy, posz);
	
	//daca nu e de tip power up
	if(bonus == false)
	{
	//daca nu explodeaza deseneaza cu culoarea obisnuita 
	if(explodes == false  )
	{
		
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,color);
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
	
	
	}
	//daca explodeaza se folosesc culorile pt explozie
	if(explodes == true)
	{
	
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient4f1.Array());
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse4f1.Array());
	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular4f1.Array());
	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess1);
	}
	//scalare 
	glScalef(Size-1, Size-1, Size-1);
	//rotire in jurul axelor ox si oz
	glRotatef(spin, 0, spin/2.0,0);	
	//setare tipa asteroid => icoshaedron/dodecahedron
	if(type == ICOS)glutSolidIcosahedron();
	else glutSolidDodecahedron();
	//desenare inele satelit
	glRotatef(90,1,0,0);
	glRotatef(spin, 0, spin/2.0,0);	
		glutSolidTorus(0.05,2.2,20,20);
		glutSolidTorus(0.05,2,20,20);
		glutSolidTorus(0.05,1.8,20,20);
	}
	//satelit bonus; acelasi mod de desenare ca la satelitii normali
	if(bonus == true)
	{
		
		
		if(explodes == false)
		{
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,Vector4D(1,0,0,1).Array());
		glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Vector4D(1,0,0,1).Array());
		glScalef(Size, Size, Size);
		glutSolidSphere(0.9,20,20);
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,Vector4D(0,0,1,1).Array());
		glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Vector4D(0,0,1,1).Array());
		
		glRotatef(90,1,0,0);
		glRotatef(spin, 0, spin/2.0,0);	
		glutSolidTorus(0.05,1.7,20,20);
		glutSolidTorus(0.05,1.4,20,20);
		glutSolidTorus(0.05,1.1,20,20);
		
		}
		if(explodes == true)
	{
	
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient4f1.Array());
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse4f1.Array());
	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular4f1.Array());
	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess1);
	glScalef(Size, Size, Size);
		glutSolidSphere(0.9,20,20);
		
		glRotatef(90,1,0,0);
		glRotatef(spin, 0, spin/2.0,0);
		glutSolidTorus(0.05,1.7,20,20);
		glutSolidTorus(0.05,1.4,20,20);
		glutSolidTorus(0.05,1.1,20,20);
		
	}
	
	}
	time += 0.01;
	//daca are loc explozia atunci nu se mai deplaseaza
	if(explodes == false)
	{
	posx += (v0 * time) * dx/7.0;
	posy += (v0 * time) * dy/7.0;
	posz += (v0 * time ) * dz/7.0;
	}
	//daca satelitul debaseste spatiul de joc se reseteaza parametri
	if(posx < 0 || posx > box ||
		posy < 0 || posy > box ||
		 posz > box){
			destroy();
			
			return 1;
	}
	if(explosion != NULL && explodes)
	{
		// daca satelitul explodeaza randeaza lumina pt explozie + efectul de fade out
		
		explosion->Renderexplight();
		if(counter < 100)
		{
				
			
		explosion->SetAttenuation(explosion->getAttenuation()-0.1);
		}
		else
			if(counter < 200)
		{
			
			explosion->SetAttenuation(explosion->getAttenuation()+0.05);
		}
		else
		 if(counter<300)
				{
					ambient4f1.a-=FADE;
					diffuse4f1.a-=FADE;
					specular4f1.a-=FADE;
					
				}
		if(counter<300)
		{
		counter++;

		}
		else 
			{
				explosion->Disable();
				explodes = false;
				delete explosion;

		explosion = NULL;
		destroy();
		counter=0;
		}
	}
	if(spin>360)spin =0;
	else spin+=0.5f;
	return 0;
}
示例#22
0
void
displayFunc(void)
{
  static int shape = 1;

  fprintf(stderr, " %d", shape);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  switch (shape) {
  case 1:
    glutWireSphere(1.0, 20, 20);
    break;
  case 2:
    glutSolidSphere(1.0, 20, 20);
    break;
  case 3:
    glutWireCone(1.0, 1.0, 20, 20);
    break;
  case 4:
    glutSolidCone(1.0, 1.0, 20, 20);
    break;
  case 5:
    glutWireCube(1.0);
    break;
  case 6:
    glutSolidCube(1.0);
    break;
  case 7:
    glutWireTorus(0.5, 1.0, 15, 15);
    break;
  case 8:
    glutSolidTorus(0.5, 1.0, 15, 15);
    break;
  case 9:
    glutWireDodecahedron();
    break;
  case 10:
    glutSolidDodecahedron();
    break;
  case 11:
    glutWireTeapot(1.0);
    break;
  case 12:
    glutSolidTeapot(1.0);
    break;
  case 13:
    glutWireOctahedron();
    break;
  case 14:
    glutSolidOctahedron();
    break;
  case 15:
    glutWireTetrahedron();
    break;
  case 16:
    glutSolidTetrahedron();
    break;
  case 17:
    glutWireIcosahedron();
    break;
  case 18:
    glutSolidIcosahedron();
    break;
  default:
    printf("\nPASS: test16\n");
    exit(0);
  }
  glutSwapBuffers();
  shape += 1;
  sleep(1);
  glutPostRedisplay();
}
示例#23
0
// Draw our world
void display_1(void)
{
char *p;
 
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  //Clear the screen
 
glMatrixMode (GL_PROJECTION);  // Tell opengl that we are doing project matrix work
glLoadIdentity();  // Clear the matrix
glOrtho(-8.0, 8.0, -8.0, 8.0, 0.0, 30.0);  // Setup an Ortho view
glMatrixMode(GL_MODELVIEW);  // Tell opengl that we are doing model matrix work. (drawing)
glLoadIdentity(); // Clear the model matrix
 
 
glColor3f(1.0, 1.0, 1.0);
if (shape == 0) Sprint(-3, -7 ,"Solid Cube");
if (shape == 1) Sprint(-3, -7 ,"Solid Cone");
if (shape == 2) Sprint(-3, -7 ,"Solid Sphere");
if (shape == 3) Sprint(-3, -7 ,"Solid Torus");
if (shape == 4) Sprint(-3, -7 ,"Solid Dodecahedron");
if (shape == 5) Sprint(-3, -7 ,"Solid Octahedron");
if (shape == 6) Sprint(-3, -7 ,"Solid Tetrahedron");
if (shape == 7) Sprint(-3, -7 ,"Solid Icosahedron");
if (shape == 8) Sprint(-3, -7 ,"Solid Teapot");
 
// Setup view, and print view state on screen
if (view_state == 1)
	{
    glColor3f( 1.0, 1.0, 1.0);
    Sprint(-2, 4, "Perspective view");
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60, 1, 1, 30);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    }else
	{
	glColor3f( 1.0, 1.0, 1.0);
    Sprint(-2, 4, "Ortho view");
    }
 
glColor3f( 0.0, 0.0, 1.0);  // Cube color
 
// Lighting on/off
if (light_state == 1)
	{
	glDisable(GL_LIGHTING);  // Turn off lighting
    glDisable(GL_COLOR_MATERIAL); // Turn off material, which needs lighting to work
    }else
	{
    glEnable(GL_LIGHTING); // Turn on lighting
    glEnable(GL_COLOR_MATERIAL); // Turn on material settings
    glColorMaterial(GL_FRONT, GL_AMBIENT);
    glColor4f(0.65, 0.65, 0.65, 0.4);
    glColorMaterial(GL_FRONT, GL_EMISSION);
    glColor4f(0.10, 0.10, 0.10, 0.0);
    glColorMaterial(GL_FRONT, GL_SPECULAR);
    glColor4f(0.5, 0.5, 0.5, 0.4);
    glColorMaterial(GL_FRONT, GL_DIFFUSE);
    glColor4f(0.85, 0.85, 0.85, 0.4);
    }
 
gluLookAt( 0, 0, 20, 0, 0, 0, 0, 1, 0);
 
//glRotatef( 45, 1.0, 1.0, 0.0); // rotate cube
glRotatef( spin++, 1.0, 1.0, 1.0); // spin cube
 
if (shape == 0) glutSolidCube(10); // Draw a cube
if (shape == 1) glutSolidCone(5,10, 16,16);  // Draw a Cone
if (shape == 2) glutSolidSphere(5, 16,16 );  // Draw a Sphere
if (shape == 3) glutSolidTorus( 2.5, 5, 16, 16);
if (shape == 4)
   {
	glScalef( 3.5, 3.5, 3.5);
	glutSolidDodecahedron();
   }
 
if (shape == 5)
   {
	glScalef( 5.0, 5.0, 5.0);
	glutSolidOctahedron();
   }
if (shape == 6)
   {
	glScalef( 5.0, 5.0, 5.0);
	glutSolidTetrahedron();
   }
 
if (shape == 7)
   {
	glScalef( 5.0, 5.0, 5.0);
	glutSolidIcosahedron();
   }
if (shape == 8) glutSolidTeapot( 5 );
 
glutSwapBuffers();
}
示例#24
0
int
main(int argc, char **argv)
{
  int i;

  glutInitWindowSize(400, 200);
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
  glutInit(&argc, argv);

  for (i = 1; i < argc; i++) {
    if (!strcmp("-sb", argv[i])) {
      glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE);
      singleBuffer = 1;
    }
  }

  glutCreateWindow("multilight");

  glClearColor(0.0, 0.0, 0.0, 0.0);

  glMatrixMode(GL_PROJECTION);
  gluPerspective(50.0, 2.0, 0.1, 100.0);
  glMatrixMode(GL_MODELVIEW);
  gluLookAt(
    0.0, 1.0, -16.0,
    0.0, 0.0, 0.0,
    0.0, 1.0, 0.);

  numActiveLights = MIN_VALUE(MAX_LIGHTS, 8);
  for (i = 0; i < numActiveLights; i++) {
    initLight(i);
  }

  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, modelAmb);
  glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
  glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);

  glMaterialfv(GL_FRONT, GL_AMBIENT, matAmb);
  glMaterialfv(GL_FRONT, GL_DIFFUSE, matDiff);
  glMaterialfv(GL_FRONT, GL_SPECULAR, matSpec);
  glMaterialfv(GL_FRONT, GL_EMISSION, matEmission);
  glMaterialf(GL_FRONT, GL_SHININESS, 10.0);

  glNewList(DL_LIGHT_SPHERE, GL_COMPILE);
  glutSolidSphere(0.2, 4, 4);
  glEndList();

  glNewList(DL_BIG_SPHERE, GL_COMPILE);
  glutSolidSphere(1.5, 20, 20);
  glEndList();

  glNewList(DL_ICO, GL_COMPILE);
  glutSolidIcosahedron();
  glEndList();

  glutDisplayFunc(display);
  glutVisibilityFunc(visible);
  glutKeyboardFunc(key);
  glutMouseFunc(mouse);
  glutMotionFunc(motion);

  glutCreateMenu(menu);
  glutAddMenuEntry("Sphere", M_SPHERE);
  glutAddMenuEntry("Icosahedron", M_ICO);
  glutAddMenuEntry("Linear attenuation", M_LINEAR);
  glutAddMenuEntry("Quadratic attenuation", M_QUAD);
  glutAddMenuEntry("Toggle Light Number Labels", M_LABELS);
  glutAddMenuEntry("Report Light Significance", M_REPORT_SIG);
  glutAddMenuEntry("Lambertian-based Significance", M_LAMBERTIAN);
  glutAddMenuEntry("Distance-based Significance", M_DISTANCE);
  glutAddMenuEntry("Time Frames", M_TIME);
  glutAddMenuEntry("Quit", 666);
  glutAttachMenu(GLUT_RIGHT_BUTTON);

  glutMainLoop();
  return 0;             /* ANSI C requires main to return int. */
}
/*
 * Class:     gruenewa_opengl_GLUT__
 * Method:    glutSolidIcosahedron
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_gruenewa_opengl_GLUT_00024_glutSolidIcosahedron
  (JNIEnv * jenv, jobject jobj) {
   glutSolidIcosahedron(); 
}
示例#26
0
//显示回调函数
void renderScreen(void){
	//将窗口颜色清理为黑色
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	//将模板缓冲区值全部清理为1
	glClearStencil(1);
	//使能模板缓冲区
	glEnable(GL_STENCIL_TEST);
	//把整个窗口清理为当前清理颜色:黑色。清除深度缓冲区、模板缓冲区
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
	//将当前Matrix状态入栈
	glPushMatrix();
	//坐标系绕x轴旋转xRotAngle
	glRotatef(xRotAngle, 1.0f, 0.0f, 0.0f);
	//坐标系绕y轴旋转yRotAngle
	glRotatef(yRotAngle, 0.0f, 1.0f, 0.0f);
	//进行平滑处理 
	glEnable(GL_POINT_SMOOTH);
	glHint(GL_POINT_SMOOTH, GL_NICEST);
	glEnable(GL_LINE_SMOOTH);
	glHint(GL_LINE_SMOOTH, GL_NICEST);
	glEnable(GL_POLYGON_SMOOTH);
	glHint(GL_POLYGON_SMOOTH, GL_NICEST);

	//白色绘制坐标系
	glColor3f(1.0f, 1.0f, 1.0f);
	glBegin(GL_LINES);
	glVertex3f(-9.0f, 0.0f, 0.0f);
	glVertex3f(9.0f, 0.0f, 0.0f);
	glVertex3f(0.0f, -9.0f, 0.0f);
	glVertex3f(0.0f, 9.0f, 0.0f);
	glVertex3f(0.0f, 0.0f, -9.0f);
	glVertex3f(0.0f, 0.0f, 9.0f);
	glEnd();

	glPushMatrix();
	glTranslatef(9.0f, 0.0f, 0.0f);
	glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
	glutSolidCone(0.3, 0.6, 10, 10);
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f, 9.0f, 0.0f);
	glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
	glutSolidCone(0.3, 0.6, 10, 10);
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f, 0.0f, 9.0f);
	glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
	glutSolidCone(0.3, 0.6, 10, 10);
	glPopMatrix();

	//设置绘画颜色为金色
	glColor3f(0.0f, 1.0f, 0.0f);
	switch (iModel){
		//球
	case SPHERE:
		if (bWire){
			glutWireSphere(8.0f, 20, 20);
		}
		else{
			glutSolidSphere(8.0f, 20, 20);
		}
		break;
		//锥体
	case CONE:
		if (bWire){
			glutWireCone(4.0f, 8.0f, 20, 20);
		}
		else{
			glutSolidCone(4.0f, 8.0f, 20, 20);
		}
		break;
		//立体
	case CUBE:
		if (bWire){
			glutWireCube(8.0f);
		}
		else{
			glutSolidCube(8.0f);
		}
		break;
		//甜圈
	case TORUS:
		if (bWire){
			glutWireTorus(3.0f, 6.0f, 20, 20);
		}
		else{
			glutSolidTorus(3.0f, 6.0f, 20, 20);
		}
		break;
		//十六面体,默认半径1.0
	case DODECAHEDRON:
		glScalef(6.0f, 6.0f, 6.0f);//x,y,z轴均放大6倍
		if (bWire){
			glutWireDodecahedron();
		}
		else{
			glutSolidDodecahedron();
		}
		break;
		//茶壶
	case TEAPOT:
		if (bWire){
			glutWireTeapot(8.0f);
		}
		else{
			glutSolidTeapot(8.0f);
		}
		break;
		//八面体,默认半径1.0
	case OCTAHEDRON:
		glScalef(6.0f, 6.0f, 6.0f);//x,y,z轴均放大6倍
		if (bWire){
			glutWireOctahedron();
		}
		else{
			glutSolidOctahedron();
		}
		break;
		//四面体,默认半径1.0
	case TETRAHEDRON:
		glScalef(6.0f, 6.0f, 6.0f);//x,y,z轴均放大6倍
		if (bWire){
			glutWireTetrahedron();
		}
		else{
			glutSolidTetrahedron();
		}
		break;
		//二十面体,默认半径1.0
	case ICOSAHEDRON:
		glScalef(6.0f, 6.0f, 6.0f);//x,y,z轴均放大6倍
		if (bWire){
			glutWireIcosahedron();
		}
		else{
			glutSolidIcosahedron();
		}
		break;
	default:
		break;
	}

	//恢复压入栈的Matrix
	glPopMatrix();
	//交换两个缓冲区的指针
	glutSwapBuffers();
}