openframeworks / openframeworks/openFrameworks
Drawing using ofGetMousePressed() inside draw() causes flickering
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I was trying one of the firsts examples inside the Graphics section of ofBook and noticed something odd. When creating a simple brush using 2D primitives, once I release the mouse the last shape that has been drawn flickers.
Here is the code:
void ofApp::setup(){
ofSetBackgroundAuto(false);
}
void ofApp::draw(){
if (ofGetMousePressed(OF_MOUSE_BUTTON_LEFT)) {
ofSetColor(ofRandom(255), ofRandom(255), ofRandom(255));
ofDrawCircle(ofGetMouseX(), ofGetMouseY(), 20);
}
}
I've tried to upload a video to show what's happening but the online compression makes the flickering go away.
OpenFrameworks 0.9.3
XCode 7.3.1
OSX 10.11.6
Macbook Pro 11,5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the ofBook Brushes with Basic Shapes example and the supplied setup() and draw() code as the reproduction. Compare behavior while the mouse is pressed and after release; done means the final circle no longer flickers after release, with the behavior checked on the stated OpenFrameworks 0.9.3, Xcode 7.3.1, and macOS setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100