# Drawing a small triangle instead of a ofPoint on a mesh

Dear All,

I am drawing points (lat/lon) on a sphere like so:
mesh.addVertex(ofPoint(lat,lon, 0)); // make a new vertex

However, the point is tiny and barely observable,  and I want to be able to draw a triangle instead. Should I interpolate the verices of a triangle around the ofPoint or is there another alternative?

Thanks,

There are a few ways to do this! The simplest would be to forgo triangles and just size up your GL points:

``````glPointSize(3.0);
``````

Try a few different values (it takes in a float value) and see how that works for you. At larger sizes, it may get a little slow depending on your machine.

Another route is to use a geometry shader. Check out the built in example of/examples/gl/geometryShaderExample, which converts lines to triangle strips. Below is a small shader I wrote to convert gl points into circles; you can try changing the “circleRes” to 3 to make it emit triangles.

Here’s an example of this shader in use:
https://github.com/robotconscience/OF-GPU-Flocking

Hope this helps!

``````#version 120

uniform float pointSize;
uniform float screenSize;

const float PI = 3.1415926;

void main(void){

float circleRes = 12.0;
float size = pointSize / screenSize;

for ( float a = 0; a < circleRes; a++ ){
// Angle between each side in radians
float ang = (PI * 2.0 / circleRes) * a;

vec4 offset = vec4(cos(ang) * size, -sin(ang) * size, 0.0, 0.0);
gl_Position = gl_PositionIn + offset;
gl_FrontColor = gl_FrontColorIn;
EmitVertex();

ang = (PI * 2.0 / circleRes) * (a + 1);
offset = vec4(cos(ang) * size, -sin(ang) * size, 0.0, 0.0);
gl_Position = gl_PositionIn + offset;
gl_FrontColor = gl_FrontColorIn;
EmitVertex();

gl_Position = gl_PositionIn;
gl_FrontColor = gl_FrontColorIn;
EmitVertex();
}

EndPrimitive();

}
``````