glVertexPointer with vector

Started by
2 comments, last by Brother Bob 12 years, 8 months ago
Hi everyone,

I was wondering if there is a good way to use



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


with vector<SomeClassName *> Nodes; since its more convenient, and easy to store information in the vector.
Any help would be appreciated.
Advertisement
Your vector array would be an array of pointers and glVertexPointer doesn't take an array of pointers, so no, it would not work.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Your vector array would be an array of pointers and glVertexPointer doesn't take an array of pointers, so no, it would not work.



What about if i do it this way ?

vector<SomeClassName> nodes;
That's fine. You can get a pointer to the data that you can pass to glVertexPointer with nodes.data().

This topic is closed to new replies.

Advertisement