final FloatBufferData vertexCoords, final FloatBufferData normalCoords, final FloatBufferData colorCoords,
final List<FloatBufferData> textureCoords, final int bufferSize) {
// keep around buffer size
if (interleaved.getBufferCapacity() != 1) {
final FloatBuffer buffer = BufferUtils.createFloatBufferOnHeap(1);
interleaved.setBuffer(buffer);
}
interleaved.getBuffer().rewind();
interleaved.getBuffer().put(bufferSize);
final RendererRecord rendRecord = context.getRendererRecord();
final ContextCapabilities caps = context.getCapabilities();
final int vboID = makeVBOId();
interleaved.setVBOID(context.getGlContextRep(), vboID);
rendRecord.invalidateVBO();
LwjglRendererUtil.setBoundVBO(rendRecord, vboID);
ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, bufferSize,
getGLVBOAccessMode(interleaved.getVboAccessMode()));
int offsetBytes = 0;
if (normalCoords != null) {
normalCoords.getBuffer().rewind();
ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes,
normalCoords.getBuffer());
offsetBytes += normalCoords.getBufferLimit() * 4;
}
if (colorCoords != null) {
colorCoords.getBuffer().rewind();
ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes,
colorCoords.getBuffer());
offsetBytes += colorCoords.getBufferLimit() * 4;
}
if (textureCoords != null) {
final TextureState ts = (TextureState) context.getCurrentState(RenderState.StateType.Texture);
if (ts != null) {
for (int i = 0; i <= ts.getMaxTextureIndexUsed() && i < caps.getNumberOfFragmentTexCoordUnits(); i++) {
if (textureCoords == null || i >= textureCoords.size()) {
continue;
}
final FloatBufferData textureBufferData = textureCoords.get(i);
final FloatBuffer textureBuffer = textureBufferData != null ? textureBufferData.getBuffer() : null;
if (textureBuffer != null) {
textureBuffer.rewind();
ARBBufferObject.glBufferSubDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, offsetBytes,
textureBuffer);
offsetBytes += textureBufferData.getBufferLimit() * 4;
}
}