#include<windows.h>
#include<GL/glut.h>
void redraw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// دوال الاضاءة
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glDisable(GL_CULL_FACE);
glEnable(GL_COLOR_MATERIAL);
// رسم ابريق باللون الأخضر الغامق
glPushMatrix();
glColor3ub (0, 53,33);
glRotatef(45,1,0,0);
glTranslatef(8,6,3);
glutSolidTeapot(4.5);
glPopMatrix();
glFlush();
}
void main (int argc, char **argv)
{
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH );
glutInitWindowSize (900, 900);
glutInitWindowPosition (100, 100);
glutCreateWindow("3D Rotate");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glClearColor(1.0, 1.0, 1.0, 0.0);
glOrtho(-21.0, 21.0, -21.0, 21.0, -20.0, 20.0);
glutDisplayFunc (redraw);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glutMainLoop();
}
الدله ..