Example usage for org.lwjgl.opengl GL11 glTexParameterf

List of usage examples for org.lwjgl.opengl GL11 glTexParameterf

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTexParameterf.

Prototype

public static void glTexParameterf(@NativeType("GLenum") int target, @NativeType("GLenum") int pname,
        @NativeType("GLfloat") float param) 

Source Link

Document

Float version of #glTexParameteri TexParameteri .

Usage

From source file:org.free.jake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * LM_UploadBlock/*w  w  w.  j ava 2s . c o m*/
 * @param dynamic
 */
void LM_UploadBlock(boolean dynamic) {
    int texture = (dynamic) ? 0 : gl_lms.current_lightmap_texture;

    GL_Bind(gl_state.lightmap_textures + texture);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);

    gl_lms.lightmap_buffer.rewind();
    if (dynamic) {
        int height = 0;
        for (int i = 0; i < BLOCK_WIDTH1; i++) {
            if (gl_lms.allocated[i] > height) {
                height = gl_lms.allocated[i];
            }
        }

        GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH1, height, GL_LIGHTMAP_FORMAT,
                GL11.GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer);
    } else {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, gl_lms.internal_format, BLOCK_WIDTH1, BLOCK_HEIGHT1, 0,
                GL_LIGHTMAP_FORMAT, GL11.GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer);
        if (++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS) {
            Com.Error(Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
        }

        //debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4);
    }
}

From source file:org.free.jake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * GL_BeginBuildingLightmaps//ww w  .ja va  2 s.c  o  m
 */
void GL_BeginBuildingLightmaps(model_t m) {
    // static lightstyle_t   lightstyles[MAX_LIGHTSTYLES];
    int i;

    // init lightstyles
    if (lightstyles == null) {
        lightstyles = new lightstyle_t[Defines.MAX_LIGHTSTYLES];
        for (i = 0; i < lightstyles.length; i++) {
            lightstyles[i] = new lightstyle_t();
        }
    }

    // memset( gl_lms.allocated, 0, sizeof(gl_lms.allocated) );
    Arrays.fill(gl_lms.allocated, 0);

    r_framecount = 1; // no dlightcache

    GL_EnableMultitexture(true);
    GL_SelectTexture(GL_TEXTURE1);

    /*
     ** setup the base lightstyles so the lightmaps won't have to be regenerated
     ** the first time they're seen
     */
    for (i = 0; i < Defines.MAX_LIGHTSTYLES; i++) {
        lightstyles[i].rgb[0] = 1;
        lightstyles[i].rgb[1] = 1;
        lightstyles[i].rgb[2] = 1;
        lightstyles[i].white = 3;
    }
    r_newrefdef.lightstyles = lightstyles;

    if (gl_state.lightmap_textures == 0) {
        gl_state.lightmap_textures = TEXNUM_LIGHTMAPS;
    }

    gl_lms.current_lightmap_texture = 1;

    /*
     ** if mono lightmaps are enabled and we want to use alpha
     ** blending (a,1-a) then we're likely running on a 3DLabs
     ** Permedia2.  In a perfect world we'd use a GL_ALPHA lightmap
     ** in order to conserve space and maximize bandwidth, however
     ** this isn't a perfect world.
     **
     ** So we have to use alpha lightmaps, but stored in GL_RGBA format,
     ** which means we only get 1/16th the color resolution we should when
     ** using alpha lightmaps.  If we find another board that supports
     ** only alpha lightmaps but that can at least support the GL_ALPHA
     ** format then we should change this code to use real alpha maps.
     */

    char format = gl_monolightmap.string.toUpperCase().charAt(0);

    if (format == 'A') {
        gl_lms.internal_format = gl_tex_alpha_format;
    } /*
      ** try to do hacked colored lighting with a blended texture
      */ else if (format == 'C') {
        gl_lms.internal_format = gl_tex_alpha_format;
    } else if (format == 'I') {
        gl_lms.internal_format = GL11.GL_INTENSITY8;
    } else if (format == 'L') {
        gl_lms.internal_format = GL11.GL_LUMINANCE8;
    } else {
        gl_lms.internal_format = gl_tex_solid_format;
    }

    /*
     ** initialize the dynamic lightmap texture
     */
    GL_Bind(gl_state.lightmap_textures + 0);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, gl_lms.internal_format, BLOCK_WIDTH1, BLOCK_HEIGHT1, 0,
            GL_LIGHTMAP_FORMAT, GL11.GL_UNSIGNED_BYTE, dummy);
}

From source file:org.jogamp.glg2d.impl.gl2.GL2ImageDrawer.java

License:Apache License

@Override
protected void begin(Texture texture, AffineTransform xform, Color bgcolor) {
    GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
    GL11.glTexParameterf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_BLEND);

    /*//from   www .j a v  a  2  s. c  o  m
     * FIXME This is unexpected since we never disable blending, but in some
     * cases it interacts poorly with multiple split panes, scroll panes and the
     * text renderer to disable blending.
     */
    g2d.setComposite(g2d.getComposite());

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    texture.bind();

    savedTransform = null;
    if (xform != null && !xform.isIdentity()) {
        savedTransform = g2d.getTransform();
        g2d.transform(xform);
    }

    g2d.getColorHelper().setColorRespectComposite(bgcolor == null ? Color.white : bgcolor);
}

From source file:org.oscim.gdx.LwjglGL20.java

License:Apache License

public void texParameterf(int target, int pname, float param) {
    GL11.glTexParameterf(target, pname, param);
}

From source file:org.terasology.logic.manager.DefaultRenderingProcess.java

License:Apache License

public FBO createFBO(String title, int width, int height, FBOType type, boolean depth, boolean normals) {
    // Make sure to delete the existing FBO before creating a new one
    deleteFBO(title);//www . j  av  a2  s. co  m

    // Create a new FBO object
    FBO fbo = new FBO();
    fbo.width = width;
    fbo.height = height;

    // Create the color target texture
    fbo.textureId = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.textureId);

    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

    if (type != FBOType.NO_COLOR) {
        if (type == FBOType.HDR) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, ARBTextureFloat.GL_RGBA16F_ARB, width, height, 0,
                    GL11.GL_RGBA, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (java.nio.ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                    GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
        }
    }

    if (depth) {
        // Generate the depth texture
        fbo.depthTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.depthTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT24, width, height, 0,
                GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (java.nio.ByteBuffer) null);

        // Create depth render buffer object
        fbo.depthRboId = EXTFramebufferObject.glGenRenderbuffersEXT();
        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, fbo.depthRboId);
        EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                GL14.GL_DEPTH_COMPONENT24, width, height);
        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, 0);
    }

    if (normals) {
        // Generate the normals texture
        fbo.normalsTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.normalsTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    // Create the FBO
    fbo.fboId = EXTFramebufferObject.glGenFramebuffersEXT();
    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo.fboId);

    if (type != FBOType.NO_COLOR) {
        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, fbo.textureId, 0);
    }

    if (depth) {
        // Generate the depth render buffer and depth map texture
        EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                fbo.depthRboId);
        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D, fbo.depthTextureId, 0);
    }

    if (normals) {
        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT, GL11.GL_TEXTURE_2D, fbo.normalsTextureId, 0);
    }

    IntBuffer bufferIds = BufferUtils.createIntBuffer(3);
    if (type != FBOType.NO_COLOR) {
        bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT);
    }
    if (normals) {
        bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT);
    }
    bufferIds.flip();
    GL20.glDrawBuffers(bufferIds);

    int checkFB = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT);
    switch (checkFB) {
    case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT:
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
        logger.error("FrameBuffer: " + title
                + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception");

        /*
         * On some graphics cards, FBOType.NO_COLOR can cause a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT.
         * Attempt to continue without this FBO.
         */
        if (type == FBOType.NO_COLOR) {
            logger.error("FrameBuffer: " + title
                    + ", ...but the FBOType was NO_COLOR, ignoring this error and continuing without this FBO.");

            taint("Got a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT because of FBOType.NO_COLOR.");
            return null;
        }
    default:
        throw new RuntimeException("Unexpected reply from glCheckFramebufferStatusEXT: " + checkFB);
    }

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);

    _FBOs.put(title, fbo);
    return fbo;
}

From source file:org.terasology.logic.manager.PostProcessingRenderer.java

License:Apache License

public FBO createFBO(String title, int width, int height, boolean hdr, boolean depth, boolean normals) {
    // Make sure to delete the existing FBO before creating a new one
    deleteFBO(title);// ww w .j  a va2s .  c o m

    // Create a new FBO object
    FBO fbo = new FBO();
    fbo._width = width;
    fbo._height = height;

    // Create the color target texture
    fbo._textureId = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo._textureId);

    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

    if (hdr) {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, ARBTextureFloat.GL_RGBA16F_ARB, width, height, 0, GL11.GL_RGBA,
                ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (java.nio.ByteBuffer) null);
    } else {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
    }

    if (depth) {
        // Generate the depth texture
        fbo._depthTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo._depthTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT24, width, height, 0,
                GL11.GL_DEPTH_COMPONENT, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (java.nio.ByteBuffer) null);

        // Create depth render buffer object
        fbo._depthRboId = EXTFramebufferObject.glGenRenderbuffersEXT();
        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, fbo._depthRboId);
        EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                GL14.GL_DEPTH_COMPONENT16, width, height);
        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, 0);
    }

    if (normals) {
        // Generate the normals texture
        fbo._normalsTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo._normalsTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    // Create the FBO
    fbo._fboId = EXTFramebufferObject.glGenFramebuffersEXT();
    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo._fboId);

    EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
            EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, fbo._textureId, 0);

    if (depth) {
        // Generate the depth render buffer and depth map texture
        EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                fbo._depthRboId);
        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D, fbo._depthTextureId, 0);
    }

    if (normals) {
        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT, GL11.GL_TEXTURE_2D, fbo._normalsTextureId, 0);
    }

    IntBuffer bufferIds = BufferUtils.createIntBuffer(3);
    bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT);
    if (normals) {
        bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT);
    }
    bufferIds.flip();
    GL20.glDrawBuffers(bufferIds);

    int framebuffer = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT);
    switch (framebuffer) {
    case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT:
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
        logger.error("FrameBuffer: " + title
                + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception");
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception");
    default:
        throw new RuntimeException("Unexpected reply from glCheckFramebufferStatusEXT: " + framebuffer);
    }

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);

    _FBOs.put(title, fbo);
    return fbo;
}

From source file:org.terasology.rendering.opengl.DefaultRenderingProcess.java

License:Apache License

public FBO createFBO(String title, int width, int height, FBOType type, boolean depthBuffer,
        boolean normalBuffer, boolean lightBuffer, boolean stencilBuffer) {
    // Make sure to delete the existing FBO before creating a new one
    deleteFBO(title);//from w w w.j a v a  2 s  .co m

    // Create a new FBO object
    FBO fbo = new FBO();
    fbo.width = width;
    fbo.height = height;

    // Create the FBO
    fbo.fboId = glGenFramebuffersEXT();
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo.fboId);

    if (type != FBOType.NO_COLOR) {
        fbo.textureId = glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.textureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        if (type == FBOType.HDR) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                    ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                    GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
        }

        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D,
                fbo.textureId, 0);
    }

    if (normalBuffer) {
        fbo.normalsTextureId = glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.normalsTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);

        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL11.GL_TEXTURE_2D,
                fbo.normalsTextureId, 0);
    }

    if (lightBuffer) {
        fbo.lightBufferTextureId = glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.lightBufferTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        if (type == FBOType.HDR) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, ARBTextureFloat.GL_RGBA16F_ARB, width, height, 0,
                    GL11.GL_RGBA, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                    GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
        }

        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL11.GL_TEXTURE_2D,
                fbo.lightBufferTextureId, 0);
    }

    if (depthBuffer) {
        fbo.depthStencilTextureId = glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.depthStencilTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        if (!stencilBuffer) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT24, width, height, 0,
                    GL11.GL_DEPTH_COMPONENT, GL11.GL_UNSIGNED_INT, (ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, width,
                    height, 0, EXTPackedDepthStencil.GL_DEPTH_STENCIL_EXT,
                    EXTPackedDepthStencil.GL_UNSIGNED_INT_24_8_EXT, (ByteBuffer) null);
        }

        fbo.depthStencilRboId = glGenRenderbuffersEXT();
        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo.depthStencilRboId);

        if (!stencilBuffer) {
            glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL14.GL_DEPTH_COMPONENT24, width, height);
        } else {
            glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, width,
                    height);
        }

        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);

        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT,
                fbo.depthStencilRboId);
        glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D,
                fbo.depthStencilTextureId, 0);

        if (stencilBuffer) {
            glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D,
                    fbo.depthStencilTextureId, 0);
        }
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    IntBuffer bufferIds = BufferUtils.createIntBuffer(3);
    if (type != FBOType.NO_COLOR) {
        bufferIds.put(GL_COLOR_ATTACHMENT0_EXT);
    }
    if (normalBuffer) {
        bufferIds.put(GL_COLOR_ATTACHMENT1_EXT);
    }
    if (lightBuffer) {
        bufferIds.put(GL_COLOR_ATTACHMENT2_EXT);
    }
    bufferIds.flip();

    if (bufferIds.limit() == 0) {
        GL11.glReadBuffer(GL11.GL_NONE);
        GL20.glDrawBuffers(GL11.GL_NONE);
    } else {
        GL20.glDrawBuffers(bufferIds);
    }

    int checkFB = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
    switch (checkFB) {
    case GL_FRAMEBUFFER_COMPLETE_EXT:
        break;
    case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception");
        break;
    case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
        logger.error("FrameBuffer: " + title
                + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception");
        break;
    case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception");
        break;
    case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception");
        break;
    case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception");
        break;
    case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
        logger.error("FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_UNSUPPORTED_EXT exception");
        break;
    case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception");

        /*
         * On some graphics cards, FBOType.NO_COLOR can cause a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT.
         * Attempt to continue without this FBO.
         */
        if (type == FBOType.NO_COLOR) {
            logger.error("FrameBuffer: " + title
                    + ", ...but the FBOType was NO_COLOR, ignoring this error and continuing without this FBO.");

            return null;
        }

        break;
    default:
        logger.error("Unexpected reply from glCheckFramebufferStatusEXT: " + checkFB);
        break;
    }

    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

    fboLookup.put(title, fbo);
    return fbo;
}

