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

Why does my ofImage.draw() not fill the screen?

$
0
0

@chrisoffner3d wrote:

Hi everyone, I’m very much new to OF and struggling with trying to draw to my screen pixel by pixel.
I’m running my app in OF_FULLSCREEN and have:

    ofImage theScreen;
    int pixelCount;

and

void ofApp::setup() {
    ofBackground(0);
    pixelCount = ofGetWidth() * ofGetHeight();
    theScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
}

// ...

void ofApp::draw() {
       
    for (int k = 0; k < pixelCount; k++) {
        theScreen.setColor(k, ofColor(ofRandom(255), ofRandom(255), ofRandom(255)));
    }
    theScreen.update();
    theScreen.draw(0,0, ofGetWidth(), ofGetHeight());
}

Yet the resulting image (static noise) only covers the top quarter of my screen:

Any idea what I’m doing wrong here?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles