PDA

View Full Version : Why doesn't point attenuation work?



mobilevisuals
12-16-2009, 12:41 AM
I am developing a game with OpenGL ES and I am using point attenuation. It is possible to enable it with glEnable(GL_POINT_SPRITE_OES). It is also possible to set the point size with glPointSize(pointSize).

The problem is that max and min size of the points and the PointSizeCoords do not have any effect on most devices. The result is that no Point attenuation is calculated with regards to the distance, so all the points get the size that is set with glPointSize(pointSize). The visual result of this is that all the points look very large from a long distance and very small from a short distance. It works like is should on N95 and n82,but not on the rest of them.

According to the information from Nokia, Point attenuation should work on all devices with OpenGL ES 1.1. I have tested on a lot of them,but it only works like it should on N95 and N82. Does anyone know how to make point attenuation work on the rest of the devices, or is it a bug in the implementation of point attenuation on all those devices?
This is the code that I have used:

glEnable(GL_POINT_SPRITE_OES);
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_TRUE );
glPointSize(pointSize);
glPointParameterf(GL_POINT_SIZE_MIN, 0.01f);
glPointParameterf(GL_POINT_SIZE_MAX,29.0f);//15
//the coordinates for calcluting point atenuation
iPointSizeCoords[0] = 1.0f;
iPointSizeCoords[1] = 0.103f;//063 103 för mkt
iPointSizeCoords[2] = 0.0f;
glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, iPointSizeCoords);
glPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE,5.f );

Morgan Kaufmann's book "Mobile 3D Graphics with OpenGL ES and M3G" says:

Although this should work as specified in the API, in practice most implementations of OpenGL ES in the market have some issues with either the point clipping when the viewport has been extended, or with point sprites in general.

Does this mean that they haven't implemented point attenuation like they should?