-ver1.0 未完成第一次測試版本
#include <GL/glut.h>
void display()
{
glPushMatrix();
glPushMatrix();
glTranslatef(0, 0.3, 0);
glColor3f(0,0, 1);
glutSolidSphere(0.3, 30, 30);
glColor3f(1,1,1);
glTranslatef(0, -0.1, 0.1);
glutSolidSphere(0.25, 30,30);
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
glutSolidSphere(0.2,30,30);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
int main()
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week08");
glutDisplayFunc(display);
glutMainLoop();
}
------------------------------------------------------------------------------------------------------------
#include <GL/glut.h>
float angle=0;
void display()
{
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle, 0,1,0);
glPushMatrix();
glTranslatef(0, 0.3, 0);
glColor3f(0,0, 1);
glutSolidSphere(0.3, 30, 30);
glColor3f(1,1,1);
glTranslatef(0, -0.1, 0.1);
glutSolidSphere(0.25, 30,30);
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
//glutSolidSphere(0.2,30,30);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
void idle()
{
angle++;
glutPostRedisplay();
}
int main()
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week08");
glutDisplayFunc(display);
glutIdleFunc(idle);
glutMainLoop();
}
-ver 2.0 變成3D但還沒打光版本
#include <GL/glut.h>
float angle=0;
void display()
{
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(angle, 0,1,0);
glPushMatrix();
glTranslatef(0, 0.3, 0);
glColor3f(0,0, 1);
glutSolidSphere(0.3, 30, 30);
glColor3f(1,1,1);
glTranslatef(0, -0.1, 0.1);
glutSolidSphere(0.25, 30,30);
glPopMatrix();
glPushMatrix();
glColor3f(1,1,1);
//glutSolidSphere(0.2,30,30);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
}
void idle()
{
angle++;
glutPostRedisplay();
}
int main()
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("week08");
glutDisplayFunc(display);
glutIdleFunc(idle);
glutMainLoop();
}
-----------------------------------------------------------------------------------------------------------
那麼你知道
回覆刪除丁丁做事會怎樣嗎
而且拍尼做事拍尼當
刪除我好帥
刪除作者已經移除這則留言。
刪除作者已經移除這則留言。
刪除