#include <GL/glut.h>
void OnDisplay(void)
{glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glEnable(GL_DEPTH_TEST);glMatrixMode(GL_MODELVIEW);GLfloat light_position[] = { 0.0, 0.0, 100.0, 0.0 };glLightfv(GL_LIGHT0, GL_POSITION, light_position);glEnable(GL_LIGHTING);glEnable(GL_LIGHT0);glutSolidSphere(50.0, 20, 20);glFlush();glutSwapBuffers();
}
void OnReshape(int w, int h)
{glViewport(0, 0, w, h);glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(-200, 200, -200, 200, 0.1, 100);gluLookAt(0.0, 0.0, 100, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}
void main(int argc, char** argv)
{glutInit(&argc, argv);glutInitDisplayMode(GLUT_RGB);glutInitWindowSize(400, 400);glutInitWindowPosition(400, 400);glutCreateWindow("kkk");glutDisplayFunc(OnDisplay);glutReshapeFunc(OnReshape);glutMainLoop();}