主題:
(1) 上周作業
(2) 讓機器人動
(3) Timer計時器
(4) 鍵盤滑鼠控制
(5) 機器人2.0
課堂作業 : 用同學的作範例
(1) .cbp專案檔用Notepad++開include目錄,lib目錄設對
working目錄設"." (句點
(2) Build & Run
程式碼↓
#include <stdio.h>
void timer(int t)
{
printf("現在我起床了,t是%d...",t);
glutTimerFunc(100,timer,t+1);
printf("我撥了一個新的timer....");
angle+=3;
glutPostRedisplay();
printf("記得重畫畫面哦! 我睡了,byb\n");
}
....
glutTimerFunc(2000,timer,0);
(3) Week14_01time.cpp
(4) Week14_02pushTRTpop-Left.cpp
程式碼↓
glPushMatrix( )
glPushMatrix( ); ///Left Part
glTranslatef(-0.22,+0.35,0);///(3)最後,把它掛在對的位置
glRotatef(-angle,0,0,1);///(1)先轉動
glTranslatef(-0.1,0.25,0);///(2) move the rotate center to center
drawArm0();
glTranslatef(-0.48,+0.1,0);///(3)最後,把它掛在對的位置
glRotatef(-angle,0,0,1);///(1)先轉動
glTranslatef(0.48,-0.1,0);///(2)接著將旋轉中心,放到真的中心,記得把樓上先註解掉
drawArml();
glPopMatrix();
glPopMatrix();
(5)Week14_03pushTRTpop-Right.cpp
(6)Week14_04mouseRotateAngle.cpp
可用mouse轉角度
沒有留言:
張貼留言