3D Rendering coming up as black screen (using & and << bitwise ops)

Status
Not open for further replies.

Edin

New Member
Jul 14, 2012
1
0
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:


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.
 
Status
Not open for further replies.

Users who are viewing this thread

Top