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 & HelpPrograms › Access to pixels in P3D
Page Index Toggle Pages: 1
Access to pixels in P3D (Read 893 times)
Access to pixels in P3D
Jun 30th, 2005, 8:58pm
 

How can I access the pixels of the screen in P3D mode to do post processing on the 3d image? (If that's possible)
Re: Access to pixels in P3D
Reply #1 - Jul 3rd, 2005, 3:58pm
 
There's 2 ways to access the pixels,

1:
Code:
void draw()
{
<do your normal stuff>
x=width/2;
y=height/2;
color c=get(x,y);
set(x,y,color(255,0,0));
}


It's also fairly simple to directly access the pixels,
2:
Code:
void draw()
{
<do your normal stuff>
loadPixels();
x=width/2;
y=width/2;
pixels[x+y*width]=color(255,0,0);
updatePixels();
}


These example will set the middle pixel to red.. you can access any on screen pixel with get(x,y) or pixels[x + ( y*width )] both for reading and writing.

get/set are slower than pixels[] but slightly easier to start with.
Page Index Toggle Pages: 1