Basaa
Basaa

Reputation: 1685

OpenGL Cube weird bug

I am rendering a simple VBO cube in LWJGL, OpenGL. 6 quads with the correct normals, vertexes and RGB colors. However, I get a weird bug.

Weird cube VBO bug

Any ideas on what could cause this bug?

Thanks!

Edit: Cube drawing code:

glPushMatrix();
              GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertex_buffer_id);
              GL11.glVertexPointer(3, GL11.GL_FLOAT, 40, 0);
              GL11.glNormalPointer(GL11.GL_FLOAT, 40, 12);
              GL11.glColorPointer(4, GL11.GL_FLOAT, 40, 24);
              GL11.glDrawArrays(GL11.GL_QUADS, 0, vertex_data_array.length / 10);
              glPopMatrix();

Upvotes: 2

Views: 563

Answers (1)

Basaa
Basaa

Reputation: 1685

Found the problem. My zNear was set to 0.00001. For some reason it worked fine when I changed it to 0.01. Thanks all :)

Upvotes: 1

Related Questions