glDrawTex_OESを正しく使用しているかどうかわかりません。実際、意図したテクスチャではなく、画面に黒い長方形が表示されているからではないと確信しています。
ばかげたポイントを邪魔にならないようにするには:はい、GL拡張文字列にはOES_draw_textureトークンが含まれています。はい、テクスチャはメモリなどにロードされます。正しく:ポリゴンにマップすると問題なく表示されます。
私が見つけることができるドキュメントのさまざまなビットを読むと、「TEXTURE_CROP_RECT_OESに等しいpnameを使用してTexParameteriv()を介してテクスチャクロップ長方形を構成する」必要があるようです。khronosフォーラムのこの投稿(グーグルが私のために見つけることができる最高のドキュメント)によると、その値は「Ucr、Vcr、Wcr、Hcr。つまり、左/下/幅/高さ」です。
レンダリングコードは次のとおりです。
void SetUpCamera( int windowWidth, int windowHeight, bool ortho ) // only called once
{
glViewport( 0, 0, windowWidth, windowHeight );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
if( ortho )
{
float aspect = (float)windowWidth / (float)windowHeight;
float halfHeight = 32;
glOrthof( -halfHeight*aspect, halfHeight*aspect, -halfHeight, halfHeight, 1.0f, 100.0f );
}
else
{
mygluPerspective( 45.0f, (float)windowWidth / (float)windowHeight, 1.0f, 100.0f ); // I don't _actually_ have glu, but that's irrelevant--this does what you'd expect.
}
}
void DrawTexture( int windowWidth, int windowHeight, int texID )
{
// Clear back/depth buffer
glClearColor( 1, 1, 1, 1 );
glClearDepth( 1.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
// Next 2 lines probably not necessary, but, you know, sanity check:
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
// set up texture
glBindTexture( GL_TEXTURE_2D, texID ); // texID is the glGenTexture result for a 64x64 2D RGB_8 texture - nothing crazy.
GLint coords [] = {0, 0, 64, 64};
glTexParameteriv( GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, coords );
// blit? =(
glDrawTexiOES( windowWidth / 2 - 32, windowHeight - 70, 10, 64, 64 );
}
明らかな何かが欠けていますか?ただのばかげたことをしているのですか?