The last argument of glColorPointer
is the buffer offset in bytes. So the offset vertBuf.limit() * 4
and not vertBuf.limit()
:
gl.glColorPointer(3, GL2.GL_FLOAT, stride, vertBuf.limit());
gl.glColorPointer(3, GL2.GL_FLOAT, stride, vertBuf.limit()*4);
The offset and size argument of glBufferSubData
also specifies the buffer offset and buffer size in bytes:
gl.glBufferSubData(GL_ARRAY_BUFFER,0,vertBuf.limit(),vertBuf)
gl.glBufferSubData(GL_ARRAY_BUFFER,vertBuf.limit(),colorBuffer.limit(),colorBuffer)
gl.glBufferSubData(GL_ARRAY_BUFFER, 0, vertBuf.limit()*4, vertBuf);
gl.glBufferSubData(GL_ARRAY_BUFFER, vertBuf.limit()*4, colorBuffer.limit()*4, colorBuffer);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…