フラグを立てよう

日常・プログラミング・読書など掲載

openFrameworks 関数 まとめ(順次追加)

openFrameworksの関数一覧

図形

  • 直線 ofLine( x1, y1, x2, y2) 
  • 三角 ofTriangle( x1, y1, x2, y2, x3, y3) (頂点3つ)
  • 長方形 ofRect( x, y, width, height) (高さ・幅は正方向)
  • 円  ofCircle( x, y, radius
  • 楕円    ofEllipse( x, y, width, height)  

 

描写

  • 背景色 ofBackground( int R, int G, int B) (RGB)
  • 描画色 ofSetColor( R, G, B(, int Alpha)) (RGB(+透明度))
  • 透明度使用 ofEnableAlphaBlending()
  • 線の太さ ofSetLineWidth( width)
  • 線の解像度  ofEnableSmoothing() 
  • 円の解像度  ofSetCircleResolution()
  • 図形塗りつぶし ofFill()
  • not図形塗りつぶし  ofNotFill()
  • 原点移動 ofTranslate( x, y)
  • 原点一時保存 ofPushMatrix()
  • 原点取り出し ofPopMatrix()

 

ウィンドウ

  • ウィンドウサイズ  ofSetWindowShape( width, height)
  • ウィンドウ 高さ ofGetWindowHeight()
  • ウィンドウ 幅  ofGetWindowWidth()
  • フレームの切り替え(1s)  ofSetFrameRate(int Rate)

その他

  • ランダム数値 ofRandom(int Min,int Max)

 

アニメーションプログラムの構造

  • setup() 画像のサイズ・フレームレート・背景色・描画設定・変数の初期化
  • update() 変数の値の更新
  • draw() 描画

 

順次追加予定です。

他の関数や要望があればコメントお願いします