I am storing my vertices in a vector array
std::vector<std::vector<float>> gridVertices = {{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{-1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f},
{0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f},
{0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}};
Now I want to send this to VBO and render stuff. My current rendering function is
void
render::setBuffer(std::vector<std::vector<float>> vertice)
{
glBufferData(GL_ARRAY_BUFFER, sizeof(vertice), &vertice[0][0], GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), reinterpret_cast<void*>(0));
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), reinterpret_cast<void*>(3*sizeof(float)));
glEnableVertexAttribArray(1);
}
The result is buggy. Can someone explain to me where is the issue? Trying to debug this for hours now