2017計算機圖學
2017年10月26日 星期四
[耍廢]WEEK7
光源改變
1.
const
GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };
void motion(int x,int y)
{
light_position[0]=(x-150)/150*2;
light_position[1]=-(y-150)/150*2; //150是正中間的位置
glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glutPostRedisplay();
}
glutPassiveMotionFunc(motion);
根據滑鼠位置(不用按)就可以改變光源位置
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言