---------------------------------------------------------------------------------------------------------------------------
重點
#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 座標用
----------------------------------------------------------------------------------------------------------------
完整程式碼
沒有留言:
張貼留言