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 & HelpOpenGL and 3D Libraries › Someone explain PGraphics3
Page Index Toggle Pages: 1
Someone explain PGraphics3? (Read 1482 times)
Someone explain PGraphics3?
Oct 10th, 2005, 8:47pm
 
Hello there,

I see vast use of the PGraphics3 class, however I am not able to find a reason for this. I see that it inherits from PImage and extends it by texturing and more 3D functions etc, I guess there is no performance benefit in openGL, what I am naivly assuming why people use it even in cases where they dont make use of such funcitonalities, is it?

I would suggest and highly welcome putting something about this in the reference or any place to find infos about it, since its quite hard to figure these things out or to have a clear opinion about it for newbies like me...but any answer would be welcomed furiously Smiley
Re: Someone explain PGraphics3?
Reply #1 - Oct 10th, 2005, 10:18pm
 
I use it to get alpha on my textured polygons:
http://wliia.org/projects/particle3D/v2/

but i mostly use it for generating textures, as it is more flexible than a PImage..
for example:
PGraphics3 p = new PGraphics3(200,200,null);
p.fill(255);
p.rect(100,0,100,200);
p.text("helloo",100,100);

-seltar
Re: Someone explain PGraphics3?
Reply #2 - Oct 10th, 2005, 10:46pm
 
Thanks for that - talking of alpha, can I e.g. make a PGraphics3, set pixels with semi-transparent color and render it over another image?

And if yes, how Smiley

P.S: the upper example produces an exeption
Re: Someone explain PGraphics3?
Reply #3 - Oct 12th, 2005, 12:43am
 
I was wondering how the hell someone had managed to get that PG3 thing to bloody work. Likes images it seems. Nothing else though. What the hell is going on?
Code:

PGraphics3 wontWork;
PImage a;
void setup(){
size(200,200,P3D);
a = loadImage("a.gif");
wontWork = new PGraphics3(100,100,null);
wontWork.background(110,20,40);
wontWork.image(a,20,20); //the only line that works
wontWork.fill(255,30,40);
wontWork.rect(10,10,100,100);
}
void draw(){
image(wontWork,0,0);
}


Oh, and I think if you were going to set transparency of pixels one by one you might try setting a color with alpha: color(255,255,255,100); and using point(). Don't know if it works on the pixel array itself. I think what I'm suggesting is a bit slow though, it would require a table of readymades - which isn't such a bad thing, just depends what you're doing.
Re: Someone explain PGraphics3?
Reply #4 - Oct 12th, 2005, 9:03am
 
hey St33d,

check out the dev-docs, there you can see what they are about:

http://dev.processing.org/reference/core/javadoc/

"Subclass of PGraphics that handles 3D rendering.
Lighting and camera implementation by Simon Greenwold."

OT:
Regarding that alpha thingie - my problem is, that I want to have a mask at a certain place - and move a bitmap UNDER it...but masks always apply to bitmap-pixel themselves...so I was wondering if theres any chance for that...Prolly I need to make an inverted mask on top of the real image...
Re: Someone explain PGraphics3?
Reply #5 - Oct 12th, 2005, 10:20am
 
after making a PGraphics3, you should type varname.defaults(); so that it resets to it's default settings.. don't know quite why, but this seems to get rid of alot of problems..

another thing i had a problem with though was fill(255), then rect().. it drew the rectangle, but it was black.. stroke works on both rect and ellipse though..

-seltar
Page Index Toggle Pages: 1