Using stroke in beginShape
in
Programming Questions
•
2 years ago
Hi,
I'm trying to show only some vertices by using stroke within a rotating cube. While I can partially get the effect by doing the below; it's not the effect I'm after (it 'fades' out too many). If anyone knows how I could show for example; only 1 vertex, or select which to show on an animated object, I'd be truely grateful. .
______________________
www.systemarray.com
I'm trying to show only some vertices by using stroke within a rotating cube. While I can partially get the effect by doing the below; it's not the effect I'm after (it 'fades' out too many). If anyone knows how I could show for example; only 1 vertex, or select which to show on an animated object, I'd be truely grateful. .
- float rotx = PI/4;
float roty = PI/4;
void setup (){
size(400,400,P3D);
noFill();
// stroke(0);
shapeMode (CENTER);
smooth();
}
void draw(){
background(255);
translate(width/2.0, height/2.0, -100);
rotateX(rotx);
rotateY(roty);
scale(100);
smooth();
Cube();
roty+=0.01;
rotx+=0.02;
}
void Cube() {
beginShape(QUADS);
// +Z "front" face
stroke(0);
vertex(-1, -1, 1);
stroke(255);
vertex( 1, -1, 1);
stroke(255);
vertex( 1, 1, 1);
stroke(255);
vertex(-1, 1, 1);
endShape();
beginShape(QUADS);
// -Z "back" face
// stroke(255);
vertex( 1, -1, -1);
// stroke(0);
vertex(-1, -1, -1);
vertex(-1, 1, -1);
vertex( 1, 1, -1);
endShape();
beginShape(QUADS);
// +Y "bottom" face
vertex(-1, 1, 1);
vertex( 1, 1, 1);
vertex( 1, 1, -1);
vertex(-1, 1, -1);
endShape();
beginShape(QUADS);
// -Y "top" face
vertex(-1, -1, -1);
vertex( 1, -1, -1);
vertex( 1, -1, 1);
vertex(-1, -1, 1);
endShape();
beginShape(QUADS);
// +X "right" face
vertex( 1, -1, 1);
vertex( 1, -1, -1);
vertex( 1, 1, -1);
vertex( 1, 1, 1);
endShape();
beginShape(QUADS);
// -X "left" face
vertex(-1, -1, -1);
vertex(-1, -1, 1);
vertex(-1, 1, 1);
vertex(-1, 1, -1);
endShape();
}
______________________
www.systemarray.com
1