Example usage for org.lwjgl.opengl GL30 glCheckFramebufferStatus

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

Introduction

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

Prototype

@NativeType("GLenum")
public static int glCheckFramebufferStatus(@NativeType("GLenum") int target) 

Source Link

Document

Checks the completeness status of a framebuffer.

Usage

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

License:Apache License

@Override
public int glCheckFramebufferStatus(int target) {
    return GL30.glCheckFramebufferStatus(target);
}

From source file:com.flowpowered.caustic.lwjgl.gl30.GL30FrameBuffer.java

License:MIT License

@Override
public boolean isComplete() {
    checkCreated();// w ww  . j av  a  2s .c  o m
    // Bind the frame buffer
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, id);
    // Fetch the status and compare to the complete enum value
    final boolean complete = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) == GL30.GL_FRAMEBUFFER_COMPLETE;
    // Unbind the frame buffer
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    // Check for errors
    LWJGLUtil.checkForGLError();
    return complete;
}

From source file:com.grillecube.client.opengl.GLH.java

public static int glhCheckFrameBufferStatus(int target) {
    return (GL30.glCheckFramebufferStatus(target));
}

From source file:com.opengrave.og.light.Depth2DFramebuffer.java

License:Open Source License

public Depth2DFramebuffer(int size) {
    framebufferSize = size;//from   w ww. j av  a 2 s .c  o  m
    framebuffer = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
    shadowMap = new Texture2DShadowMap(framebufferSize);

    shadowMap.bindToFrameBuffer();

    // GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0);
    GL11.glDrawBuffer(GL11.GL_NONE);
    Util.checkErr();
    GL11.glReadBuffer(GL11.GL_NONE);
    int i = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
    if (i != GL30.GL_FRAMEBUFFER_COMPLETE) {
        throw new RuntimeException("Framebuffer creation failed with code: " + i);
    }
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

    // TESTING STUFF
    count = 2;
    FloatBuffer pos = BufferUtils.createFloatBuffer(3 * 3 * count);
    FloatBuffer tex = BufferUtils.createFloatBuffer(2 * 3 * count);
    pos.put(0.75f).put(0.75f).put(0f);
    pos.put(0.75f).put(0.25f).put(0f);
    pos.put(0.25f).put(0.75f).put(0f);
    pos.put(0.25f).put(0.25f).put(0f);

    pos.put(0.75f).put(0.25f).put(0f);
    pos.put(0.25f).put(0.75f).put(0f);
    pos.flip();
    tex.put(1f).put(1f);
    tex.put(1f).put(0f);
    tex.put(0f).put(1f);
    tex.put(0f).put(0f);
    tex.put(1f).put(0f);

    tex.put(0f).put(1f);
    tex.flip();
    vao_ID = GL30.glGenVertexArrays();
    GL30.glBindVertexArray(vao_ID);
    int vbo_pos_ID = GL15.glGenBuffers();
    int vbo_tex_ID = GL15.glGenBuffers();
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo_pos_ID);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, pos, GL15.GL_STATIC_DRAW);
    GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 0, 0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo_tex_ID);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, tex, GL15.GL_STATIC_DRAW);
    GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 0, 0);
}

From source file:com.opengrave.og.light.DepthCubeFramebuffer.java

License:Open Source License

public DepthCubeFramebuffer(int size) {
    framebufferSize = size;// w  w  w  .  ja  v  a  2s.  c  om
    framebuffer = GL30.glGenFramebuffers();
    // System.out.println("Creating Pointlight Framebuffer : " +
    // framebuffer);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
    shadowMap = new TextureCubeShadowMap(framebufferSize);

    // shadowMap.bindToFrameBuffer();
    shadowMap.bindToFrameBuffer(0);
    // GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0);
    GL11.glDrawBuffer(GL11.GL_NONE);
    Util.checkErr();
    GL11.glReadBuffer(GL11.GL_NONE);
    int i = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
    if (i != GL30.GL_FRAMEBUFFER_COMPLETE) {
        throw new RuntimeException("Framebuffer creation failed with code: " + i);
    }
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    Util.checkErr();
}

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

License:Open Source License

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

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

License:Open Source License

protected static void checkStatus() {
    int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
    if (status != GL30.GL_FRAMEBUFFER_COMPLETE)
        throw new RuntimeException(String.format("Framebuffer not complete: %04X", status));
}

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

License:Open Source License

private static String getFramebufferError() {
    int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
    switch (status) {
    case GL30.GL_FRAMEBUFFER_COMPLETE:
        return null;
    case GL30.GL_FRAMEBUFFER_UNSUPPORTED:
        return "GL_FRAMEBUFFER_UNSUPPORTED";
    case GL30.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
        return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
    case GL30.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
        return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
    /* doesn't look like we have these constants
    case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
    return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT";
    case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
    return "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT";
    *//*from w w  w.j  av a2 s.c  o  m*/
    case GL30.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
        return "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER";
    case GL30.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
        return "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER";
    case GL30.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
        return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
    default:
        return "(unknown error: " + status + ")";
    }
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLRenderer2Stage.java

License:Open Source License

public GLRenderer2Stage(GLScene scene, GLResources resourceManager, GLCamera camera, int width, int height) {
    this.scene = scene;
    this.camera = camera;
    this.width = width;
    this.height = height;

    // setup opengl
    GL11.glViewport(0, 0, width, height);

    // setup framebuffer
    fbAId = GL30.glGenFramebuffers();/*  w  w w.  jav  a 2  s .c  o m*/
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbAId);

    // color buffer
    fbATexId = GLTextureBuilder.createEmptyTexture("FB", width, height, (byte) 0, (byte) 0, (byte) 0, (byte) 0)
            .getTextureId();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, fbATexId,
            0);

    // create depth buffer
    dbATexId = GLTextureBuilder.createEmptyTexture("DB", width, height, 0.0f).getTextureId();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, dbATexId, 0);

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

    if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
        ML.f(String.format("Cannot set up framebuffer: %x", status));
    }

    // setup framebuffer B
    fbBId = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbBId);

    // color buffer
    fbBTexId = GLTextureBuilder.createEmptyTexture("FB", width, height, (byte) 0, (byte) 0, (byte) 0, (byte) 0)
            .getTextureId();
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, fbBTexId,
            0);

    status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);

    if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
        ML.f(String.format("Cannot set up framebuffer: %x", status));
    }

    ssqScene = new GLSSQScene(resourceManager, resourceManager.getShader("post"), new GLTexture("FB", fbATexId),
            new GLTexture("DB", dbATexId), resourceManager.getShader("post2"), new GLTexture("FB2", fbBTexId));
}

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/*w  w  w.  ja va2s .c  o 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));
}