2017年3月20日 星期一

week04



void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();     ///backup the matrix

        glTranslated(0.5,0,0);     ///位子移動的座標

        glutSolidTeapot(0.3);
     
    glPopMatrix();     ///restore the martix

    glutSwapBuffers();
}




void motion (int x, int y)
{
    mousex = (x-150)/150.0;  /// x/300.0;

    mousey = -(y-150)/150.0; ///y/300.0;

    glutPostRedisplay();
}



void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();     

        glScalef(mousex, mousey ,0);     ///大小改變

        glutSolidTeapot(0.3);
     
    glPopMatrix();     

    glutSwapBuffers();
}


沒有留言:

張貼留言