Java Code Examples for org.lwjgl.opengl.GL30#glDeleteVertexArrays()

The following examples show how to use org.lwjgl.opengl.GL30#glDeleteVertexArrays() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GL33ModelRenderer.java    From ldparteditor with MIT License 6 votes vote down vote up
public void dispose() {
    isRunning.set(false);
    GL30.glDeleteVertexArrays(vao);
    GL15.glDeleteBuffers(vbo);
    GL30.glDeleteVertexArrays(vaoVertices);
    GL15.glDeleteBuffers(vboVertices);
    GL30.glDeleteVertexArrays(vaoLines);
    GL15.glDeleteBuffers(vboLines);
    GL30.glDeleteVertexArrays(vaoTempLines);
    GL15.glDeleteBuffers(vboTempLines);
    GL30.glDeleteVertexArrays(vaoSelectionLines);
    GL15.glDeleteBuffers(vboSelectionLines);
    GL30.glDeleteVertexArrays(vaoCondlines);
    GL15.glDeleteBuffers(vboCondlines);
    GL30.glDeleteVertexArrays(vaoCSG);
    GL15.glDeleteBuffers(vboCSG);
    GL30.glDeleteVertexArrays(vaoStudLogo1);
    GL15.glDeleteBuffers(vboStudLogo1);
    GL30.glDeleteVertexArrays(vaoStudLogo2);
    GL15.glDeleteBuffers(vboStudLogo2);
}
 
Example 2
Source File: GL33Helper.java    From ldparteditor with MIT License 6 votes vote down vote up
public static void drawTriangleVAO_GeneralSlow(float[] vertices) {
    int VAO_general = GL30.glGenVertexArrays();
    int VBO_general = GL15.glGenBuffers();
    GL30.glBindVertexArray(VAO_general);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO_general);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertices, GL15.GL_STREAM_DRAW);

    GL20.glEnableVertexAttribArray(POSITION_SHADER_LOCATION);
    GL20.glVertexAttribPointer(POSITION_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, 12, 0);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);

    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(VAO_general);
    GL15.glDeleteBuffers(VBO_general);
}
 
Example 3
Source File: Vao.java    From LowPolyWater with The Unlicense 5 votes vote down vote up
public void delete(boolean deleteVbos) {
	GL30.glDeleteVertexArrays(id);
	if (deleteVbos) {
		for (Vbo vbo : relatedVbos) {
			vbo.delete();
		}
	}
}
 
Example 4
Source File: Vao.java    From OpenGL-Animation with The Unlicense 5 votes vote down vote up
public void delete() {
	GL30.glDeleteVertexArrays(id);
	for(Vbo vbo : dataVbos){
		vbo.delete();
	}
	indexVbo.delete();
}
 
Example 5
Source File: OpenGL3_TheQuadTextured.java    From ldparteditor with MIT License 5 votes vote down vote up
private void destroyOpenGL() {  
    // Delete the texture
    GL11.glDeleteTextures(texIds[0]);
    GL11.glDeleteTextures(texIds[1]);
     
    // Delete the shaders
    GL20.glUseProgram(0);
    GL20.glDetachShader(pId, vsId);
    GL20.glDetachShader(pId, fsId);
     
    GL20.glDeleteShader(vsId);
    GL20.glDeleteShader(fsId);
    GL20.glDeleteProgram(pId);
     
    // Select the VAO
    GL30.glBindVertexArray(vaoId);
     
    // Disable the VBO index from the VAO attributes list
    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
     
    // Delete the vertex VBO
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(vboId);
     
    // Delete the index VBO
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(vboiId);
     
    // Delete the VAO
    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(vaoId);
     
    this.exitOnGLError("destroyOpenGL");
     
    Display.destroy();
}
 
Example 6
Source File: vboWithRGBA.java    From ldparteditor with MIT License 5 votes vote down vote up
@Override
public void dispose() {
    // Properly de-allocate all resources once they've outlived their purpose
    shaderProgram.dispose();
    
    GL30.glDeleteVertexArrays(VAO);
    GL15.glDeleteBuffers(VBO);
}
 
Example 7
Source File: vboWithIndices.java    From ldparteditor with MIT License 5 votes vote down vote up
@Override
public void dispose() {
    // Properly de-allocate all resources once they've outlived their purpose
    shaderProgram.dispose();
    
    GL30.glDeleteVertexArrays(VAO);
    GL15.glDeleteBuffers(VBO);
    GL15.glDeleteBuffers(EBO);
    
    isRendering.set(false);
}
 
Example 8
Source File: GL33ModelRendererLDrawStandard.java    From ldparteditor with MIT License 5 votes vote down vote up
public void dispose() {
    isRunning.set(false);
    GL30.glDeleteVertexArrays(vao);
    GL15.glDeleteBuffers(vbo);
    GL30.glDeleteVertexArrays(vaoLines);
    GL15.glDeleteBuffers(vboLines);
    GL30.glDeleteVertexArrays(vaoCondlines);
    GL15.glDeleteBuffers(vboCondlines);
    GL30.glDeleteVertexArrays(vaoStudLogo1);
    GL15.glDeleteBuffers(vboStudLogo1);
    GL30.glDeleteVertexArrays(vaoStudLogo2);
    GL15.glDeleteBuffers(vboStudLogo2);
}
 
Example 9
Source File: GL33Helper.java    From ldparteditor with MIT License 5 votes vote down vote up
public static void drawTrianglesIndexedTextured_GeneralSlow(float[] vertices, int[] indices) {
    int VAO_general = GL30.glGenVertexArrays();
    int VBO_general = GL15.glGenBuffers();
    int EBO_general = GL15.glGenBuffers();
    GL30.glBindVertexArray(VAO_general);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO_general);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertices, GL15.GL_STATIC_DRAW);

    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, EBO_general);
    GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indices, GL15.GL_STATIC_DRAW);

    GL20.glEnableVertexAttribArray(POSITION_SHADER_LOCATION);
    GL20.glVertexAttribPointer(POSITION_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_UV_STRIDE, 0);

    GL20.glEnableVertexAttribArray(TEX_NORMAL_SHADER_LOCATION);
    GL20.glVertexAttribPointer(TEX_NORMAL_SHADER_LOCATION, 3, GL11.GL_FLOAT, false, RGB_UV_STRIDE, 12); // 3 * 4

    GL20.glEnableVertexAttribArray(TEX_COLOUR_SHADER_LOCATION);
    GL20.glVertexAttribPointer(TEX_COLOUR_SHADER_LOCATION, 4, GL11.GL_FLOAT, false, RGB_UV_STRIDE, 24);

    GL20.glEnableVertexAttribArray(UV_SHADER_LOCATION);
    GL20.glVertexAttribPointer(UV_SHADER_LOCATION, 2, GL11.GL_FLOAT, false, RGB_UV_STRIDE, 40);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    GL11.glDrawElements(GL11.GL_TRIANGLES, indices.length, GL11.GL_UNSIGNED_INT, 0);

    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(VAO_general);
    GL15.glDeleteBuffers(VBO_general);
    GL15.glDeleteBuffers(EBO_general);
}
 
Example 10
Source File: TexturedQuad.java    From LWJGUI with MIT License 4 votes vote down vote up
public void cleanup() {
	GL30.glDeleteVertexArrays(vaoId);
	GL15.glDeleteBuffers(vboId);
	// NOTE: don't cleanup the shader
}