#include <GL/glut.h>
static GLfloat spin=0.0;
void display()
{ GLfloat sun_mat_ambient[] = {0.0f, 0.0f, 0.0f, 1.0f};
GLfloat sun_mat_diffuse[] = {0.0f, 0.0f, 0.0f, 1.0f};
GLfloat sun_mat_specular[] = {0.0f, 0.0f, 0.0f, 1.0f};
GLfloat sun_mat_emission[] = {0.5f, 0.0f, 0.0f, 1.0f};
GLfloat sun_mat_shininess = 0.0f;
GLfloat earth_mat_ambient[] = {0.0f, 0.0f, 0.5f, 1.0f};
GLfloat earth_mat_diffuse[] = {0.0f, 0.0f, 0.5f, 1.0f};
GLfloat earth_mat_specular[] = {0.0f, 0.0f, 1.0f, 1.0f};
GLfloat earth_mat_emission[] = {0.0f, 0.0f, 0.0f, 1.0f};
GLfloat earth_mat_shininess = 30.0f;
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluPerspective(90.0f, 1.0f, 1.0f, 20.0f);
gluLookAt(1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0);
glBegin(GL_LINES);
glColor3f(0.0f,1.0f,0.0f);
glVertex3i(0,100,0);
glVertex3i(0,-100,0);
glColor3f(1.0f,0.0f,0.0f);
glVertex3i(100,0,0);
glVertex3i(-100,0,0);
glColor3f(0.0f,0.0f,1.0f);
glVertex3i(0,0,100);
glVertex3i(0,0,-100);
glEnd();
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载