Ibrahim Ipek
Ibrahim Ipek

Reputation: 525

Storing Vertex Array Objects in std::vector

i am writing a class for making easier the Vertex Array Object, i want to generate Vertex Array Objects in X number and store them in a std::vector.

How i can do that? I do not want to this in a loop, this is will be faster.

glGenVertexArrays(VAONumber, myVector); 

Upvotes: 0

Views: 242

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409176

The std::vector class emulates an array, which means all its data is allocated in a contiguous chunk of memory, just like an array. That means you can get the whole array if you have a pointer to the very first element, i.e. &myVector[0].

There's also a utility member function data to get this pointer.

Upvotes: 4

Related Questions