Passing a pointer to an array to glGenBuffers
- by Josh Elsasser
I'm currently passing an array to a function, then attempting to use glGenBuffers with the array that is passed to the function. I can't figure out a way to get glGenBuffers to work with the array that I've passed. I have a decent grasp of the basics of pointers, but this is beyond me.
This is basically how the render code works. It's a bit more complex, (colours using the same array idea, also not working) but the basic idea is as follows:
void drawFoo(const GLfloat *renderArray, GLuint verticeBuffer) {
glBindBuffer(GL_ARRAY_BUFFER, verticeBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(verticeBuffer)*sizeof(GLfloat), verticeBuffer, GL_STATIC_DRAW);
glVertexPointer(2, GL_FLOAT, 0, 0);
glEnableClientState(GL_VERTEX_BUFFER);
glDrawArrays(GL_TRIANGLE_FAN, 0, 45);
glDisableClientState(GL_VERTEX_BUFFEr);
}
Thanks in advance for the help