LoginSignup
8
8

More than 5 years have passed since last update.

ofFBOのアンチエイリアス方法2つ

Posted at

問題

FBO内にofEnableSmooting()を記述しても以下の様にアンチエイリアスが効かない

20151103170727.png

解決策

1.fbo.allocate()の第4引数を指定

 第4引数は、サンプル数らしい。大きくすればするほど綺麗になる。

fbo.allocate(ofGetWidth(), ofGetHeight(), GL_RGB, 4);

結果
20151103180107.png

2.加算合成を駆使

 描画したいコードの直前で、ofEnableBlendMode(OF_BRENDMODE_ADD)。描画が終わったらEnableAlphaBlendong()とofEnableSmoothing()。
※oFでは、加算合成とスムージングは同時に効かない。その為、加算合成の前にofDisableSmoothing()を記述。

void ofApp::draw(){
      fbo.begin();
           ofDisableSmoothing();
           ofEnableBlendMode(OF_BLENDMODE_ADD);
           /*描画したいコード*/
           ofEnableAlphaBlending();
           ofEnableSmoothing();
      fbo.end();
}

結果
20151103175137.png

コードを書く手間を考えたら、1の方が良さげ。

参考

Anti-aliasing in OSX not working

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8