Added delete function in VertexArray

This commit is contained in:
Antoine 2021-06-21 02:41:50 +02:00
parent 37e4771d95
commit a282a48612
4 changed files with 19 additions and 3 deletions

View File

@ -183,6 +183,7 @@ public class Engine {
} }
public void remove_objectGl(ObjectGl obj) { public void remove_objectGl(ObjectGl obj) {
obj.delete();
this.objectsGl.remove(obj); this.objectsGl.remove(obj);
} }

View File

@ -86,4 +86,15 @@ public class VertexArray {
unbind(); unbind();
} }
/**
* Delete every buffers used
*/
public void delete(){
glDeleteBuffers(VBO);
glDeleteBuffers(EBO);
glDeleteBuffers(CBO);
glDeleteBuffers(TBO);
glDeleteVertexArrays(VAO);
}
} }

View File

@ -291,4 +291,8 @@ public class ObjectGl {
this.shader.disable(); this.shader.disable();
} }
public void delete(){
this.vertexArray.delete();
}
} }

View File

@ -398,9 +398,9 @@ public class match {
timer = 99 - frameCount/60; timer = 99 - frameCount/60;
timeStamp2 = System.currentTimeMillis(); timeStamp2 = System.currentTimeMillis();
// while(timeStamp2-timeStamp1<(1000/(60 * slowFactor))) { while(timeStamp2-timeStamp1<(1000/(60 * slowFactor))) {
// timeStamp2 = System.currentTimeMillis(); timeStamp2 = System.currentTimeMillis();
// } }
frameCounter++; frameCounter++;
if (System.currentTimeMillis() - timeStampFpsCounter >= 1000){ if (System.currentTimeMillis() - timeStampFpsCounter >= 1000){