2017年10月26日 星期四

Arthus week07

week7

滑鼠打光

step1:打開glut專案檔
在main中加入glutMotionFunc(motion);

step2:加入新的function
void motion(int x,int y)
{
    light_position[0]= (x-150)/150.0 *3;
    light_position[1]= -(y/150)/150.0 *2;
    glLightfv(GL_LIGHT0,GL_POSITION,light_position);
    glutPostRedisplay();
}

step3:把 const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };
const刪掉
step4:完成

沒有留言:

張貼留言