Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofImage.setColor() not working

$
0
0

@JackKalish wrote:

I guess this should be pretty simple, but when I draw the image I'm getting a short white line followed by a bunch of random pixel colors. Can someone explain to me why / what I'm doing wrong? Thanks. Screenshot attached below.

//header
ofImage strip;

//cpp file
//--------------------------------------------------------------
void VisualSystem::setup(){
    strip.allocate(75, 1, OF_IMAGE_COLOR);
}

//--------------------------------------------------------------
void VisualSystem::update(){
   //set pixels of image object
    for(int i=0; i<strip.getWidth(); i++){
        ofColor c;
        c.set(255, 0, 0);
        strip.setColor(i, c);
    }
    strip.update();
}

//--------------------------------------------------------------
void VisualSystem::draw(int x, int y){
    strip.draw(x, y);
}

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles