How to clear box in OPENGL
in
Core Library Questions
•
1 years ago
this is my code:
import processing.opengl.*;
int x, y, z;
int speed = 10;
//float a;
//float b;
PImage etch;
color bgColor;//global declaration for random backgrounds
void setup() {
size(700, 630, OPENGL);
etch = loadImage("etchaskechcha.jpg");
background(etch);
//a = (random(128));
}
void draw() {
lights();// shadow
pushMatrix();
translate(width/2, height/2);
noFill();
box(350, 270, 407);//the contruct of 3D environment (w,h,d)
translate(width/12, height/12);
translate(x, y, z);
noStroke();
strokeWeight(20);//weght of sketch
fill(a);//colour of sketch
box(10);//sketch
smooth();
strokeWeight(1.4);//border thickness
popMatrix();
}
void mousePressed() {
translate(width/2, height/2);
noFill();
box(350, 270, 407);//the contruct of 3D environment (w,h,d)
redraw();
}
void keyPressed() {
if (keyCode == UP) {
y-=speed;
}
if (keyCode == DOWN) {
y+=speed;
}
if (keyCode == LEFT) {
x-=speed;
}
if (keyCode == RIGHT) {
x+=speed;
}
if (keyCode == SHIFT) {
z+=speed;
}
if (keyCode == CONTROL) {
z-=speed;
}
}
1