2023年3月23日 星期四

咻碰閃week06

 week06

1-1 開新專案 week06-1_TRT_robot2_teapot

複製上週week05-2_TRT_robot的程式
glutSolidSphere(0.01,30,30);///小球做中心點
    glPushMatrix(); ///程式還沒掛上去
        glRotatef(angle,0,0,1);
        glTranslatef(0.45,0,0);
        glutSolidTeapot(0.3);
    glPopMatrix();

1-2 掛茶壺

新增一行程式碼,決定掛的位置

2-1 開新專案 week06-2_TRT_robot_hierarchy 階層

新增myCube();
void myCube()
{
    glPushMatrix();
        glScalef(1,0.3,0.3);
        glutSolidCube(0.5);
    glPopMatrix();
}

glPushMatrix();
        glTranslatef(0.25,0,0);///(3)
        glRotatef(angle,0,0,1);///(2)
        glTranslatef(0.25,0,0);///(1)
        myCube();
glPopMatrix();

2-2 


glPushMatrix();
        glTranslatef(0.25,0,0);///(3)
        glRotatef(angle,0,0,1);///(2)
        glTranslatef(0.25,0,0);///(1)
        myCube();
        glPushMatrix();
            glTranslatef(0.25,0,0);
            glRotatef(angle,0,0,1);
            glTranslatef(0.25,0,0);
            myCube();
        glPopMatrix();
 glPopMatrix();

2-3 複製出左邊
2-4 mouse motion










沒有留言:

張貼留言