FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 424 : Shapes with texture and P3D rendering, are not following z-order directives
Last modified: 2006-10-30 07:01
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
INVALID -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
fjoselevich
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Sketch example with its png
application/octet-stream
2006-10-26 03:02
2.73 KB
Description
: Opened: 2006-10-26 02:59
I'm testing on 0119 and found that, if setting up a P3D environment, planes
with texture applied to them, doesn't respect the z-order stablished for them.
This is being tested on a Windows XP SP2, with an nVidia GeForce GO 7700
video card.
code example:
[code]
PImage imagen;
void setup() {
size(300,300,P3D);
noStroke();
imagen = loadImage("bola1.png");
}
void draw() {
background(255);
fill(255,0,0);
pushMatrix();
translate(width/2,height/2,100);
beginShape();
texture(imagen);
textureMode(NORMALIZED);
vertex(-13,-13, 0, 0, 0);
vertex( 13,-13, 0, imagen.width, 0);
vertex( 13, 13, 0, imagen.width, imagen.height);
vertex(-13, 13, 0, 0, imagen.height);
endShape();
popMatrix();
fill(0,0,255);
pushMatrix();
translate(width/2,height/2,-200);
beginShape();
texture(imagen);
textureMode(NORMALIZED);
vertex(-13,-13, 0, 0, 0);
vertex( 13,-13, 0, imagen.width, 0);
vertex( 13, 13, 0, imagen.width, imagen.height);
vertex(-13, 13, 0, 0, imagen.height);
endShape();
popMatrix();
}
[/code]
Additional Comment
#1 From fjoselevich 2006-10-26 03:02
edit
]
Sketch example with its png
Additional Comment
#2 From fry 2006-10-28 10:07
translate() with a z-coordinate of 100 is going to put those shapes past
the camera, where you'll get undefined behavior or the shapes will be
removed. see the reference on the coordinate system regarding this:
http://processing.org/reference/environment/index.html#Coordinates
you're also using textureMode() incorrectly:
http://processing.org/reference/textureMode_.html
Additional Comment
#3 From fjoselevich 2006-10-30 00:42
There's no reference on the documentation about the z-coordinate on 100.
How does it works?
Yeah, the syntax on the "textureMode" code is incorrect but it does the
same with the textureMode(IMAGE) setted.
This code has the suggested corrections but still has the same problem: the
two shapes have the same size but the farest shows inside the closest.
PImage imagen;
void setup() {
size(300,300,P3D);
noStroke();
imagen = loadImage("bola1.png");
}
void draw() {
background(255);
fill(255,0,0);
pushMatrix();
translate(width/2,height/2,10);
beginShape();
texture(imagen);
textureMode(IMAGE);
vertex(-13,-13, 0, 0, 0);
vertex( 13,-13, 0, imagen.width, 0);
vertex( 13, 13, 0, imagen.width, imagen.height);
vertex(-13, 13, 0, 0, imagen.height);
endShape();
popMatrix();
fill(0,0,255);
pushMatrix();
translate(width/2,height/2,-90);
beginShape();
texture(imagen);
textureMode(IMAGE);
vertex(-13,-13, 0, 0, 0);
vertex( 13,-13, 0, imagen.width, 0);
vertex( 13, 13, 0, imagen.width, imagen.height);
vertex(-13, 13, 0, 0, imagen.height);
endShape();
popMatrix();
}
Additional Comment
#4 From fry 2006-10-30 04:16
the reference for textureMode() is correct. the reference link i sent
explains that the coordinate system starts at z = 0, and then moves
negative from there. translating into a positive direction in z will cause
trouble. if you have further questions about syntax, please use the board,
not the bugs db.
Additional Comment
#5 From fjoselevich 2006-10-30 07:01
Sorry to continue around this here, but if corrected it will still show the
farest object 'inside' the other one. I added to this example a rotation to
make this more explicit. It doesn't seem to be a coding problem.
[code]
PImage imagen;
float r = 0;
void setup() {
size(300,300,P3D);
noStroke();
imagen = loadImage("bola1.png");
}
void draw() {
r += .001;
background(255);
rotate(r);
fill(255,0,0);
pushMatrix();
translate(width/2,height/2,-10);
beginShape();
texture(imagen);
textureMode(IMAGE);
vertex(-20,-20, 0, 0, 0);
vertex( 20,-20, 0, imagen.width, 0);
vertex( 20, 20, 0, imagen.width, imagen.height);
vertex(-20, 20, 0, 0, imagen.height);
endShape();
popMatrix();
fill(0,0,255);
pushMatrix();
translate(width/2,height/2,-90);
beginShape();
texture(imagen);
textureMode(IMAGE);
vertex(-20,-20, 0, 0, 0);
vertex( 20,-20, 0, imagen.width, 0);
vertex( 20, 20, 0, imagen.width, imagen.height);
vertex(-20, 20, 0, 0, imagen.height);
endShape();
popMatrix();
}
[/code]