My OS is Windows 7 x64, GPU is NVidia gts 250, driver is version 341.44.
I am using Vertex Array Objects and vbos to draw.
Here's the code I use to create and draw the vaos.
public class VAO {
public static List<Integer> vaos = new ArrayList<Integer>();
public static List<Integer> vbos = new ArrayList<Integer>();
public int vaoID;
public int vAmount;
public VAO(float[] vertices) {
this.vaoID = createVAO();
vAmount = vertices.length/3;
storeDataInVAO(0, 3, vertices);
// storeDataInVAO(1, 2, texCoords);
unbindVAO();
}
private int createVAO() {
int vao = glGenVertexArrays();
vaos.add(vao);
glBindVertexArray(vao);
return vao;
}
private void unbindVAO() {
glBindVertexArray(0);
}
private void storeDataInVAO(int slot, int size, float[] data) {
int vbo = glGenBuffers();
vbos.add(vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
FloatBuffer bufferedData = asFloatBuffer(data);
glBufferData(GL_ARRAY_BUFFER, bufferedData, GL_STATIC_DRAW);
glVertexAttribPointer(slot, size, GL_FLOAT, false, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
public static void cleanUp() {
for(int i : vaos) {
glDeleteVertexArrays(i);
System.out.println(String.format("Deleted VAO #%1s", i));
}
for(int i : vbos) {
glDeleteBuffers(i);
}
}
public int getVaoID() {
return this.vaoID;
}
//Render code
glBindVertexArray(vao.getVaoID());
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLES, 0, vao.vAmount);
glDisableVertexAttribArray(0);
glBindVertexArray(0);
}