I am trying to configure VBO for my rendering code to get more fps. It worked for a separate VBO for vertex position, color and texture coordinates, but after transferring vertex data to alternating data, there is no geometry. Here is my func setup:
const GLsizeiptr data_size = NUMBER_OF_CUBE_VERTICES * 9 *sizeof(float);
The data array is as follows:
static float data[] = { // position // // color // //UV// -1.0, +1.0, +1.0, 255,0,0,255, 0,0, -1.0, -1.0, +1.0, 0,255,0,255, 0,0, +1.0, +1.0, +1.0, 255,0,255,255, 0,0, +1.0, -1.0, +1.0, 255,0,0,255, 0,0, +1.0, +1.0, +1.0, 255,0,0,255, 0,0, +1.0, -1.0, +1.0, 255,0,0,255, 0,0, +1.0, +1.0, -1.0, 255,255,0,255, 0,0, +1.0, -1.0, -1.0, 255,0,0,255, 0,0, +1.0, +1.0, -1.0, 255,0,255,255, 0,0, +1.0, -1.0, -1.0, 255,255,0,255, 0,0, -1.0, +1.0, -1.0, 0,255,0,255, 0,0, -1.0, -1.0, -1.0, 255,0,0,255, 0,0, -1.0, +1.0, -1.0, 0,0,255,255, 0,0, -1.0, -1.0, -1.0, 255,0,0,255, 0,0, -1.0, +1.0, +1.0, 255,255,0,255, 0,0, -1.0, -1.0, +1.0, 255,0,0,255, 0,0, };
And this is my rendering code:
glClearColor(0.5f, 0.5f, 0.5f, 1.0f); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glBindBuffer(GL_ARRAY_BUFFER, cubeVBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cubeIBO); glDrawElements(GL_TRIANGLE_STRIP, NUMBER_OF_CUBE_INDICES, GL_UNSIGNED_BYTE, s_cubeIndices);
I also tried using the DrawArrays function without an index buffer, but the result was the same - no geometric rendering. My window bar also has a GLError 1282, while my program is running. I would appreciate any help on my issue, thanks.