I'm using the Processing library in Netbeans and I have a PGraphics object, in which I create vertex shapes. This works fine in JAVA2D (
image here) but not in P2D. I have it working, so that's all good - but was wondering what the problem is with P2D?
I'm drawing polygons, playing with this library for loading shapefiles (which I don't see in the library list, btw...)
There's a method I pass the PGraphics to, in an object where the polygon data sits. I'm doing it this way so I can draw once, then re-use the image. Anything else is waaay too slow. Method below. In JAVA2D, "do we get here" gets to screen, in P2D not, so it seems to be closing the shape (pg.endShape) that fails: it just hangs.
Any thoughts?
While I'm writing: another shapefile loader in the library (new, MapThing) links only to docs, not to the download zip. I found the zip here.
cheers...
I'm drawing polygons, playing with this library for loading shapefiles (which I don't see in the library list, btw...)
There's a method I pass the PGraphics to, in an object where the polygon data sits. I'm doing it this way so I can draw once, then re-use the image. Anything else is waaay too slow. Method below. In JAVA2D, "do we get here" gets to screen, in P2D not, so it seems to be closing the shape (pg.endShape) that fails: it just hangs.
Any thoughts?
While I'm writing: another shapefile loader in the library (new, MapThing) links only to docs, not to the download zip. I found the zip here.
cheers...
- public void drawShapeToPGraphics(PGraphics pg) {
pg.fill(100);
pg.stroke(255);
pg.beginShape();
for (double[] pts : points) {
pg.vertex((float) pts[0] * 1000, 1000 - ((float) pts[1] * 1000));
}
pg.endShape(pg.CLOSE);
System.out.println("do we get here?");
}//end method
1