From source file:org.terasology.rendering.opengl.FBO.java

License:Apache License

private static void setTextureParameters(float filterType) {
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filterType);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filterType);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
}

From source file:org.terasology.rendering.renderingProcesses.DefaultRenderingProcess.java

License:Apache License

public FBO createFBO(String title, int width, int height, FBOType type, boolean depthBuffer,
        boolean normalBuffer, boolean lightBuffer, boolean stencilBuffer) {
    // Make sure to delete the existing FBO before creating a new one
    deleteFBO(title);/*from   ww  w . j  av a 2 s.  co m*/

    // Create a new FBO object
    FBO fbo = new FBO();
    fbo.width = width;
    fbo.height = height;

    // Create the FBO
    fbo.fboId = EXTFramebufferObject.glGenFramebuffersEXT();
    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo.fboId);

    if (type != FBOType.NO_COLOR) {
        fbo.textureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.textureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        if (type == FBOType.HDR) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, ARBTextureFloat.GL_RGBA16F_ARB, width, height, 0,
                    GL11.GL_RGBA, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (java.nio.ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                    GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
        }

        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, fbo.textureId, 0);
    }

    if (normalBuffer) {
        fbo.normalsTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.normalsTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);

        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT, GL11.GL_TEXTURE_2D, fbo.normalsTextureId, 0);
    }

    if (lightBuffer) {
        fbo.lightBufferTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.lightBufferTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        if (type == FBOType.HDR) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, ARBTextureFloat.GL_RGBA16F_ARB, width, height, 0,
                    GL11.GL_RGBA, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, (java.nio.ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA,
                    GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);
        }

        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT2_EXT, GL11.GL_TEXTURE_2D, fbo.lightBufferTextureId, 0);
    }

    if (depthBuffer) {
        fbo.depthStencilTextureId = GL11.glGenTextures();
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.depthStencilTextureId);

        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

        if (!stencilBuffer) {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT24, width, height, 0,
                    GL11.GL_DEPTH_COMPONENT, GL11.GL_UNSIGNED_INT, (java.nio.ByteBuffer) null);
        } else {
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, width,
                    height, 0, EXTPackedDepthStencil.GL_DEPTH_STENCIL_EXT,
                    EXTPackedDepthStencil.GL_UNSIGNED_INT_24_8_EXT, (java.nio.ByteBuffer) null);
        }

        fbo.depthStencilRboId = EXTFramebufferObject.glGenRenderbuffersEXT();
        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                fbo.depthStencilRboId);

        if (!stencilBuffer) {
            EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                    GL14.GL_DEPTH_COMPONENT24, width, height);
        } else {
            EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                    EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, width, height);
        }

        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, 0);

        EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                fbo.depthStencilRboId);
        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D, fbo.depthStencilTextureId, 0);

        if (stencilBuffer) {
            EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                    EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, GL11.GL_TEXTURE_2D,
                    fbo.depthStencilTextureId, 0);
        }
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    IntBuffer bufferIds = BufferUtils.createIntBuffer(3);
    if (type != FBOType.NO_COLOR) {
        bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT);
    }
    if (normalBuffer) {
        bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT);
    }
    if (lightBuffer) {
        bufferIds.put(EXTFramebufferObject.GL_COLOR_ATTACHMENT2_EXT);
    }
    bufferIds.flip();

    if (bufferIds.limit() == 0) {
        GL11.glReadBuffer(GL11.GL_NONE);
        GL20.glDrawBuffers(GL11.GL_NONE);
    } else {
        GL20.glDrawBuffers(bufferIds);
    }

    int checkFB = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT);
    switch (checkFB) {
    case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT:
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception");
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
        logger.error("FrameBuffer: " + title
                + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception");
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception");
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception");
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception");
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_UNSUPPORTED_EXT:
        logger.error("FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_UNSUPPORTED_EXT exception");
        break;
    case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
        logger.error(
                "FrameBuffer: " + title + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception");

        /*
         * On some graphics cards, FBOType.NO_COLOR can cause a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT.
         * Attempt to continue without this FBO.
         */
        if (type == FBOType.NO_COLOR) {
            logger.error("FrameBuffer: " + title
                    + ", ...but the FBOType was NO_COLOR, ignoring this error and continuing without this FBO.");

            return null;
        }

        break;
    default:
        logger.error("Unexpected reply from glCheckFramebufferStatusEXT: " + checkFB);
        break;
    }

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);

    FBOs.put(title, fbo);
    return fbo;
}

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glTexParameterf(int target, int pname, float param) {
    GL11.glTexParameterf(target, pname, param);
}