I am using VAOs and Mapped VBOs together to get as much performance as I can. Now, my VBOs are interleaved in this form VCVCVCVCVCVC so there is vertex of 3 floats then a color of 4 floats.
My problem is that it doesn't recognize the color even when I have the correct stride and offset. This problem started happening when I implemented VAOs.
Imported parts of the code: Mapping the VBO and creating the VAO
Binding everything:
glBindVertexArray(vaoHandel);
glBindBuffer(GL_ARRAY_BUFFER, vboHandel);
glBufferData(GL_ARRAY_BUFFER, NumberOfIndecies << 2, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 7<<2, 0<<2);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 4, GL_FLOAT, false, 7<<2, 3<<2);
glEnableVertexAttribArray(1);
Mapping part:
ByteBuffer dataBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY, NumberofIndecies << 2, null);
FloatBuffer vboData = dataBuffer.order(ByteOrder.nativeOrder()).asFloatBuffer();
Bulding the VBO:
build(vboData);
vboData.flip();
Unmapping:
glUnmapBuffer(GL_ARRAY_BUFFER);
Unbinding:
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
That was building and mapping the VBO and VAO. Rendering:
glBindVertexArray(vaoHandel);
glDrawArrays(GL_QUADS, 0, capacity);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glBindVertexArray(0);
So again to recap My problem is that the COLORS don't work, they don't show up. The QUADS that I am drawing show up but they are WHITE. When after checking the colors I'm putting in are clearly RED.