Hi im making a 3D java game and currently Im working on the 3D aspect for the floor and ceiling. I currently the Basic Render class (using .draw() ) and the display and screen class's done. Im working on the Render3D which makes the floor and ceiling but when I try merging the 2 (in this case the width and length defined as x and Y) using the bit operator & my debug window shows nothing (its just black nothing is going on) but when I change it to the shift operator it works fine:
This is the line using the & Bit Operator: "int xx = (int)(xDepth) & 5;"
Why is it showing up as a black screen? and if you do need to know im using jre7.
Code:
public class Render3D extends Render {
public Render3D(int WIDTH, int LENGTH) {
super(WIDTH, LENGTH);
}
public void floor() {
for (int y = 0; y < LENGTH; y++) {
double yDepth = y - LENGTH / 2;
double z = 100.0 / yDepth;
for (int x = 0; x < WIDTH; x++) {
double xDepth = x - WIDTH / 2;
xDepth *= z;
int xx = (int)(xDepth) & 5;
PIXELS[x + y * WIDTH] = xx * 135;
}
}
}
}
This is the line using the & Bit Operator: "int xx = (int)(xDepth) & 5;"
Why is it showing up as a black screen? and if you do need to know im using jre7.