Re: How to use VBO?
Posted by
gouessej on
Jan 19, 2015; 4:53pm
URL: https://forum.jogamp.org/How-to-use-VBO-tp4033871p4033887.html
You seem not to understand the examples that you looked, you give the impression to tinker without understanding what you do. Buffers.SIZEOF_FLOAT = 4, therefore fBuff.capacity()*4 should be rewritten by using Buffers.SIZEOF_FLOAT as I suggested, it's more readable, it's better than using a magic number. BufferOffset seems to be useless. gl.glEnableClientState(gl.GL_VERTEX_ARRAY) is the equivalent of gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY) but as the constant is static, there is no need of using "gl". gl.glDrawArrays(GL2.GL_QUADS,0,fBuff.capacity()*4) is still wrong because the last parameter is the count of vertices or indices to render and your vertices have 3 coordinates (x, y, z) then you should write gl.glDrawArrays(GL2GL3.GL_QUADS,0,fBuff.capacity()/3). Yes I forgot to tell you that you had forgotten glVertexPointer but your code was full of mistakes, I did my best.