gl.glBufferData(GL20.GL_ELEMENT_ARRAY_BUFFER, INDICES.length,
indices, GL20.GL_STATIC_DRAW);
}
// Save the old model view matrix
final Matrix4f m = new Matrix4f(modelview);
// Apply the local transformation
m.multiply(_transform.getMatrix());
// Bind the vertex and index buffers
gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, _buffers[0]);
gl.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, _buffers[1]);
// Set the pointers for the vertex buffer data
gl.glVertexAttribPointer(0, 3, GL20.GL_FLOAT, false, 0,
VERTICES_OFFSET);
gl.glVertexAttribPointer(1, 3, GL20.GL_FLOAT, false, 0,
NORMALS_OFFSET);
gl.glVertexAttribPointer(2, 2, GL20.GL_FLOAT, false, 0,
TEXCOORDS_OFFSET);
// Enable the generic vertex attribute arrays
gl.glEnableVertexAttribArray(0);
gl.glEnableVertexAttribArray(1);
gl.glEnableVertexAttribArray(2);
// Load the modelview and normal matrices used for rendering
gl.glUniformMatrix4fv(_mLoc, 1, false, m.getArray(), 0);
gl.glUniformMatrix3fv(_nLoc, 1, false, getNormalMatrix(m), 0);
// Set up the mesh's texture for rendering
gl.glBindTexture(GL20.GL_TEXTURE_2D, _texture);
gl.glUniform1i(_tLoc, 0);