Saturday, March 19, 2011

[android-developers] Point sprite attenuation does not work because the points have the same size.

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_BUFFER_BINDING_OES);
gl.glEnableClientState(GL11.GL_POINT_SIZE_ARRAY_OES);
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_DISTANCE_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_BUFFER_BINDING_OES);
gl.glDisableClientState(GL11.GL_POINT_SIZE_ARRAY_OES);
gl.glDisable(GL10.GL_TEXTURE);

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate