@Gallo wrote:
hello,
i am facing a problem i can't solve.
i am creating a matrix of plain circles which i assign a color.
i defined a method in my Ball class which i use to set a color in ball setup :
ball::setup(float x, float y, float radius, ofColor c);
This method is written like follows :
void ball::setup(float x, float y, float r, ofColor col) { pin = ofPoint(x, y); position = pin; radius = r; velocity = ofPoint(0, 0); areaRadius = 25; dist = ofPoint(0,0); color.set(col); }
i setup every ball like so :
this one works fine
balls.back().setup(x * ballRadius * 2, y * ballRadius * 2, ballRadius, ofColor(ofRandom(16), ofRandom(16), ofRandom(16)));
but now i want to use an image to define each circle color :
in my ofApp::setup()
if(!image.loadImage("test.jpg")) cout << "error loading image" << endl; image.resize(nbX, nbY);
then i setup each circle color
balls.back().setup(x * ballRadius * 2, y * ballRadius * 2, ballRadius, image.getColor(x, y));
this doesn't work. I have only white circles.
How come ?
Posts: 3
Participants: 1