We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › using PGraphics to draw: methods not implemented
Page Index Toggle Pages: 1
using PGraphics to draw: methods not implemented? (Read 245 times)
using PGraphics to draw: methods not implemented?
Mar 1st, 2008, 8:43pm
 
Hello,

I want the following program to be able to draw in an offscreen buffer. I'm using PGraphics with the library 3D, as the PGraphics help file mentions that the 2D is not fully implemented (devs: is this  going to be available soon?).

Anyway, my question is: why can't I change the width of strokes when I draw on a PGraphics object?

Please run the example to reproduce this.

I suppose the answer is "not yet implemented". In which case I would like to know if there is a way of using an offscreen buffer in order to avoid redrawing the whole surface.

Thanks,

Jean-Baptiste

PGraphics pg;

void setup() {
 size(800, 800);
 pg = createGraphics(1600, 800, P3D);
}

void draw() {
 

if (mousePressed)
{
 
/*  // remove the '/*' comments to see the difference
 stroke(255);
 strokeWeight(3);
 beginShape();
 curveVertex(pmouseX, pmouseY);
 curveVertex(pmouseX, pmouseY);
 curveVertex(mouseX, mouseY);
 curveVertex(mouseX, mouseY);  
 endShape();

*/
 pg.beginDraw();

  pg.stroke(255);
  pg.strokeWeight(3);

 pg.beginShape();
 pg.curveVertex(pmouseX, pmouseY);
 pg.curveVertex(pmouseX, pmouseY);
 pg.curveVertex(mouseX, mouseY);
 pg.curveVertex(mouseX, mouseY);  
 pg.endShape();

 pg.endDraw();

 image(pg, 0, 0);
}


}
Re: using PGraphics to draw: methods not implement
Reply #1 - Mar 1st, 2008, 9:39pm
 
Quote:
why can't I change the width of strokes when I draw on a PGraphics object?

because strokeWeight doesn't make much sense in 3D.

this issue has already been reported here :
http://dev.processing.org/bugs/show_bug.cgi?id=123
Re: using PGraphics to draw: methods not implement
Reply #2 - Mar 1st, 2008, 9:42pm
 
If you don't specifically need 3D, use JAVA2D instead of P3D in your createGraphics. That 2D renderer does work and do strokeWeight, it's P2D that's incomplete.
Re: using PGraphics to draw: methods not implement
Reply #3 - Mar 1st, 2008, 10:06pm
 
cool. My mistake then. Thank you for your help.
Page Index Toggle Pages: 1