2022年5月9日 星期一

WEEK12

 step01-1

1.jsyeh.org/3dcg10下載windows跟data,解壓縮後把data拉進windows
2.開Transformation.exe(調整Swap T R觀察它的差異)

glTranslatef(0.8,0.0,0.0);

glRotatef(angle,0,1,0);


glRotatef(angle,0,1,0);

glTranslatef(0.8,0.0,0.0);





step01-2

https://120.125.80.50/GL/
調整Swap觀察物件的轉動

step03-2

旋轉茶壺
```c

#include <GL/glut.h>

float angle=0;

void display()

{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();

        glRotatef(angle , 0, 0, 1);

        glTranslatef(0.4,-0.07,0);

        glutSolidTeapot(0.3);

    glPopMatrix();

    glutSwapBuffers();

    angle+=0.1;

}

int main(int argc,char **argv)

{

    glutInit(&argc,argv);

    glutInitDisplayMode(GLUT_DOUBLE|GLUT_DEPTH);

    glutCreateWindow("week12 TRT");

    glutIdleFunc(display);

    glutDisplayFunc(display);

    glutMainLoop();

}

```c

step03-3

增加一個茶壺在茶壺之間新增關節
```c

#include <GL/glut.h>

float angle=0;

void display()

{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glColor3f(1,1,1);

    glutSolidTeapot(0.3);

    glPushMatrix();

        glTranslatef(0.3,0,0);

        glRotatef( angle,0,0,1);

        glTranslatef(0.2,0,0);

        glColor3f(1,0,0);

        glutSolidTeapot(0.2);

    glPopMatrix();

    glutSwapBuffers();

    angle+=0.1;


}

int main(int argc,char**argv)

{

    glutInit(&argc,argv);

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("week12 TRT");

    glutIdleFunc(display);

    glutDisplayFunc(display);

    glutMainLoop();


}

```c

沒有留言:

張貼留言