Log in or register to post comments

Sample Code/OpenGL question

September 2, 2017 - 9:49am #1

I've been going through the iOS sample code, and there's one part I want to make sure I understand correctly. In the MultiTargets project, in

- (void)renderFrameWithState:(const Vuforia::State &)state projectMatrix:(Vuforia::Matrix44F &)projectionMatrix

There are the calls

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,

                              (const GLvoid*) &cubeVertices[0]);

...

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,

                              (const GLvoid*) &objectVertices[0]);

 

I don't have much OpenGL experience, but I'm used to sending the vertex data over to the GPU at initialization using

glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);

glBufferData(GL_ARRAY_BUFFER, ...

 

Do I understand correctly that the sample code is sending all the vertices over to the GPU on every frame, so it would be a good idea to switch over to using array buffers instead for the sake of efficiency?

Sample Code/OpenGL question

September 5, 2017 - 5:29pm #2


Hello slmille4,

Your assessment is correct - it would be more efficient to switch over to using array buffers.

Thanks,

-Vuforia Support

Log in or register to post comments