Texturierte Punkte in OpenGL ES 2.0?

Ich versuche, strukturierte Punkte (z. B. Punktsprites) in OpenGL ES 2.0 für ein Partikelsystem zu implementieren. Das Problem, das ich habe, ist, dass die Punkte alle als durchgehende schwarze Quadrate gerendert werden, anstatt dass die Textur ordnungsgemäß zugeordnet wird.

Ich habe überprüft, dass gl_PointCoord tatsächlich x / y-Werte von 0,0 bis 1,0 zurückgibt, die auf die gesamte Textur abgebildet werden. Der Aufruf von texture2D scheint jedoch immer schwarz zu sein.

Mein Vertex-Shader:

attribute vec4 aPosition;
attribute float aAlpha;
attribute float aSize;
varying float vAlpha;
uniform mat4 uMVPMatrix;

void main() {
  gl_PointSize = aSize;
  vAlpha = aAlpha;
  gl_Position = uMVPMatrix * aPosition;
}

Und mein Fragment Shader:

precision mediump float;
uniform sampler2D tex;
varying float vAlpha;

void main () {
    vec4 texColor = texture2D(tex, gl_PointCoord);
    gl_FragColor = vec4(texColor.rgb, texColor.a * vAlpha);
}

Die fragliche Textur ist 16x16. Ich kann diese Textur erfolgreich auf eine andere Geometrie abbilden, aber aus irgendeinem Grund nicht auf Punkte.

Meine Plattform ist ein Motorola Droid mit Android 2.2.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage