2008年12月10日 星期三

Painter 相關運用函數 01

glRasterPos2i( , ); → 繪出的字元位置,參數為(X,Y)座標
glutBitmapCharacter(GLUT_BITMAP_9_BY_15, 'A'); → 畫出字母'A'
shift=glutBitmapWidth(GLUT_BITMAP_9_BY_15, 'A'); → 計算字母'A'的寬度

Note.若要在'A'右邊繼續畫出字母則 X座標 需要加上變數 shift

glColor 系列函數 相關介紹

Note.亂數跑顏色的話需用
glColor3ub( (char)rand()%256 , (char)rand()%256 , (char)rand()%256 );
或是 glColor3b ( rand()%256 , rand()%256 , rand()%256 , 1.0 );

Note. 內建函式庫用 #include < >
自己定義的用 #include " " 要分別compile才會過

Note. 全域變數只有給初始值時不用加 extern 其餘都有,否則會重複定義。

沒有留言: