私は非常に奇妙な問題を抱えています。うまくいけば簡単に解決できます。
三角ストリップとしてクワッドを描画しています。ストリップに2つの三角形があり、アルファチャネルを含むテクスチャを適用します。
三角形の1つでは、アルファは問題なく、私が望むとおりに正確に見えますが、最初の三角形では、アルファが正しい中間値ではなく、1.0または0.0のように見えます。
これを引き起こしている可能性がありますか?それが問題だと正しく思いましたか?人々が私の意味を理解できるように、画像を添付します。
奇妙なことに、これは三角配列として1つのテクスチャから描画されるため、設定を変更したり、何らかの方法でテクスチャに影響を与えたりする方法がわかりません。三角形が別の回転で描かれているのではないかと思いましたが、どちらも反時計回りです。
次のようにコードを賢く描画します。
gl.glBindTexture(GL10.GL_TEXTURE_2D, texturePointer);
//Enable the vertices buffer for writing and to be used during our rendering
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
//Specify the location and data format of an array of vertex coordinates to use when rendering
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
//Enable the texture buffer
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);
ですから、正直なところ、少し困惑しています。
編集:これをもう少し見ると、三角形の1つが2回テクスチャリングされているように見えるので、アルファが明らかに加算され、もう少し適用されます。これはおそらく、三角ストリップで何か問題が発生していることを意味します。私はそのようにストリップを作ります(チェックするために手書きで書き始めました..):
//Top left
vertices[vertPlace++] = 0.0f;
vertices[vertPlace++] = height;
vertices[vertPlace++] = 0.0f;
//Bottom left
vertices[vertPlace++] = 0.0f;
vertices[vertPlace++] = 0.0f;
vertices[vertPlace++] = 0.0f;
//top right
vertices[vertPlace++] = width;
vertices[vertPlace++] = height;
vertices[vertPlace++] = 0.0f;
//Bottom right
vertices[vertPlace++] = width;
vertices[vertPlace++] = 0.0f;
vertices[vertPlace++] = 0.0f;
//Now set the indices
indices[indiPlace++] = (short)0;
indices[indiPlace++] = (short)1;
indices[indiPlace++] = (short)2;
indices[indiPlace++] = (short)3;
//Top Left
textureCoords[textPlace++] = 0.0f;
textureCoords[textPlace++] = 1.0f;
///Bottom left
textureCoords[textPlace++] = 0.0f;
textureCoords[textPlace++] = 0.0f;
//Top right
textureCoords[textPlace++] = 1.0f;
textureCoords[textPlace++] = 1.0f;
//Bottom right
textureCoords[textPlace++] = 1.0f;
textureCoords[textPlace++] = 0.0f;
どういうわけか私はそこで何か間違ったことをしている、私はそれを見ることができない。