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.
Page Index Toggle Pages: 1
Z-buffer? (Read 1974 times)
Z-buffer?
May 7th, 2005, 7:40pm
 
Can the Z-buffer be read and written to similar as the pixel array?
Re: Z-buffer?
Reply #1 - May 7th, 2005, 8:15pm
 
I think you can to some extent.
(at least in ALPHA you could)

g.zbuffer[] is similar to pixels[], but is an array of floats I think.

Edit: Having just checked, I'm not sure it's the same with BETA unfortunately. Probbaly because of all the P3D/OPENGL stuff.
Re: Z-buffer?
Reply #2 - May 7th, 2005, 8:18pm
 
in P3D yes, but not with OPENGL. tho it's in zbuffer coordinates (not z values) so you're gonna get some weirdness when you mess with it.

this oughta work: Code:

PGraphics3 p3 = (PGraphics3) g;
println(g.zbuffer[300]); // gimme a value, it's an array of floats
Re: Z-buffer?
Reply #3 - May 18th, 2005, 3:31pm
 
I'm having some problems with this z-buffering..
the code you provided didn't work, and you can see, my sketch is pretty messed up
http://wliia.org/projects/walkaround/

Is there any way to calculate which tree should be rendered first, or another way to use this zbuffer?
It looks pretty lame when the tree furthest away is in front of the tree you are standing right in front of

by the way, all the textures and "level" is temporary, when the code works, it'll get better..

-seltar
Page Index Toggle Pages: 1