Hello guys,
I come from Processing and I have some questions about openframeworks.
(any answer is welcome)
Is there any alternative to set stroke weight for ofLine() with rounded corners ? I’ve read something about Glut hints but it was an old post.
A simple circle doesn’t look very smooth when using ofCircle(), is that the default renderer? I’ve tried with ofEnableSmoothing() but it didn’t change…
I’m trying to do an array of Arraylists < ofPoints >, I’ve read I should use the “vector” class.
Maybe something like this?
vector < vector < ofPoint> > name(10);
My Processing code is like this, just in case,
int frames = 10;
ArrayList<PVector>[] a = (ArrayList<PVector>[])new ArrayList[frames]; //pmouse
ArrayList<PVector>[] b = (ArrayList<PVector>[])new ArrayList[frames]; //mouse
for (int i=0; i < frames; i++) {
a[i] = new ArrayList<PVector>();
b[i] = new ArrayList<PVector>();
}
void save(int frame, float x, float y, float px, float py) {
a[frame].add( new PVector(px, py) );
b[frame].add( new PVector(x, y) );
}
look into the documentation for ofSetLineWidth() that might help you out there. You can set the line with there to a float pretty easily
look into the documentation for ofSetCircleResolution(). OF doesn’t really draw circles as much as it draws triangles in a circular shape. This method tells it how any triangles to draw to make a circle the higher the number the smoother your circle. I find that setting it to 40 usually makes a circle look fine any circle with a radius 50 px or less.
you can use an Array in OF if you have a set number of items in the array that will never change
in your .h file:
int numPoints = 10;
ofPoint points[numPoints];
in your .cpp
for (int i = 0; i<numPoints; i++){
points[i] = ofPoint(x, y);
}
sure sure that should work. arrays are great for simple structures but honestly I have yet to build an app where using an array’s basic structure was that much faster than a vector’s more complex and more useful structure so its probably better to use a vector if u have the choice.
But if the array of vectors won’t change you might be able to get away with mixing the 2 like you did in your second example.