Dots outline based on facing direction

Hey oF people,

I’m currently working on an app where I draw a ton of points distributed in 3D across a big spherical shell. I am using an ofVboMesh to draw the points and give them different sizes by using the setAttributeData method in the Vbo.

I’m having trouble with my points at the moment. For some reason some of them appear to have a black outline around them and some do not. This means that half of them look very bright while the others look much darker. It seems to depend upon the angle at which I’m viewing the points. I think it’s likely to do with the direction that the points are facing. Does anyone know a way to force all the points to face the camera? (ie billboarding?). I’ve attached some images which hopefully illustrate the issue.

the relevant code is here:

in ofApp.h:

    ofShader starPoints;
    ofVboMesh celestialSphere;
    ofEasyCam cam;
    float rotation;
    vector<float> pointSize;

in Setup():

  celestialSphere.getVbo().setAttributeData(starPoints.getAttributeLocation("point_size"), &pointSize[0], 1, pointSize.size(), GL_DYNAMIC_DRAW, sizeof(float));

in Draw():

    ofRotate(rotation, 0.5, 1, 0);

After a bit of searching I found the following works:

Add the line: glEnable(GL_POINT_SPRITE);


Hope this helps someone avoid getting tripped up in the future!

Also I’m not entirely sure why this works. Anyone with some good GL knowledge out there who can explain it to me?



Turns out this actually does not work. It gets rid of the outlines but it draws the points as squares not circles.

I imagine the way to solve this would be to tell openGL about a circular point sprite but I’m not sure how to do that. will continue looking!

Ok so I did finally solve this using the “points as textures” example in the openFrameworks folder under GL.

Great example!

All resolved :slight_smile:

Actually, my final issue is that if I do a depth test it doesn’t seem to work properly.

Will post links tomorrow.