Example usage for org.lwjgl.opengl EXTFramebufferObject glDeleteFramebuffersEXT

List of usage examples for org.lwjgl.opengl EXTFramebufferObject glDeleteFramebuffersEXT

Introduction

In this page you can find the example usage for org.lwjgl.opengl EXTFramebufferObject glDeleteFramebuffersEXT.

Prototype

public static void glDeleteFramebuffersEXT(@NativeType("GLuint const *") int[] framebuffers) 

Source Link

Document

Array version of: #glDeleteFramebuffersEXT DeleteFramebuffersEXT

Usage

From source file:com.ardor3d.framework.lwjgl.LwjglHeadlessCanvas.java

License:Open Source License

public void cleanup() {
    if (_fboID != 0) {
        final IntBuffer id = BufferUtils.createIntBuffer(1);
        id.put(_fboID);/*from   w  ww  . j av a2 s.  c  om*/
        id.rewind();
        EXTFramebufferObject.glDeleteFramebuffersEXT(id);
        _fboID = 0;
    }

    if (_depthRBID != 0) {
        final IntBuffer id = BufferUtils.createIntBuffer(1);
        id.put(_depthRBID);
        id.rewind();
        EXTFramebufferObject.glDeleteRenderbuffersEXT(id);
        _depthRBID = 0;
    }

    if (_colorRBID != 0) {
        final IntBuffer id = BufferUtils.createIntBuffer(1);
        id.put(_colorRBID);
        id.rewind();
        EXTFramebufferObject.glDeleteRenderbuffersEXT(id);
        _colorRBID = 0;
    }
    ContextManager.removeContext(this);
}

From source file:com.ardor3d.renderer.lwjgl.LwjglTextureRenderer.java

License:Open Source License

public void cleanup() {
    if (_fboID != 0) {
        final IntBuffer id = BufferUtils.createIntBuffer(1);
        id.put(_fboID);/*from   w w w.ja v  a  2s. co  m*/
        id.rewind();
        EXTFramebufferObject.glDeleteFramebuffersEXT(id);
    }

    if (_depthRBID != 0) {
        final IntBuffer id = BufferUtils.createIntBuffer(1);
        id.put(_depthRBID);
        id.rewind();
        EXTFramebufferObject.glDeleteRenderbuffersEXT(id);
    }
}

From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java

License:Apache License

public void glDeleteFramebuffers(int n, IntBuffer framebuffers) {
    EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers);
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL20.java

License:Apache License

@Override
public void glDeleteFramebuffer(int framebuffer) {
    EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffer);
}

From source file:com.flowpowered.caustic.lwjgl.gl20.GL20FrameBuffer.java

License:MIT License

@Override
public void destroy() {
    checkCreated();/*from   w  w  w .j a  va  2s  . c o m*/
    // Delete the frame buffer
    EXTFramebufferObject.glDeleteFramebuffersEXT(id);
    // Clear output buffers
    outputBuffers.clear();
    // Update the state
    super.destroy();
    // Check for errors
    LWJGLUtil.checkForGLError();
}

From source file:com.mtbs3d.minecrift.FBOParams.java

License:LGPL

public void delete() {
    if (_depthRenderBufferId != -1) {
        if (fboSupport == FBO_SUPPORT.USE_GL30)
            GL30.glDeleteRenderbuffers(_depthRenderBufferId);
        else/*ww  w. j ava  2s .  co  m*/
            EXTFramebufferObject.glDeleteRenderbuffersEXT(_depthRenderBufferId);

        _depthRenderBufferId = -1;
    }

    if (_colorTextureId != -1) {
        GL11.glDeleteTextures(_colorTextureId);
        _colorTextureId = -1;
    }

    if (_frameBufferId != -1) {
        if (fboSupport == FBO_SUPPORT.USE_GL30)
            GL30.glDeleteFramebuffers(_frameBufferId);
        else
            EXTFramebufferObject.glDeleteFramebuffersEXT(_frameBufferId);

        _frameBufferId = -1;
    }
}

From source file:flash.display.BitmapData.java

License:Open Source License

