View Full Version : glvertexpointer and dynamic array

12-01-2009, 09:45 AM

I would like to use glvertexpointer to draw a series of gl_line_strip. I'm storing my coordinate values( x-values and y-values) in a 2 dimension dynamic array. I know that when I call this function, I have to supply the following

void glVertexPointer(GLint size,
GLenum type,
GLsizei stride,
const GLvoid * pointer)

However, does this function accept 2 dimension dynamic array? If so, should I just point to the array on the pointer field and expect it to work? Please, let me know. Thanks.

12-01-2009, 11:00 AM
Is it a C 2-dimensional array? If so yes.

I think you just need to pass the address of the first element:

float vertices[MY_LENGTH][2];

glVertexPointer(2, GL_FLOAT, 0, &vertices[0][0]);

12-01-2009, 12:13 PM
By doing that, will it put the first dimension array as a x-value and second dimension array as a y-value?