red faction a écrit :
Code :
- #include <gl/glut.h>
- void Reshape(int width, int height);
- void Draw();
- int Win1;
- int main( int argc, char *argv[ ], char *envp[ ] )
- {
- glutInit(&argc,argv);
- glutInitWindowSize(640,480);
- glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
- Win1 = glutCreateWindow("test" );
- glutReshapeFunc(Reshape);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
- }
- void Reshape(int width, int height)
- {
- glViewport(0,0,width,height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45,float(width)/float(height),1,100);
- glMatrixMode(GL_MODELVIEW);
- }
- void Draw()
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(0,0,10,0,0,0,0,1,0);
- glutSolidSphere(0.4,50,50) ;
- glutSwapBuffers();
- glutPostRedisplay();
- }
|
pas teste mais ca devrait fonctionner
void glutSolidSphere ( GLdouble radius , GLint slices , GLint stacks ); radius The radius of the sphere. slices The number of subdivisions around the Z axis (similar to lines of longitude). stacks The number of subdivisions along the Z axis (similar to lines of latitude). ma bonte me perdra
EDIT : javais pas fait attention , cest du c mais a mon avis ca ne posera pas trop des problemes pour la conversion
|