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

Pixelcheck on screen

$
0
0

@slinshady89 wrote:

Hey I want to highlight one after another pixel on the screen in a different color than the backround for each pixel.
the backround of the screen will be white and the then one after another pixel should be highlighted in another color. The pixel should be highlighted for about 0.5s maximal, maybe less, but should be white after that again. If I use the Sleep(0.5) the hole screen stays black for the amount of pixels multiplied by 0.5s ?
Could you tell me what I did wrong and why i cant see the progress if I run the program?

void ofApp::draw() {

  // make white plane
  ofSetColor(255, 255, 255);
  ofDrawRectangle(0, 0, 1920, 1080);

  // get screen resolution
  int horizon = ofGetWindowWidth();
  int vert = ofGetWindowHeight();
  // output of screen resolution for testing
  string text = "width " + to_string(horizon) + " height " + to_string(vert);
  ofDrawBitmapStringHighlight(text,ofPoint(10,10,0.0),ofColor::white,ofColor::black );

  ofColor::red;
  ofDrawSphere(100,100, 1);
  Sleep(2500);
  ofColor::white;
  ofDrawSphere(100, 100, 1);
  Sleep(2500);
  ofColor::red;
  ofDrawSphere(200, 200, 1);
  Sleep(2500);
  ofColor::white;
  ofDrawSphere(200, 200, 1);
  Sleep(2500);

  /*  for (int i = 0; i <= horizon; i++)
  {
    for (int j = 0; j <= vert; j++)
    {
      ofColor::white;
      ofDrawSphere(i, j, 1);
      Sleep(500);
      ofColor::red;
      ofDrawSphere(i, j, 1);
    }
  }*/
}

later I want to run the bottom loop instead of the test scanrio with 2 pixels

EDIT: is it even possible to do this with the draw function or am I allowed to work with this like an image? To precise my issue: I want to render every ~0.5sec a new frame in which a specified pixel goes from (0,0) to (0,1)... like in the 2 for-loops. Or do I have to work totally differently and write function that calls void ofApp::draw() every 0.5sec with changing initial values

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Latest Images

Trending Articles



Latest Images