FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 419 : createGraphics() having problems with JAVA2D, and sometimes with P3D
Last modified: 2006-11-09 10:42
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
FIXED -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
Daniel Shiffman
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2006-10-15 12:56
Using revision 0118
Mac OSX, powerbook
A small modification to the PGraphics example produces an error.
PGraphics pg;
void setup() {
size(200, 200);
pg = createGraphics(200, 200,P2D);
pg.beginDraw();
pg.rect(100,100,10,10);
pg.endDraw();
noLoop();
}
void draw() {
image(pg, 0, 0);
}
Error is as follows:
java.lang.NullPointerException
at processing.core.PGraphics2D.thin_pointAtIndex(PGraphics2D.java:1173)
at processing.core.PGraphics2D.thin_flat_line(PGraphics2D.java:1284)
at processing.core.PGraphics2D.rectImpl(PGraphics2D.java:716)
at processing.core.PGraphics.rect(PGraphics.java:1266)
at Temporary_1617_6745.setup(Temporary_1617_6745.java:8)
at processing.core.PApplet.handleDisplay(PApplet.java:1237)
at processing.core.PGraphics.requestDisplay(PGraphics.java:568)
at processing.core.PApplet.run(PApplet.java:1406)
at java.lang.Thread.run(Thread.java:552)
Seems to be failing on either the pixels array or the zbuffer array?
// expects offset/index in pixelbuffer array instead of x/y coords
// used by optimized parts of thin_flat_line() [toxi]
private void thin_pointAtIndex(int offset, float z, int color) {
pixels[offset] = color;
zbuffer[offset] = z;
}
Additional Comment
#1 From fry 2006-10-15 12:58
P2D doesn't exist yet. you're probably looking for JAVA2D?
Additional Comment
#2 From fry 2006-10-15 13:00
ah, i see the problem. we need to fix the reference since it should use P3D
(or JAVA2D). re-assigning to casey as a reference bug.
Additional Comment
#3 From Daniel Shiffman 2006-10-15 13:05
Ok, I still get an error with JAVA2D:
java.lang.NullPointerException
at java.lang.System.arraycopy(Native Method)
at
sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:427)
at processing.core.PGraphicsJava2D.updatePixels(PGraphicsJava2D.java:1064)
at processing.core.PGraphicsJava2D.imageImpl(PGraphicsJava2D.java:578)
at processing.core.PGraphics.image(PGraphics.java:1997)
at processing.core.PApplet.image(PApplet.java:7074)
at Temporary_850_3963.draw(Temporary_850_3963.java:13)
at processing.core.PApplet.handleDisplay(PApplet.java:1311)
at processing.core.PGraphics.requestDisplay(PGraphics.java:568)
at processing.core.PApplet.run(PApplet.java:1406)
at java.lang.Thread.run(Thread.java:552)
However, if I add loadPixels & updatePixels, the error goes away, but
nothing is viewable onscreen?
PGraphics pg;
void setup() {
size(200, 200);
pg = createGraphics(200, 200,JAVA2D);
pg.loadPixels();
pg.beginDraw();
pg.background(0);
pg.stroke(255);
pg.noFill();
pg.rect(100,100,10,10);
pg.updatePixels();
pg.endDraw();
}
void draw() {
image(pg, 0, 0);
}
Additional Comment
#4 From fry 2006-10-28 06:53
createGraphics() hasn't quite been worked out yet, need to fix things.
drawing images from createGraphics back to the screen doesn't work with
JAVA2D and only works sometimes with P3D.
the reference also needs to have P2D removed from the createGraphics
example, which has happened in subversion, but hasn't yet been update on
the processing site or in the download.
Additional Comment
#5 From REAS 2006-11-01 13:50
The createGraphics() reference entry is now updated on the site
Additional Comment
#6 From fry 2006-11-05 14:18
createGraphics() should be repaired for 0120. it now properly handles (by
default) an ARGB drawing surface that's transparent, and can subsequently
be drawn back into another PGraphics as necessary.
Additional Comment
#7 From Stephen 2006-11-09 05:37
I hope I am not raising alarm too soon but I have tested todays code in
subversion to see if I still have the problem I described in ...
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1162572625
Unfortunatly the problem is still there.
Additional Comment
#8 From fry 2006-11-09 10:37
then it's a different issue, please file a new bug for it because this one
has been closed and fixed.
Additional Comment
#9 From Stephen 2006-11-09 10:42
http://dev.processing.org/bugs/show_bug.cgi?id=428
I have also uploaded the script here.
Before I logged the bug here Im afraid I logged in the wrong place i.e.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1162572625
... so I might have confused things a bit. Sorry, next time will be better.
Keep up the good work :)