トップページ
ひらく | たたむ | ページトップ
↓マウスで反転選択した文字を検索
OpenGL
   
ページ内検索 ページ外検索
検索したい文字を入力して
ENTERを押すと移動します。
\n
[ トップページ ]
[ ____CommandPrompt ] [ ____JScript ] [ ____MySQL ] [ ____Cygwin ] [ ____Java ] [ ____Emacs ] [ ____Make ] [ ____Perl ] [ ____Python ] [ ____OpenGL ] [ ____C# ] [ ____StyleSheet ] [ ____C++ ] [ ____Winsock ] [ ____Thread ] [ ____VisualStudio ] [ ____C ] [ ____Win32API ] [ ____Lua ] [ ____PhotoShop ]
ヘッダ検索
___

■ ステンシル(Stencil)


  SAMPLE
     ステンシル 

  DESC
    ステンシルバッファを使うと輪郭の切り出しなどの、特殊エフェクトができる。


    ステンシルバッファを設定する。
      // 8 bit サイズで指定する。    
      pfd.cStencilBits = 8;

      int fmt = ChoosePixelFormat( hDC, &pfd );
      SetPixelFormat( hDC, fmt, &pfd );

最初にステンシル(型)をつくるため、輪郭にしたいオブジェクトを描画する。 次に 作成したステンシルとテストをして、描画する画面を切り抜く。

    glEnable( GL_STENCIL_TEST );

    glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE  );
    glStencilFunc( GL_ALWAYS, 0xff, 0xff );

    // 型紙をつくるにはオブジェクトを描画する
    drawPlane();

    
    // ステンシルで切り抜く。( 0xff と同じ値のピクセルが描画される。 )
    glStencilFunc( GL_EQUAL, 0xff, 0xff );
    glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP  );

    // 移りこみを表現するため、ワールド座標でY軸反転する。
    glScalef( 1, -1, 1 );
    glTranslatef( 0, 100, 0 );
    drawCube();
    
    
    // 通常のオブジェクトを描画する。
    glDisable( GL_STENCIL_TEST ); 
    drawCube();
___

■ glStencilOp

SYNTAX void glStencilOp( GLenum sfail, // ステンシルテストが失敗したピクセルに対する処理 GLenum dpfail, // ステンシルテストに合格したが デプステストに失敗したピクセルに対する処理 GLenum dppass // デプステストまで合格した( またはデプステスト無効 )ピクセルに対する処理。 ) DESC ステンシルバッファへの処理を指定する。 3つの引数で、各テストに合格、不合格したピクセルごとに処理を設定できる。 set front and back stencil test actions Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering. 次の8つの処理ができる。 GL_KEEP : 何もしない。 GL_REPLACE : glStencilFunc() の ref で指定した値で置き換える。
___

■ glStencilFunc

SYNTAX void glStencilFunc( GLenum func, // テスト演算子の指定 GLint ref, // テストで比較する値 GLuint mask // テスト実行前にステンシル値と ref の両方に bit mask する値 ) DESC ステンシルテストの方法を設定する。 Specifies the test function. Eight symbolic constants are valid: GL_NEVER, GL_LESS, GL_LEQUAL, GL_GREATER, GL_GEQUAL, GL_EQUAL, GL_NOTEQUAL, and GL_ALWAYS. The initial value is GL_ALWAYS.
___

■ glClearStencil

SYNTAX void glClearStencil( GLint s) // Specifies the index used when the stencil buffer is cleared. The initial value is 0. DESC ステンシルバッファのクリアする値を指定する。 glClearStencil specifies the index used by glClear to clear the stencil buffer. s is masked with m 2 - 1 , where m is the number of bits in the stencil buffer.






金利比較.COM
NINJAIDX 9