-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Second beginDraw / endDraw call clears PGraphics object when created w/ P2D #641
Comments
Despite being rather limited in terms of true programming skills, I ventured to have a look at what PGraphicsOpenGL.beginDraw() actually is doing and though I understand very little of what's going on there, I was intrigued by the
|
@rapatski -- thanks for sharing. Confirmed on Processing 3.5.4 / macOS 10.12. Here is an even simpler side-by-side test case. Create a P2D and default PGraphics, loop beginDraw/endDraw on each 4 times -- the first draw for P2D is missing.
|
This is also broken on Processing 4.0b1/MacOS 11.6.4 |
I have this issue only from setup() to draw(). |
I believe I found the issue and fixed it. setViewport();
if (primaryGraphics) {
beginOnscreenDraw();
} else {
beginOffscreenDraw();
}
checkSettings();
setViewport();
checkSettings();
if (primaryGraphics) {
beginOnscreenDraw();
} else {
beginOffscreenDraw();
} The problem is that the A workaround can be calling begin/endDraw once at the very start. This "stabilises" the initialised and sized variables. graphics.beginDraw();
graphics.endDraw(); I want to do further testing, but will submit a pull request if I can't find anything wrong with this approach. |
Merged #728 for 4.3. Thanks for the report! |
Description
Stumbled upon this just now - seems like beginDraw() / endDraw() clear the canvas of a PGraphics object when that object is created with the P2D renderer.
Expected Behavior
I expect the beginDraw() method not to change anything in the PGraphics object it's called on.
Current Behavior
Calling beginDraw() on a PGraphics object created with P2D and populated previously will clear it.
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: