PDA

View Full Version : Point sprite attenuation doesn't work on Android



mobilevisuals
03-19-2011, 08:29 AM
I have tried to get Point sprite attenuation to work, but it has no effect. Whatever I do, the points have the same size (maxSpriteSize). They are supposed to decrease in size with the distance from the camera. Does anyone know what is wrong with my code?

gl.glEnable(GL10.GL_TEXTURE);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
gl.glEnable(GL11.GL_POINT_SPRITE_OES);
gl.glEnableClientState(GL11.GL_POINT_SIZE_ARRAY_BU FFER_BINDING_OES);
gl.glEnableClientState(GL11.GL_POINT_SIZE_ARRAY_OE S);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glTexEnvf(GL11.GL_POINT_SPRITE_OES, GL11.GL_COORD_REPLACE_OES,
GL11.GL_TRUE);

gl.glVertexPointer(3, GL11.GL_FLOAT, 0, vertexBufferLT);
gl.glTranslatef(xplace, 0.0f, zplace);
float maxSpriteSize=10f;
((GL11)(gl)).glPointParameterf(GL11.GL_POINT_FADE_ THRESHOLD_SIZE, 0.06f * maxSpriteSize);
((GL11)(gl)).glPointParameterf(GL11.GL_POINT_SIZE_ MIN, 0.1f);
((GL11)(gl)).glPointParameterf(GL11.GL_POINT_SIZE_ MAX, maxSpriteSize);
gl.glPointSize(maxSpriteSize);
float spriteDistAtt[] = { 0f, 40.8f, 40.5f };
((GL11)(gl)).glPointParameterfv(GL11.GL_POINT_DIST ANCE_ATTENUATION, spriteDistAtt, 0);
gl.glDrawArrays(GL10.GL_POINTS, 0, vertices);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL11.GL_POINT_SPRITE_OES);
gl.glDisableClientState(GL11.GL_POINT_SIZE_ARRAY_B UFFER_BINDING_OES);
gl.glDisableClientState(GL11.GL_POINT_SIZE_ARRAY_O ES);
gl.glDisable(GL10.GL_TEXTURE);