Artifacts when modifying gl_PointSize

I have a program that draws a series of points distributed in the scene. Added to that, I have a vertex shader that I use, among other things, for modifying the size of the points according to the distance to the points from the viewer using gl_PointSize.

Without the usage of gl_PointSize, the scene draws without problems, I can even call glPointSize(the opengl instructin) outside of the shader without any problem, however when using gl_PointSize(the glsl variable) I get the following artifacts (the green and purple points are part of my simulation. The artifacts are the ones that are sort of arranged in lines.)

When zooming in (the point size increases):

Some additional information:

  • It doesn’t matter what value I send to gl_PointSize, even when sending it a 1 the line artifacts will show.
  • I am properly calling glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
  • Calling glEnable(GL_POINT_SPRITE); doesn’t help one way or the other
  • Not calling either one of those makes it so that gl_PointSize no longer affects the size of my points, but the line artifacts still appear.
  • So in summary, the mere action of assigning a value of gl_PointSize causes the error.
  • The points are being drawn using a glDrawArrays. I’m positive that I’m not overflowing the array where the points coords are located.

I’d appreciate if anyone could point me in the right direction to correct this.

Let me guess… are you perhaps using an ATI HD type of gfx-card?

Negative. NVIDIA GTX 280, driver version 180.29

Just for future reference, I changed a lot of things and it ended up magically solving itself, but I think what did it is that somehow I was causing memory corruption when passing my attributes and uniforms to the shader. Changing an array I was passing as a TexCoordPointer to a generic attribute and clearing up some uniforms I didn’t strictly need seems to have corrected the problem.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.