I am learning some OpenGLES2 tutorials for Android. All of the examples make use of direct buffers to transfer the 3D geometry to the graphic card. The FloatBuffers are used for vertices, normals and colors and the CharBuffer is used for indices.

When it comes to draw the entities or send them to the VBOs the first thing we need is to determine the number of elements in the buffers. And I am a little confused about how to do it, because some tutorials make use of limit() method while other tutorials use capacity(). And here is the question:

What method of FloatBuffer and CharBuffer should I use to determine the number of elements in the buffer?

有帮助吗?

解决方案

some tutorials make use of limit() method

They are correct.

while other tutorials use capacity().

They are wrong. That would only be correct if the buffer was full.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top