As the title implies, is it possible (in an ofMesh using OF_PRIMITIVE_POINTS) to alter the point size individually ?
you need a shader for this and to pass a custom attribute in a fbo. the easiest is probably to use an ofVboMesh, access it’s ofVbo and add a custom attribute with the point sizes then in the vertex shader use that attribute to set the point size, for example:
ofVboMesh mesh:
vector<float> pointSize;
ofShader shader;
// for each vertex
mesh.addVertex(v);
pointSize.push_back(psize);
mesh.getVbo().setAttributeData(shader.getAttributeLocation("point_size"), &pointSize[0], 1, pointSize.size(), GL_DRAW_STATIC, sizeof(float));
then in the shader you’ll have something like:
in vec3 position;
in float pointsize;
int main(){
gl_Position = modelViewProjectionMatrix * position;
gl_PointSize = pointsize;
}
this is opengl 3 syntax so you need to set that in main or use the corresponding opengl 2 syntax in the shader
2 Likes
Thank you Arturo. I need to study a lot more about shaders but this is a good hint to start!