Example usage for org.lwjgl.opengl GL30 GL_FRAMEBUFFER

List of usage examples for org.lwjgl.opengl GL30 GL_FRAMEBUFFER

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL30 GL_FRAMEBUFFER.

Prototype

int GL_FRAMEBUFFER

To view the source code for org.lwjgl.opengl GL30 GL_FRAMEBUFFER.

Click Source Link

Document

Accepted by the target parameter of BindFramebuffer, CheckFramebufferStatus, FramebufferTexture{1D|2D|3D}, FramebufferRenderbuffer, and GetFramebufferAttachmentParameteriv.

Usage

From source file:com.samrj.devil.gl.DGL.java

License:Open Source License

/**
 * Binds the given frame buffer to the given target. Pass null to bind the
 * default frame buffer./*from w w  w . j a  v  a2  s  . com*/
 * 
 * @param fbo The frame buffer to bind.
 * @param target The targe to bind to, or null to bind the default frame
 *        buffer;
 * @return The given frame buffer.
 */
public static FBO bindFBO(FBO fbo, int target) {
    switch (target) {
    case GL30.GL_FRAMEBUFFER:
        readFBO = fbo;
        drawFBO = fbo;
        break;
    case GL30.GL_READ_FRAMEBUFFER:
        readFBO = fbo;
        break;
    case GL30.GL_DRAW_FRAMEBUFFER:
        drawFBO = fbo;
        break;
    default:
        throw new IllegalArgumentException("Illegal target specified.");
    }

    if (fbo != null)
        fbo.bind(target);
    else
        GL30.glBindFramebuffer(target, 0);
    return fbo;
}

From source file:com.samrj.devil.gl.DGL.java

License:Open Source License

/**
 * Binds the given frame buffer to read from and draw to. Pass null to bind
 * the default frame buffer./*from w w w .  j av  a 2  s.co m*/
 * 
 * @param fbo The frame buffer to bind, or null to bind the default frame
 *        buffer.
 * @return The given frame buffer.
 */
public static FBO bindFBO(FBO fbo) {
    return bindFBO(fbo, GL30.GL_FRAMEBUFFER);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

/**
 * Attaches the given texture to this frame buffer. Must be bound.
 * //w ww . j  a  va  2 s . c om
 * @param texture The texture to attach.
 * @param attachment The attachment type.
 */
public void texture2D(Texture2D texture, int attachment) {
    ensureBound();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, attachment, texture.target, texture.id, 0);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

/**
 * Attaches a layer of the given 3D texture to this frame buffer. This frame
 * buffer must be bound.//  w w w. j av a 2s  .  c o m
 * 
 * @param texture The 3D texture to attach.
 * @param layer The layer of the given texture to attach.
 * @param attachment The attachment type.
 */
public void texture3D(Texture3D texture, int layer, int attachment) {
    ensureBound();
    if (layer < 0 || layer >= texture.getDepth())
        throw new ArrayIndexOutOfBoundsException();
    GL30.glFramebufferTexture3D(GL30.GL_FRAMEBUFFER, attachment, texture.target, texture.id, 0, layer);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

/**
 * Attaches a layer of the given 2D texture array to this frame buffer. This
 * frame buffer must be bound./*from  w w  w . jav  a 2  s  .c  om*/
 * 
 * @param texture The 2D texture array to attach.
 * @param layer The layer of the given texture array to attach.
 * @param attachment The attachment type.
 */
public void textureLayer(Texture2DArray texture, int layer, int attachment) {
    ensureBound();
    if (layer < 0 || layer >= texture.getDepth())
        throw new ArrayIndexOutOfBoundsException();
    GL30.glFramebufferTextureLayer(GL30.GL_FRAMEBUFFER, attachment, texture.id, 0, layer);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

/**
 * Attaches a face of the given cubemap texture to this frame buffer. This
 * frame buffer must be bound./*from  ww w  . j  a v a 2 s . c  om*/
 * 
 * @param texture The 2D texture array to attach.
 * @param face The face of the given cubemap to attach.
 * @param attachment The attachment type.
 */
public void textureCubemap(TextureCubemap texture, int face, int attachment) {
    ensureBound();
    if (face < 0 || face >= 6)
        throw new ArrayIndexOutOfBoundsException();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, attachment, GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + face,
            texture.id, 0);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

public void texture2DMultisample(Texture2DMultisample texture, int attachment) {
    ensureBound();//from  www. ja  v a 2  s .  c  o m
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, attachment, texture.target, texture.id, 0);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

/**
 * Attaches the given render buffer to this frame buffer. This frame buffer
 * must be bound.//ww  w  . j  a v  a  2 s .co  m
 * 
 * @param rbo The render buffer to attach.
 * @param attachment The attachment type.
 */
public void renderBuffer(RBO rbo, int attachment) {
    ensureBound();
    GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, attachment, GL30.GL_RENDERBUFFER, rbo.id);
}

From source file:com.samrj.devil.gl.FBO.java

License:Open Source License

/**
 * @return The status of this frame buffer, as a string.
 *///  w w w  . ja  va  2 s . c  o  m
public String getStatus() {
    ensureBound();
    int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
    return statusName(status);
}

From source file:com.xrbpowered.gl.res.buffers.MultisampleBuffers.java

License:Open Source License

public MultisampleBuffers(int w, int h, int samples, boolean hdr) {
    super(GL30.glGenFramebuffers(), w, h);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo);
    create(w, h, samples, true, hdr);// ww w .  j  a  va  2  s.  com
    resolve = new OffscreenBuffers(w, h, false, hdr);
}