绘制犹他壶

#include <GL/glut.h> 

void cube(){
glClear(GL_COLOR_BUFFER_BIT);
glutWireTeapot(0.6f);
//glutSolidSphere(1,100,100);
glFlush();

}


void init (void)

{

    glClearColor (0.0, 0.0, 0.0, 0.0); 

    glMatrixMode (GL_PROJECTION);      

    glOrtho (-1,1,-1,1,-1,1);

}

 


void main (int argc, char** argv)

{

    glutInit (&argc, argv);                        

       glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); 

    glutInitWindowPosition (100, 100);  

    glutInitWindowSize (480, 480);     

    glutCreateWindow("一个圆");
	init();                           

    glutDisplayFunc (cube);      

    glutMainLoop ( );                  

}



#include <GL/glut.h>
void RenderScene(void)
{
 glClear(GL_COLOR_BUFFER_BIT);
 glutWireTeapot(0.6f);
 glFlush();
}
void SetupRC(void)
{
 glClearColor(0.0f,0.0f,1.0f,1.0f);
}
int main(int argc,char **argv)
{
 glutInit(&argc,argv);
 glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA);
 glutCreateWindow("teapot");
 glutDisplayFunc(RenderScene);
 SetupRC();
 glutMainLoop();
 return 0;
}


你可能感兴趣的:(OpenGL)