Example usage for org.lwjgl.opengl GL15 glDeleteBuffers

List of usage examples for org.lwjgl.opengl GL15 glDeleteBuffers

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL15 glDeleteBuffers.

Prototype

public static void glDeleteBuffers(@NativeType("GLuint const *") int[] buffers) 

Source Link

Document

Array version of: #glDeleteBuffers DeleteBuffers

Usage

From source file:com.timvisee.voxeltex.module.mesh.Mesh.java

License:Open Source License

/**
 * Clear the buffers for this mesh on the graphics card.
 *//*from  w ww .  ja v  a2  s.  c  o m*/
public void clearMeshBuffer() {
    // Delete data from old buffers if available
    if (this.vertexBuffer != null)
        this.vertexBuffer.clear();
    if (this.normalBuffer != null)
        this.normalBuffer.clear();
    if (this.textureBuffer != null)
        this.textureBuffer.clear();

    // Reset the buffer instances
    this.vertexBuffer = null;
    this.normalBuffer = null;
    this.textureBuffer = null;

    // Clear old VBO buffers
    if (this.vboVertexHandle != 0)
        GL15.glDeleteBuffers(this.vboVertexHandle);
    if (this.vboNormalHandle != 0)
        GL15.glDeleteBuffers(this.vboNormalHandle);
    if (this.vboTextureHandle != 0)
        GL15.glDeleteBuffers(this.vboTextureHandle);

    // Reset the VBO handles
    this.vboVertexHandle = 0;
    this.vboNormalHandle = 0;
    this.vboTextureHandle = 0;

    // Reset the vertex and normal count
    this.vertexCount = 0;
    this.normalCount = 0;
}

From source file:com.voxelplugineering.voxelsniper.render.buffer.BufferSection.java

License:Open Source License

public void destroy() {
    // 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);/*from  ww  w .java  2s.  c om*/

}

From source file:com.xrbpowered.gl.res.StaticMesh.java

License:Open Source License

public void destroy() {
    GL30.glBindVertexArray(vaoId);/*from ww w  .j av a2  s .  co  m*/
    for (int i = 0; i < countAttribs; i++)
        GL20.glDisableVertexAttribArray(i);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(vboId);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    if (vboiId != GL11.GL_INVALID_VALUE)
        GL15.glDeleteBuffers(vboiId);
    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(vaoId);
}

From source file:cuchaz.jfxgl.prism.TexturedQuad.java

License:Open Source License

public void cleanup() {
    GL30.glDeleteVertexArrays(vaoId);
    GL15.glDeleteBuffers(vboId);
    GL15.glDeleteBuffers(iboId);
    // NOTE: don't cleanup the shader
}

From source file:Data.Building.java

License:Apache License

@Override
public void destroy() {
    // Disable the VBO index from the VAO attributes list
    GL20.glDisableVertexAttribArray(0);// w ww .  j av a 2s.c  o m

    // Delete the VBO
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(vboId);

    // Delete the VAO
    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(vaoId);
}

From source file:dataAccess.lwjgl.VAO_Loader.java

/**
 * Cleans the memory of all VAO's and VBO's.
 *///from   w  w  w.ja  va 2 s.c  o m
public static void cleanUp() {
    vaos.forEach(x -> GL30.glDeleteVertexArrays(x));
    vbos.forEach(x -> GL15.glDeleteBuffers(x));
    textureMap.values().forEach(x -> GL11.glDeleteTextures(x));
}

From source file:eu.over9000.veya.rendering.ChunkVAO.java

License:Open Source License

public void dispose() {

    if (holdsSolid) {

        GL30.glDeleteVertexArrays(this.vao_handle_solid);
        GL15.glDeleteBuffers(this.ibo_handle_solid);
        GL15.glDeleteBuffers(this.vbo_handle_solid);

        this.vao_handle_solid = -1;
        this.vbo_handle_solid = -1;
        this.ibo_handle_solid = -1;
    }//from w ww  .j a v  a2s  .c  o m

    if (holdsTransparent) {
        GL30.glDeleteVertexArrays(this.vao_handle_transparent);
        GL15.glDeleteBuffers(this.ibo_handle_transparent);
        GL15.glDeleteBuffers(this.vbo_handle_transparent);

        this.vao_handle_transparent = -1;
        this.vbo_handle_transparent = -1;
        this.ibo_handle_transparent = -1;
    }

}

From source file:fr.ign.cogit.geoxygene.appli.gl.GLBezierShadingComplex.java

License:Open Source License

@Override
public void invalidateBuffers() {
    if (this.vboIndicesId >= 0) {
        GL15.glDeleteBuffers(this.vboIndicesId);
        this.indicesBuffer = null;
        this.vboIndicesId = -1;
    }/*from w ww.  j a  va2s.  co m*/
    if (this.vboVerticesId >= 0) {
        GL15.glDeleteBuffers(this.vboVerticesId);
        this.verticesBuffer = null;
        this.vboVerticesId = -1;
    }
    if (this.vaoId >= 0) {
        GL30.glDeleteVertexArrays(this.vaoId);
        this.vaoId = -1;
    }
}

From source file:game.level.map.TileMap.java

License:Open Source License

public void DeleteVBOFromMemory() {
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(VBOVertexHandle);
    GL15.glDeleteBuffers(VBOColorHandle);
    GL15.glDeleteBuffers(VBONormalHandle);
    VBOVertexHandle = 0;/*w w  w .j ava 2 s . co m*/
    VBOColorHandle = 0;
    VBONormalHandle = 0;
}

From source file:go.graphics.swing.opengl.LWJGLDrawContext.java

License:Open Source License

void deleteGeometry(int geometryindex) {
    if (canUseVBOs) {
        GL15.glDeleteBuffers(geometryindex);
    } else {//from   w  ww.  ja va  2 s . c  om
        // TODO: unsupported!
        geometries.set(geometryindex, null);
    }
}