Hi, I am working on a billboard model that simply consists of a few hard coded vertices. I want to use this model a lot throughout the project I'm working on so I figured it would be a good idea to make these as optimized as possible and thus use element indices to define which vertices must be drawn and which ones ignored.
My primary source for this has been the LearnOpenGL website.
The snippet for drawing my quad is as follows:
The printf seen above is triggered so something is going wrong, however I can't figure out what the error actually is.
The code which I use for initializing the model is quite straightforward, but I feel like I'm missing something very silly.
As this code is mostly expanded upon from the SpaceCadet project, the rest of the draw function is basically the same, so I suspect there shouldn't be anything causing my problem there. Thanks a bunch in advance to anyone helping me figure this out!
My primary source for this has been the LearnOpenGL website.
The snippet for drawing my quad is as follows:
Code:
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
if (glGetError() != GL_NO_ERROR)
{
printf("Oh bugger Billboard Draw error\n");
return false;
}
The code which I use for initializing the model is quite straightforward, but I feel like I'm missing something very silly.
Code:
this->Vertices = billboardVertices;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(billboardVertices), billboardVertices, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glGenBuffers(1, &elementBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
As this code is mostly expanded upon from the SpaceCadet project, the rest of the draw function is basically the same, so I suspect there shouldn't be anything causing my problem there. Thanks a bunch in advance to anyone helping me figure this out!