Passing a pointer to an array to glGenBuffers
Posted
by Josh Elsasser
on Stack Overflow
See other posts from Stack Overflow
or by Josh Elsasser
Published on 2010-04-30T19:06:35Z
Indexed on
2010/04/30
19:17 UTC
Read the original article
Hit count: 178
objective-c
|opengl-es
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
© Stack Overflow or respective owner