2015 電腦圖學 Computer Graphics 授課教師: 葉正聖 銘傳大學資訊傳播工程系 每週主題: 程式環境、點線面顏色、移動/旋轉/縮放與矩陣(Matrix)、階層性關節轉動(T-R-T)、做出機器人、打光、貼圖、glu/glut函式、鍵盤、滑鼠、計時器(timer)、讀入3D模型、粒子系統、聲音、特效、投影矩陣、攝影機與運鏡、機器人2.0、期末作品
2015年6月10日 星期三
Week16 02160580課堂作業
#include <GL/glut.h>
float angle1=0;
void display()
{
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glColor3f(0,0,1);
glutSolidTeapot(0.3);
glPushMatrix();
glTranslatef(0.5,0.15,0);
glRotatef(angle1,0,0,1);
glTranslatef(0.3,0,0);
glScalef(1,0.3,0.3);
glColor3f(1,0,0);
glutSolidSphere(0.3,30,30);
glPopMatrix();
glPopMatrix();
glFlush();
}
void motion(int x,int y)
{
angle1=x;
glutPostRedisplay();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutCreateWindow("02160580");
glutDisplayFunc(display);
glutMotionFunc(motion);
glutMainLoop();
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言