|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||
public interface IAntiAliasSupport
アンチエイリアスを有効にしてOpenGLの処理を実行するサービスです。
使用例:アンチエイリアスを有効にしてポリゴンを描画します。
@Effect
public class DrawPolygon {
private final IVideoEffectContext context;
private final IVideoRenderSupport support;
private final IAntiAliasSupport aaSupport;
@Inject
public DrawPolygon(IVideoEffectContext context, IVideoRenderSupport support, IAntiAliasSupport aaSupport) {
this.context = context;
this.support = support;
this.aaSupport = aaSupport;
}
public IVideoBuffer doVideoEffect() {
IVideoBuffer buffer = context.doPreviousEffect();
final VideoBounds bounds = buffer.getBounds();
if (bounds.isEmpty()) {
return buffer;
}
Runnable operation = new Runnable() {
public void run() {
support.ortho2D(bounds);
// アンチエイリアスを有効にしてポリゴンを描画
aaSupport.antiAlias(bounds.width, bounds.height, new Runnable() {
public void run() {
GL2 gl = context.getGL().getGL2();
gl.glBegin(GL2.GL_POLYGON);
gl.glVertex...
...
gl.glEnd();
}
});
}
};
try {
// IVideoRenderSupport.useFramebuffer メソッドを使うと
// フレームバッファの設定や後始末などの煩わしい処理を記述しなくて済みます。
support.useFramebuffer(operation, 0, buffer);
IVideoBuffer result = buffer;
buffer = null;
return result;
} finally {
if (buffer != null) buffer.dispose();
}
}
}
| メソッドの概要 | |
|---|---|
void |
antiAlias(int width,
int height,
boolean depthTest,
Color clearColor,
java.lang.Runnable operation)
アンチエイリアスを有効にして、引数 operationに指定した処理を実行します。 |
void |
antiAlias(int width,
int height,
java.lang.Runnable operation)
アンチエイリアスを有効にして、引数 operationに指定した処理を実行します。 |
int |
getSamples()
このサービスのアンチエイリアス実装がマルチサンプリングの場合、そのサンプル数を返します。 |
| メソッドの詳細 |
|---|
void antiAlias(int width,
int height,
boolean depthTest,
Color clearColor,
java.lang.Runnable operation)
アンチエイリアスを有効にして、引数operationに指定した処理を実行します。
width及びheightには作業バッファのサイズを指定します。
この作業バッファ上でoperationを実行した後、
結果の画像を作業バッファから現在のフレームバッファに転送します。
depthTestにtrueを指定した場合、
デプスバッファ用の作業バッファも用意し、デプステストを有効にしてoperationを実行します。
clearColorにnull以外の値を指定すると、
指定した色で作業バッファを塗りつぶした後にoperationを実行します。
このメソッドを呼び出す前にOpenGLのフレームバッファを適切に設定しておく必要があります。
アンチエイリアスの現在の実装はMSAAです。この実装にハードウエアが対応していない場合、アンチエイリアスされません。
width - 作業バッファの幅height - 作業バッファの高さdepthTest - デプステストを行う場合は true そうでない場合は falseclearColor - 処理前に塗りつぶす色operation - アンチエイリアスを有効にして行う処理antiAlias(int, int, Runnable)
void antiAlias(int width,
int height,
java.lang.Runnable operation)
operationに指定した処理を実行します。
これは、antiAlias(width, height, false, Color.COLORLESS_TRANSPARENT, operation)と同じです。
width - 作業バッファの幅height - 作業バッファの高さoperation - アンチエイリアスを有効にして行う処理antiAlias(int, int, boolean, Color, Runnable)int getSamples()
0を返します。
実装がマルチサンプリング以外の場合は-1を返します。
-1。
|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||