Jump to content

  • Log In with Google      Sign In   
  • Create Account

glVertexPointer with vector


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Fara   Members   -  Reputation: 122

Like
0Likes
Like

Posted 31 July 2011 - 06:20 PM

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.

Sponsor:

#2 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 31 July 2011 - 07:05 PM

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);

#3 Fara   Members   -  Reputation: 122

Like
0Likes
Like

Posted 31 July 2011 - 10:50 PM

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;


#4 Brother Bob   Moderators   -  Reputation: 8605

Like
0Likes
Like

Posted 01 August 2011 - 04:35 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS