1

I've got a problem with drawing an buffer object with no index. My other indexed vbos draw fine...

void drawArray(VertexArrayObject VAO)
{
    GL11.glColor3d(1.0f, 0.2f, 0.2f);
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VAO.southSkirtBufferID);
    GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, VAO.southSkirtLength);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);     
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
}

1 Answers1

2

You are not using your "skirt buffer" for drawing. In drawArray you actually set the vertex pointer to point to the offset 0 in VAO.vertexBufferID (whatever that is, at that time. And you never set it to anything else.

The buffer reference is a part of the vertex attribute pointer, the currently bound GL_ARRAY_BUFFER at the time of the gl*Pointer() call will be used for that pointer. The GL_ARRAY_BUFFER binding at the time of the draw call is totally irrelevant, and just changing that binding does not affect the attribute pointers.

If you only render the skirts, it crashes because your attribute pointers aren't set up to anything useful at all.

derhass
  • 43,833
  • 2
  • 57
  • 78
  • The vertexBufferID and its index are a completely different set of data. They fill in most of the block that they are generated for except the east and south edge, which I leave for the skirtBuffer. The skirt buffer is a vertex buffer that should be rendered as a triangle strip. – user3537499 Jul 02 '14 at 21:51
  • Adding glVertexPointer before had led to errors, but it must have been in the wrong spot. Two bajillion points for you! – user3537499 Jul 02 '14 at 22:04