When I try to draw an bezierVertex on a PGraphics2D object if got the error:
java.lang.RuntimeException: A call to vertex() must be used before bezierVertex()
at processing.core.PGraphics.bezierVertex(PGraphics.java:1004)
at processing.core.PGraphics.bezierVertex(PGraphics.java:978)
at Temporary_782_6492.draw(Temporary_782_6492.java:21)
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:613)
and with PGraphicsJava2D if got the following error:
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_3080_1244.draw(Temporary_3080_1244.java:23)
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:613)
with PGraphics3D it works but there is the fill bug.
Quote:
import processing.opengl.*;
PGraphics pg = createGraphics(100, 100, P3D);
void setup(){
size(400,400);
pg.beginDraw();
pg.translate(pg.width/2,pg.height/2);
pg.stroke(0);
pg.background(255);
pg.beginShape();
pg.vertex(30, 20);
pg.bezierVertex(80, 0, 80, 75, 30, 75);
pg.bezierVertex(50, 80, 60, 25, 30, 20);
pg.endShape();
pg.endDraw();
}
void draw(){
image(pg,random(width),random(height));
}