GL_DEPTH_TEST stops object rendering

Hello,

I’ve had this issue with a couple of attempts with create a cube(s).

I have create a small scene with a flying cube, so long as I have GL_DEPTH_TEST enabled the scene will be empty.

GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthFunc(GL11.GL_LEQUAL);

Without this enabled though, I will get cubes far away rendering in front of nearer cubes

The full code is here http://pastebin.java-gaming.org/01f20302193

Does anyone have any ideas what I am doing wrong

Do you clear the depth buffer every frame? It could explain something if not.
(color cleared & depth not = new rendered objects are at already used position = invisible)

Use this in your [icode]render()[/icode] method.


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

That should get the cube shown.

Thanks both, this worked.

I’ll edit the code from the link in the original post. Should anyone be interested
(Although i’ve still got to fine tune the matrix translations and rotations.)