ofSetBackgroundAuto(false) and OF_BlendMode_ADD

I want to draw track so I use ofSetbackgroundaAuto(false), and l want to represent luminescence so l use ofenableblendmode(of-blend mode-add).However, that is bad result. I understand the reason, but l have no idea to represent track and luminescence.

void ofApp::setup(){

/*#define num 100↓ */
for(int i = 0; i < num; i++){
    pos[i] = ofVec2f(ofRandom(ofGetWidth()),ofRandom(ofGetHeight()));
    speed[i] = ofVec2f(ofRandom(-10,10),ofRandom(-10,10));
}
ofEnableBlendMode(OF_BLENDMODE_ADD);
/*to represent track*/

ofSetBackgroundAuto(false);
}

void ofApp::update(){
for(int i = 0; i < num; i++){
if(pos[i].x > ofGetWidth()){
speed[i].x *= -1;
}else if(pos[i].x < 0){
speed[i].x *= -1;
}if(pos[i].y > ofGetHeight()){
speed[i].y *= -1;
}else if(pos[i].y < 0){
speed[i].y *= -1;
}

    pos[i] += speed[i];
}

}
void ofApp::draw(){
ofSetColor(255);

for(int i = 0; i < num; i++){
    ofDrawCircle(pos[i],5);
}


/*to represent track*/
ofSetColor(0,0,0,50);
ofDrawRectangle(0,0,ofGetWidth(),ofGetHeight());

}

can you please post a small code example we can run that shows what you are trying to do and the problem you are seeing?

1 Like