Java Code Examples for org.lwjgl.opengl.GL15#glDeleteBuffers()

The following examples show how to use org.lwjgl.opengl.GL15#glDeleteBuffers() . 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: GL33Helper.java    From ldparteditor with MIT License 7 votes vote down vote up
public static void drawLinesRGB_GeneralSlow(float[] vertices) {
    int VBO_general = GL15.glGenBuffers();
    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, RGB_STRIDE, 0);

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

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    GL11.glDrawArrays(GL11.GL_LINES, 0, vertices.length);
    GL15.glDeleteBuffers(VBO_general);
}
 
Example 2
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 3
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 4
Source File: GL33Helper.java    From ldparteditor with MIT License 6 votes vote down vote up
public static void drawTrianglesIndexedRGB_GeneralSlow(float[] vertices, int[] indices) {
    int VBO_general = GL15.glGenBuffers();
    int EBO_general = GL15.glGenBuffers();
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO_general);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertices, GL15.GL_STREAM_DRAW);

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

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

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

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

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

    GL15.glDeleteBuffers(VBO_general);
    GL15.glDeleteBuffers(EBO_general);
}
 
Example 5
Source File: Rendertarget.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Destroy the OpenGL objects associated with this Rendertarget. Do not try
 * to use this rendertarget with OpenGL after calling this method.
 */
public void destroyRTT() {
	EXTFramebufferObject.glDeleteFramebuffersEXT(fboID);
	EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBufferID);
	GL11.glDeleteTextures(textureID);
	GL15.glDeleteBuffers(vboID);
}
 
Example 6
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 7
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 8
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 9
Source File: Rendertarget.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Destroy the OpenGL objects associated with this Rendertarget. Do not try
 * to use this rendertarget with OpenGL after calling this method.
 */
public void destroyRTT() {
	EXTFramebufferObject.glDeleteFramebuffersEXT(fboID);
	EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBufferID);
	GL11.glDeleteTextures(textureID);
	GL15.glDeleteBuffers(vboID);
}
 
Example 10
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 11
Source File: GL33HelperPrimitives.java    From ldparteditor with MIT License 5 votes vote down vote up
public static void destroyVBO_PrimitiveArea() {
    GL15.glDeleteBuffers(VBO_triangle);
    GL15.glDeleteBuffers(EBO_triangle);
    GL15.glDeleteBuffers(VBO_quad);
    GL15.glDeleteBuffers(EBO_quad);
    GL15.glDeleteBuffers(VBO_line);
}
 
Example 12
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 13
Source File: GL33Helper.java    From ldparteditor with MIT License 5 votes vote down vote up
public static void drawTriangle_GeneralSlow(float[] vertices) {
    int VBO_general = GL15.glGenBuffers();
    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);
    GL15.glDeleteBuffers(VBO_general);
}
 
Example 14
Source File: BufferHelper.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void glDeleteBuffers(int buffer) {
	GL15.glDeleteBuffers(buffer);
}
 
Example 15
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
}
 
Example 16
Source File: CurveRenderState.java    From opsu with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Discard the geometry for this curve object.
 */
public void discardGeometry() {
	GL15.glDeleteBuffers(vboID);
	vboID = -1;
}
 
Example 17
Source File: GL33Helper.java    From ldparteditor with MIT License 4 votes vote down vote up
public void destroyVBO() {
    GL15.glDeleteBuffers(VBO_general);
    GL15.glDeleteBuffers(EBO_general);
}
 
Example 18
Source File: Vbo.java    From OpenGL-Animation with The Unlicense 4 votes vote down vote up
public void delete(){
	GL15.glDeleteBuffers(vboId);
}
 
Example 19
Source File: Vbo.java    From LowPolyWater with The Unlicense 4 votes vote down vote up
public void delete(){
	GL15.glDeleteBuffers(vboId);
}
 
Example 20
Source File: GearGL33.java    From ldparteditor with MIT License 3 votes vote down vote up
public void draw(GLMatrixStack stack, GLShader shader, float x, float y, float z, float r, float g, float b) {
    
    final GLShader backup = stack.getShader();
    
    stack.setShader(shader);
    shader.use();
    
    stack.glPushMatrix();
    stack.glLoadIdentity();
    stack.glTranslatef(x, y, z);

    final int colour = shader.getUniformLocation("color"); //$NON-NLS-1$
    GL20.glUniform3f(colour, r, g, b);
    final int VBO = GL15.glGenBuffers();
    final int EBO = GL15.glGenBuffers();        
    
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, VBO);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bvertices, GL15.GL_STREAM_DRAW);
    
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, EBO);
    GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, bindices, GL15.GL_STREAM_DRAW);
    
    GL20.glEnableVertexAttribArray(0);
    GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 12, 0);
    
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    GL11.glDrawElements(GL11.GL_TRIANGLES, bindices.capacity(), GL11.GL_UNSIGNED_INT, 0);

    GL15.glDeleteBuffers(VBO);
    GL15.glDeleteBuffers(EBO);

    stack.setShader(backup);
    backup.use();
    
    stack.glPopMatrix();
}