How do I draw a single point and affect its thickness?

How do i create a single point in oF and set its thickness?
ofPoint doesnt work and ofVertex doesnt display the point.

the equivalent of what I’m trying to achieve in processing is:

background(0);
stroke(255);
strokeWeight(10);
point(500,500);

Additionally is there anyway I can connect these two points to create a line - for example if im trying to plot points of a graph?

Cheers!

hello,

it depends on how you need the points to be created / managed
you can use a mesh. But each point of the mesh will be affected the same way

mesh.setMode(OF_PRIMITIVE_POINTS);  
glPointSize(2);

or maybe just draw a circle after setting its radius

ofDrawCircle(point.x, point.y, radius);
1 Like

ofMesh is what i need to look more into!

I confused myself a little bit with what I’m trying to achieve.

The solution with ofDrawCircle works but there is no way to connect two circle points - And ofBegin/EndShape doesnt work with ofVertex if you only specifiy two points :frowning:
*In the example of a graph, if you try to plot points, the last point in the graph attaches to the first point when using ofBegin/EndShape, since its drawing a polygon which must be closed.

But yess - ofMesh is my new friend!
Cheers!

ok.
note that there is a max point size when using glPointSize() though

ahh i figured out my problem:

ofSetPolyMode(OF_POLY_WINDING_ODD); // the last and first vertex are only connected if set to POLY_WINDING_NON_ZERO

ofSetColor(240);
ofNoFill();

ofSetLineWidth(1);

ofBeginShape();
xoff=0;


for(int i=0; i<ofGetWidth();i++)
{
     yt= ofNoise(xoff)*ofGetHeight();
    
ofVertex(i, yt);
    
    xoff+=0.01;

}

ofEndShape();

the polywinding is not really related to closing the shape. when calling ofEndShape() you can use ofEndShape(true) it’ll close the shape when finishing

1 Like

that makes a lot more sense!! exactly what are the different PolyModes?

it’s a way of defining what happens when several polygons overlap, you can see an example in the polygonExample, the last line shows the different modes. the docs for ofPath also have some explanation about it:

http://openframeworks.cc/documentation/graphics/ofPath/#show_setPolyWindingMode

the image link seems to be broken right now but you can find it here:

2 Likes