Problems with pointsize using POINT_SPRITE_ARB in a paritclesystem


im new here in this forum. :slight_smile:
I want to build a particle system in opengl, and i fount the extension GL_POINT_SPRITE_ARB. Now, i want the particles in specific sizes related to the viewing distance.
If i call glPointSize (…) betwenn the glBegin (GL_POINTS) and glEnd() i got an runtime-error. If i call the glPointSize befor the glBegin, the it runs fine.
The problem is that if i have to call for every point glBegin and glEnd, i do min. 3 funktion calls per point, e.g.

glBegin (GL_POINTS);
glVertex3f (x,y,z);

I am looking for a trick, so i can adjust the pointsize more easy, and effizient. :slight_smile:
Another Problem is, that in this way i also have to calculate the point size on the cpu, perhaps it is also possible to do that on the gpu!?
At this time, i get the GL_MODELVIEW_MATRIX, and multiply every Point whith this matrix to get the z-distance.

Sorry for my bad english, i hope you understand my problem. If you have problems understanding my thread, please ask me! :wink:

Greez from germany,


Either you calculate them by yourself using GL_ARB_vertex_program or using GLSL.
Or you look into the GL_ARB_point_parameters extension (IIRC also part of OpenGL 1.4). The latter enables calculation of point size attenuation based on the eye-space z-distance.

btw, Cross posting is a bad habit :wink:

schnueffler… :stuck_out_tongue:

Thank you very much for this Info!
And sorry for cross-posting, but how you can see, i got a better chance for an answer. :wink:
Tomorrow i will test this extension, i hope i make it.
I think it not seems easy to read the extension-explanations. :frowning: