2018年5月25日 星期五

Week13 擺pose

電腦圖學 2018-05-25     Week 13
(1)主題:寫檔,讀檔
(2)主題:控制關節
(3)主題:動作內插
(4)作業:會動的機器人

TODO:
一.寫檔: File-new-emptyFile,  Save as Week13_fprintf.cpp
          寫入代碼:
          #include <stdio.h>
          int main()
         {
                 FILE * fout = fopen("Output.txt","w+");//(檔名)(寫write +)
                 fprintf(fout,"Hello world\n");
          }

TODO
二.File-New-Project, GLUT專案
改寫:
     #include <GL/glut.h>
     #include <stdio.h>
     FILE * fout = NULL;
     float angle=0,angle2=90,angle3=60;
     void keyboard(unsigned char key, int x,int y)
    {
           if(key=='s'||key=='S'||key=='w'||key=='W')
          {
               if(fout==NULL) fout = fopen("text","w++");
               fprintf(fout,"%.3f %.3f %.3f\n",angle,angle2,angle3);
          }
    }


沒有留言:

張貼留言