opengl中是否需要使用SolidTeapot()API的源代码?

opengl中是否需要使用SolidTeapot()API的源代码?,opengl,glut,opengl-4,Opengl,Glut,Opengl 4,谁能告诉我opengl中使用的SolidTeapot API的源代码?我的项目需要动画化茶壶盖的打开和关闭。实现相同功能的相关代码将非常棒。本论坛是针对技术问题的,而不是在哪里可以找到实现API的代码。它是一个GLUT函数,即不是OpenGL的一部分。还有几个GLUT的实现,其中两个是开源的,比如FreeGLUT。因此,您可以从那里获得代码。op询问SolidTeapot的代码,而不是如何使用它的示例。没有解释的代码转储会导致非常糟糕的答案。 // Ghulam Mujtaba #includ

谁能告诉我opengl中使用的SolidTeapot API的源代码?我的项目需要动画化茶壶盖的打开和关闭。实现相同功能的相关代码将非常棒。

本论坛是针对技术问题的,而不是在哪里可以找到实现API的代码。它是一个GLUT函数,即不是OpenGL的一部分。还有几个GLUT的实现,其中两个是开源的,比如FreeGLUT。因此,您可以从那里获得代码。op询问SolidTeapot的代码,而不是如何使用它的示例。没有解释的代码转储会导致非常糟糕的答案。
// Ghulam Mujtaba

#include <windows.h>
#include <GL/gl.h>    
#include <GL/glu.h>
#include <GL/glut.h>
static GLuint w=800,h=600;
void init( void)
{
glShadeModel (GL_SMOOTH);
glClearColor (1.0f, 1.0f, 1.0f, 1.0f);  
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);

}
void display(void){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glPushMatrix();
glLoadIdentity();


glTranslatef(0.0,0.0,0.0);
// glRotatef(0.0,0.0,0.0,0.0);
//glScalef(0.0,0.0,0.0);
glColor3f (1.0f, 0.0f, 1.0f);
glutWireTeapot(1.0);//glutSolidTeapote(.25);
glFlush();
glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(90.0, (GLfloat) w/(GLfloat) h, 1.0, 50.0);
//glFrustum (-2.0, 2.0, -2.0, 2.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
//gluLookAt(0.0,0.0,15.0,0.0,-2.0,0.0,0.0,1.0,0.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize (w, h);
glutInitWindowPosition (100, 100);
glutCreateWindow ("TEAPOT");
init ();
//glutKeyboardFunc(key);
glutDisplayFunc(display);
glutIdleFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}