public void applyFilter(final BitmapData sourceBitmapData, final Rectangle sourceRect, final Point destPoint,
        final BitmapFilter filter) {
    final int textureId = JITB$textureId();

    ///*from  www.  j  a va  2  s  .  com*/
    // If this == sourceBitmapData we have to create a temporary buffer
    // as an input since we directly render to this BitmapData.
    //
    // Another case is when the filter is a ShaderFilter and it expects
    // an input which is also set to this.
    //

    final int bufferTextureId;

    //TODO this can be done in VRAM only
    bufferTextureId = glGenTextures();
    final ByteBuffer buffer = BufferUtils.createByteBuffer(width() * height() * 4);
    buffer.limit(buffer.capacity());
    glBindTexture(TextureUtil.mode(), bufferTextureId);
    glTexParameteri(TextureUtil.mode(), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(TextureUtil.mode(), GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexImage2D(TextureUtil.mode(), 0, GL_RGBA, width(), height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

    //
    // Create and bind FBO
    //

    final int fboId = EXTFramebufferObject.glGenFramebuffersEXT();

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fboId);

    //
    // Attach the current BitmapData as a texture to render to.

    EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
            EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, TextureUtil.mode(),
            -1 == bufferTextureId ? textureId : bufferTextureId, 0);

    //
    // Check the health of our FBO
    //

    final int status = EXTFramebufferObject
            .glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT);

    if (status != EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT) {
        throw new RuntimeException("Could not setup FBO.");
    }

    //
    // Start using FBO
    //

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fboId);
    glPushAttrib(GL_VIEWPORT_BIT);
    glViewport(0, 0, width(), height());

    //
    // Bind the source BitmapData as an input for the filter.
    //

    if (!rect().equals(sourceBitmapData.rect()) || !ORIGIN.equals(destPoint)) {
        glBindTexture(TextureUtil.mode(), JITB$textureId());
        rect().JITB$render(false);
    }

    glPushMatrix();
    glTranslated(destPoint.x, destPoint.y, 0.0);
    glBindTexture(TextureUtil.mode(), sourceBitmapData.JITB$textureId());

    //
    // Now run the filter with the given texture.
    //

    if (filter instanceof ShaderFilter) {
        ShaderFilter shaderFilter = ((ShaderFilter) filter);

        if (null != shaderFilter.shader()) {
            final ShaderInput[] inputs = shaderFilter.shader().data().JITB$inputs();

            if (inputs.length > 0) {
                inputs[0].input(this);
            }

            shaderFilter.shader().JITB$bind(0.0, 0.0, width(), height(), false);
        }

        sourceRect.JITB$render(false);

        if (null != shaderFilter.shader()) {
            shaderFilter.shader().JITB$unbind();
        }
    }

    glPopMatrix();

    //
    // Note: We can defer this step to the next _buffer access.
    //

    _buffer.clear();
    glReadPixels(0, 0, width(), height(), GL_RGBA, GL_UNSIGNED_BYTE, _buffer);
    _invalidated = -1 != bufferTextureId;

    //
    // Cleanup
    //

    glBindTexture(TextureUtil.mode(), 0);
    glPopAttrib();

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);

    EXTFramebufferObject.glDeleteFramebuffersEXT(fboId);

    if (-1 != bufferTextureId) {
        //
        // Exchange old texture for buffer.
        //

        glDeleteTextures(_textureId);
        _textureId = bufferTextureId;
    }
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glDeleteFramebuffers(int n) {
    EXTFramebufferObject.glDeleteFramebuffersEXT(n);
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glDeleteFramebuffers(int n, IntBuffer framebuffers) {
    EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers);
}

From source file:itdelatrisu.opsu.render.Rendertarget.java

License:Open Source License

/**
 * Destroy the OpenGL objects associated with this Rendertarget. Do not try
 * to use this rendertarget with OpenGL after calling this method.
 *///from  www .  j a va  2 s .c o  m
public void destroyRTT() {
    EXTFramebufferObject.glDeleteFramebuffersEXT(fboID);
    EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBufferID);
    GL11.glDeleteTextures(textureID);
}