2018電腦圖學 Computer Graphics 授課教師: 葉正聖 銘傳大學資訊傳播工程系 每週主題: 程式環境、點線面顏色、移動/旋轉/縮放與矩陣(Matrix)、階層性關節轉動(T-R-T)、做出機器人、打光、貼圖、glu/glut函式、鍵盤、滑鼠、計時器(timer)、讀入3D模型、粒子系統、聲音、特效、投影矩陣、攝影機與運鏡、機器人2.0、期末作品
2018年3月23日 星期五
Week04_劉沛潔
開啟他 懂他 操作他
#include <stdio.h>
#include <GL/GL/glut.h>
float teapotX=0, teapotY=0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
glPushMatrix();
glTranslated(reapotX, teapotY, 0);
glutSolidTeapot(0,3);
glPopMatrix();
glutSwapBuffers();
}
void motion(int x, int y)
{
teapotX=(x-150)/150.0;
teapotY=(y-150)/150.0;
glutPostRedisplay();
}
int main
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);
glutCreateWindow("Week03 Mouse");
glutKisplayFunc(display);
glutMouseFunce(mouse);
glutMotionFunc(motion);
glutMainLoop();
}
訂閱:
張貼留言 (Atom)

沒有留言:
張貼留言