So I wrote my first 3D world in LWJGL (YEAH!), which I am very proud of, and I’ve just started adding textures to my lifeless world. I’ve had to rewrite this about 6 times now as i discover many new things/bugs about my problem. After a long analysis, it seems that my textures are binding themselves after being loaded.
try {
textureFloor = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("img/floor.png"));
textureWall = TextureLoader.getTexture("JPG", ResourceLoader.getResourceAsStream("img/tileWall.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
So when the floor is rendered, textureWall is already being drawn onto it! If I comment out textureWall, and load only textureFloor, then the floor texture is drawn onto the floor. This isn’t right at all! Nothing is happening to these texture objects, other than being loaded from the above code.
My Floor’s class is available here
I’ve got another problem aswell. When I add a box (and the textures still aren’t bound), it renders really weird, and makes the floor render weird aswell!
In this picture, we see the floor, and a box. As you can see, they have textures on them, that are extremely off.
Will add code if requested.
Thanks!!