문제

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