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:de.ikosa.mars.viewer.glviewer.engine.GLRenderer2Stage.java

License:Open Source License

public void Draw() {
    // forward pass
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbAId);
    GL20.glDrawBuffers(GL30.GL_COLOR_ATTACHMENT0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    scene.Pass(GLScene.PassType.Forward, camera);

    // post pass/* w  ww . ja va 2s .co m*/
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbBId);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    ssqScene.Pass(GLScene.PassType.PostProcess);

    // post B pass
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    ssqScene.Pass(GLScene.PassType.PostProcess2);

}

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

License:Open Source License

public void init() {
    depthMap = GL11.glGenTextures();//  w w w .  j a va  2  s .  c  o m
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthMap);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0,
            GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL13.GL_CLAMP_TO_BORDER);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL13.GL_CLAMP_TO_BORDER);

    shadowFBO = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, shadowFBO);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, depthMap, 0);
    GL11.glDrawBuffer(GL11.GL_NONE);
    GL11.glReadBuffer(GL11.GL_NONE);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}

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

License:Open Source License

public void preRender() {
    Veya.program_shadow.use(true);/* w w w.j ava  2s  . co m*/
    updateMatrixLightSpaceMatrixLocation();
    GL11.glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, shadowFBO);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glCullFace(GL11.GL_FRONT);

}

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

License:Open Source License

public void postRender() {
    GL11.glCullFace(GL11.GL_BACK); // don't forget to reset original culling face
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    Veya.program_normal.use(true);//  w  ww. ja  va 2  s  .co  m
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());

    GL13.glActiveTexture(GL13.GL_TEXTURE1);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthMap);
}

From source file:fr.ign.cogit.geoxygene.appli.render.LwjglLayerRenderer.java

License:Open Source License

/**
 * Draw the Rendered FBO into the Ping Pong FBO
 * /*from   w w  w. ja v  a  2s  .c  om*/
 * @throws GLException
 */
private void drawInPingPongFBO() throws GLException {
    if (this.current_symbolizer == null) {
        logger.error("The current symbolizer is NULL");
        return;
    }
    // Get the blending mode of this symbolizer and the filter of the
    // current Layer.
    BlendingMode bmode = this.current_symbolizer.getBlendingMode();
    if (bmode == null) {
        bmode = GeoxygeneConstants.GL_VarName_DefaultBlendingMode;
    }

    LayerFilter layerfilter = ((AbstractLayer) this.getLayer()).getFilter();
    if (layerfilter == null)
        layerfilter = new LayerFilterIdentity();
    String program_name = "GLProgram-"
            + (bmode.toString() + "-" + layerfilter.getClass().getSimpleName()).toLowerCase();
    GLProgram p = GLContext.getActiveGlContext().getProgram(program_name);
    if (p == null) {
        GLProgramBuilder builder = new GLProgramBuilder();
        builder.addDelegateBuilder(new BlendingModeGLProgramBuilder(bmode, layerfilter));
        p = builder.build(program_name, null);
        if (p == null) {
            logger.warn("Failed to create the blending program " + bmode);
            logger.warn("Fallback to the default blending program "
                    + GeoxygeneConstants.GL_VarName_DefaultBlendingMode);
            bmode = GeoxygeneConstants.GL_VarName_DefaultBlendingMode;
            p = builder.build("GLProgram-"
                    + (bmode.toString() + "-" + LayerFilterIdentity.class.getSimpleName()).toLowerCase(), null);
        }
        if (p == null) {
            logger.fatal("Failed to create the blending program " + bmode + ". Exiting the rendering.");
            return;
        }
        GLContext.getActiveGlContext().addProgram(p);
    }
    GLContext.getActiveGlContext().setCurrentProgram(p);
    this.getLayerViewPanel().getGLCanvas().drawInPingPong(p);

    GL30.glBindVertexArray(LayerViewGLPanel.getScreenQuad().getVaoId());

    p.setUniform(GeoxygeneConstants.GL_VarName_ObjectOpacityVarName, 1f);
    p.setUniform(GeoxygeneConstants.GL_VarName_GlobalOpacityVarName, 1f);
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);

    GLTools.glCheckError("before FBO drawing textured quad");
    LwjglLayerRenderer.drawComplex(LayerViewGLPanel.getScreenQuad());
    GLTools.glCheckError("FBO drawing textured quad");
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    GL30.glBindVertexArray(0); // unbind VAO
    GLTools.glCheckError("exiting FBO rendering");
    glBindTexture(GL_TEXTURE_2D, 0); // unbind texture
}

From source file:ion2d.INGrabber.java

License:Open Source License

/**
 * Grabs an image of the display and attachs it to the specified texture
 * @param INTexture2D texture//from   www .j a va2s.co  m
 * @throws Exception
 */
public void grab(INTexture2D texture) throws Exception {
    GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING, this.oldBufferObject);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, this.bufferObject.get(0));

    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D,
            texture.getId(), 0);

    int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);

    if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
        throw new Exception("Frame Grabber could not attach texture to framebuffer");
    }

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, this.oldBufferObject.get(0));
}

From source file:ion2d.INGrabber.java

License:Open Source License

/**
 * Before Rendering of grabbing the screen
 *//*from  w ww  .j a  v a  2  s . c o  m*/
public void beforeRender() {
    GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING, this.oldBufferObject);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, this.bufferObject.get(0));

    GL11.glClearColor(0, 0, 0, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
}

From source file:ion2d.INGrabber.java

License:Open Source License

/**
 * After Rendering of grabbing the screen
 */
public void afterRender() {
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, this.oldBufferObject.get(0));
}

From source file:net.smert.frameworkgl.opengl.helpers.FrameBufferObjectHelper.java

License:Apache License

public void attachRenderBuffer(int attachment, int rboID) {
    GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, attachment, GL30.GL_RENDERBUFFER, rboID);
}

From source file:net.smert.frameworkgl.opengl.helpers.FrameBufferObjectHelper.java

License:Apache License

public void attachTexture(int attachment, int textureID) {
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, attachment, textureTarget, textureID, 0);
}