FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 482 : createGraphics with P3D context not properly handling depthbuffer
Last modified: 2007-10-15 11:38
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
FIXED -
Pr
i
ority:
P1
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
vade
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2007-01-13 12:10
Hello. I am a bit anxious in reporting this as a bug, as I am not 100% certain if this is a
user error or a genuine bug. Ive posted in the syntax forum - but recieved no response.
Hardware: OS X 10.4.8, Macbook Pro 2.33Ghz - 256MB Vram
Processing Rev : 0123
The following code acts a bit odd. It seems as though the depth/zbuffer is empty when using
a P3D offscreen context with PGraphics:
Note the fill colors do not work, and when moving the mouse the offscreen context(s) inherit
the background color as a fill color when drawn.
I am assuming I am doing something wrong, but the code seems pretty straightforward. Is
this infact a bug? If not - apologies for incorrectly reporting.
Thank you.
[code]
//create offscreen graphics buffers
PGraphics context1;
PGraphics context2;
void setup()
{
size(300,300,P3D);
//initialize our offscreen graphics buffers
context1 = createGraphics(width-20,height-20, P3D);
context2 = createGraphics(width-20,height-20, P3D);
}
void draw()
{
background(mouseY,0,0);
lights();
pushMatrix();
translate(58, 48, 20);
rotateY(0.5);
fill(200,0,200);
stroke(200,0,200);
box(40);
popMatrix();
if(mousePressed)
{
//only draw our contexts if we need them..
context1Draw();
context2Draw();
noTint();
image(context1,10,10);
tint(0,0,0,mouseX);
image(context2,10,10);
}
}
void context1Draw()
{
context1.beginDraw();
context1.background(200);
context1.lights();
context1.fill(200,200,0);
context1.stroke(200,200,0);
context1.translate(58, 48, 0);
context1.rotateY(0.5);
context1.box(40);
context1.endDraw();
}
void context2Draw()
{
context2.beginDraw();
context2.background(100);
context2.lights();
context2.fill(0,0,200);
context2.stroke(0,0,200);
context2.translate(58, 48, 0);
context2.rotateY(-0.5);
context2.sphere(40);
context2.endDraw();
}
[/code]
Additional Comment
#1 From JohnG 2007-01-18 03:56
Minimal version:
PGraphics context1;
void setup()
{
size(300,300,P3D);
context1 = createGraphics(width-20,height-20, P3D);
}
void draw()
{
/* background(mouseY,0,0);*/
stroke(0,255,0);
line(0,0,width,height);
context1.beginDraw();
context1.background(0,0,0);
context1.fill(0,0,255);
context1.stroke(200,0,0);
context1.translate(60, 60, 0);
context1.box(40);
image(context1,0,0);
}
Additional Comment
#2 From fry 2007-01-29 19:25
will get this on the list to be fixed soon.
Additional Comment
#3 From fry 2007-10-15 11:38
fixed in release 0127.