-
-
Notifications
You must be signed in to change notification settings - Fork 297
Making a new PGraphics and displaying causes NullPointer #53
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
Comments
Oddly, the second example didn't look right when background was 0; |
Why did this get left in the dust? The issue is most certainly still present. Additionally the loadPixels workaround now seems to produce the same error itself. |
Note that, in order to be able to use a PGraphics correctly, you need to call beginDraw()/enDraw(), as detailed in the tutorials and reference. I'm able to run the following code without any errors:
Please indicate in what specific situations you see the NPE error (also adding what version of the Android mode are you using, and device). |
Looking back, I think my issue was actually more centered around trying to render a global PGraphics before it's been drawn to at all. I think I solved it by just drawing a background right after creating it. I guess I can see the reasoning behind an uninitialized canvas being partly treated as null. |
That's right, before calling beginDraw()/endDraw() at least once, then the PGraphics is not properly initialized for rendering. I think this clarifies the issue, so it can be closed now. |
Saturday May 31, 2014 at 12:19 GMT
Originally opened as processing/processing-android-archive#68
The simplest form of this is:
To rectify it, you need to type:
The text was updated successfully, but these errors were encountered: