Hi,
Should a texture disable the directionalLight?
In the example below mousePressed renders a texture onto a cube. Normally the cube respond to the light by having darker and lighter sides, with a texture attached it does not.
Code:PImage eBgi;
float fRtX, fRtY;
void setup() {
fRtX = 0;
fRtY = 0;
size(300,300,P3D);
noStroke();
eBgi = new PImage(width,height);
for (int i=0;i<eBgi.pixels.length;i++) eBgi.pixels[i] = i<eBgi.pixels.length/2?color(51,102,126):color(102,126,51);
}
void draw() {
fRtX += 0.0001*(mouseY-height/2);
fRtY -= 0.0001*(mouseX-width/2);
background(0);
directionalLight(51, 102, 126, 0, 0, -1);
translate(width/2, height/2, 100);
rotateX(fRtX);
rotateY(fRtY);
textureMode(IMAGE);
int iSze = 90;
int iPsx = -iSze/2;
int iPsy = -iSze/2;
int iPsz = -iSze/2;
for (int i=0;i<8;i++) {
rotateX((i+0)%3*PI*.5);
rotateY((i+1)%3*PI*.5);
rotateZ((i+3)%3*PI*.5);
beginShape();
if (mousePressed) {
texture(eBgi);
vertex(iPsx, iPsy, iPsz, 0, 0);
vertex(iPsx+iSze, iPsy, iPsz, eBgi.width,0);
vertex(iPsx+iSze, iPsy+iSze, iPsz,eBgi.width,eBgi.height);
vertex(iPsx, iPsy+iSze,iPsz, 0, eBgi.height);
} else {
vertex(iPsx, iPsy, iPsz);
vertex(iPsx+iSze, iPsy, iPsz);
vertex(iPsx+iSze, iPsy+iSze, iPsz);
vertex(iPsx, iPsy+iSze,iPsz);
}
endShape();
}
}
gr...
...Ron