2022年3月8日 星期二

連week03 - 小畫家 , 滑鼠移動控制 與 利用滑鼠找座標


03-1 畫圖 小小兵












---------------------------------------------------------------------------------------------------------------------------
重點
#include <math.h>  // sin() ,cos()

void myCircle(float x,float y, float r)
{
    glBegin(GL_POLYGON);
    for(float a=0;a<3.1415926*2;a+=0.01){
        glVertex2f(x+r*cos(a),r*sin(a));
    } // 要畫三角函數
    glEnd();
 }

glColor3ub(255,218,102); // ( r , g , b )
      myCircle(0,0,2); // ( x軸 , y軸 , 大小 )
----------------------------------------------------------------------------------------------------------------
完整程式參考

----------------------------------------------------------------------------------------------------

滑鼠移動控制









完整程式碼



利用滑鼠找座標

----------------------------------------------------------------------------------------------------------------

重點

#include <stdio.h>  // 小黑 print 座標用

----------------------------------------------------------------------------------------------------------------








完整程式碼


沒有留言:

張貼留言

VERY BEAUTIFUL, VERY POWERFUL

一.     一樣先安裝且設定好freeglut,OpecCV, 開啟CodeBlocks建立新專案 week11_gundam,                 把 MyGundam.zip下載解壓縮後的data資料夾放到freeglut/bin裡面 把week09_openc...