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 › Default PGraphics object
Page Index Toggle Pages: 1
Default PGraphics object? (Read 634 times)
Default PGraphics object?
Nov 18th, 2009, 8:54am
 
I have a function draws a 3D object. It is a rather complicated object, so there are many calls to vertex() and fill() and the like.

At the moment it draw the object to a given PGraphics object:

Quote:
void DrawObject(PGraphics drawTo){
  drawTo.beginDraw();
  drawTo.beginShape(QUADS);
  drawTo.vertex( 0, 0, 0 );
  drawTo.vertex( 1, 0, 0 );
  // etc...
}



Which works great... until I want to draw this to the default PGraphic object. I suppose I could copy the function and rewrite it:

Quote:
void DrawObject(){
 beginShape(QUADS);
 vertex( 0, 0, 0 );
 vertex( 1, 0, 0 );
 // etc...
}



but I'd much rather just be able to call my first function with the default PGraphics object... the trouble is, I can't seem to find a way to locate a reference to it! Can I? Have I missed something obvious, or what?
Re: Default PGraphics object?
Reply #1 - Nov 18th, 2009, 10:14am
 
DrawObject(g);
Re: Default PGraphics object?
Reply #2 - Nov 18th, 2009, 4:49pm
 
Fantastic, thanks.
I think that certainly falls into the "something obvious" category.  Roll Eyes
Page Index Toggle Pages: 1