Alternatives to Depth Test for a Point Cloud


I have an ofMesh of PRIMITIVE_POINTS,
Problem is - the points in the back are hiding points on the front.

I’ve tried DepthTest, but it looks bad with the point cloud (don’t know how to define it, it just looks really bad).

I was wondering if there are alternatives to DepthTest for making the ofMesh be drawn from back to front, and not the other way.



try inversing all z coodrinates when creating the mesh.
Alternativly, you can use a gl command to change how the depth buffer does it depth checking:

void glDepthFunc(GLenum func);
Sets the comparison function for the depth test. The value for func must be GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, or GL_NOTEQUAL. An incoming fragment passes the depth test if its z value has the specified relation to the value already stored in the depth buffer. The default is GL_LESS, which means that an incoming fragment passes the test if its z value is less than that already stored in the depth buffer. In this case, the z value represents the distance from the object to the viewpoint, and smaller values mean the corresponding objects are closer to the viewpoint.

Hi Kj1, Thanks

It doesn’t seems to help. the glDepthFunc brings the same result.
But I’ve just noticed something I didn’t see before -
While the model rotates - it’s not always the background that’s hiding the foreground - it’s simply the same points that are visible, no matter if they’re being at the foreground or background.

Maybe I didn’t use the function correctly? I tried putting it in the setup, and than the draw functions, like this: glDepthFunc(GL_GREATER);

What do you mean by inversing the Z coordinates? I tried to make them negative, but it didn’t help