Hi list,
I’m having trouble adding color and texture-coordinates to my vertices in a Vertex Buffer. I use this to fill my colorbuffer and put them into a Vertex Buffer (like I do for the vertices and indices) :
colorbuffer = BufferUtils.createFloatBuffer(4 * 4);
colorbuffer.put(255).put(0).put(0).put(255);
colorbuffer.put(255).put(0).put(0).put(255);
colorbuffer.put(255).put(0).put(0).put(255);
colorbuffer.put(255).put(0).put(0).put(255);
colorbuffer.flip();
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_COLOR_ARRAY_BUFFER_BINDING_ARB, colorbufferID);
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_COLOR_ARRAY_BUFFER_BINDING_ARB, colorbuffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
This gives the following compile error:
“Unsupported VBO target 34970”
I’m pretty sure I know what this means, but what kind of buffer should I use then? Perhaps I’m doing something terribly wrong?
If I use the GL_ARRAY_BUFFER_ARB flag, everything seems to work:
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, colorbufferID);
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, colorbuffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
…but then I’m overwriting my vertex buffer ofcourse.
How can I avoid this please? What is the correct way to use this?
Thank you!