2016年3月15日 星期二

Week 04 葉川麟

作業一

作業互評





作業二

操作Projection學習圖片移動

作業三

(圖片反白的地方為移動視窗且圖片也會移動之程式碼)
 glTranslatef(0, 0.3,0);

作業四

使用滑鼠可以指定茶壺要得位置

#include <GL/glut.h>
float nowX=0, nowY=0;
void mouse(int butten, int state, int x, int y)
{
    nowX =(x-150)/150.0;nowY = -(y-150)/150.0;
}
void display()
{
    glClearColor(1, 1, 0,1);
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();
        glTranslatef(nowX, nowY,0);
        glColor3f(1,0,0);
        glutSolidTeapot(0.3);
    glPopMatrix();
    glutSwapBuffers();
}
int main(int argc, char**argv)
{
    glutInit(&argc , argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Hellow3D");

    glutDisplayFunc(display);
    glutMouseFunc(mouse);

    glutMainLoop();
}





沒有留言:

張貼留言