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.
Buffers are generated (and deleted) elsewhere. I can render everything if I do it fixed, but this makes it more flexible. The current issue is "&renderArray[0]". If I move this (everything into the function) out so that it is in the main drawing code, it works. I also have something very similar that uses a constant array working as well.
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(renderArray)*sizeof(GLfloat), &renderArray[0], 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