Example usage for com.badlogic.gdx.graphics GL20 GL_LINEAR

List of usage examples for com.badlogic.gdx.graphics GL20 GL_LINEAR

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 GL_LINEAR.

Prototype

int GL_LINEAR

To view the source code for com.badlogic.gdx.graphics GL20 GL_LINEAR.

Click Source Link

Usage

From source file:com.bitfire.postprocessing.filters.CubemapEquirectangularFilter.java

License:Apache License

public void setSides(FrameBuffer xpositive, FrameBuffer xnegative, FrameBuffer ypositive, FrameBuffer ynegative,
        FrameBuffer zpositive, FrameBuffer znegative) {
    cubemapSides = new TextureData[6];
    cubemapSides[0] = xpositive.getColorBufferTexture().getTextureData();
    cubemapSides[1] = xnegative.getColorBufferTexture().getTextureData();
    cubemapSides[2] = ypositive.getColorBufferTexture().getTextureData();
    cubemapSides[3] = ynegative.getColorBufferTexture().getTextureData();
    cubemapSides[4] = zpositive.getColorBufferTexture().getTextureData();
    cubemapSides[5] = znegative.getColorBufferTexture().getTextureData();

    FrameBuffer[] fbos = new FrameBuffer[6];
    fbos[0] = xpositive;/*w ww. j a v  a 2  s. c  o m*/
    fbos[1] = xnegative;
    fbos[2] = ypositive;
    fbos[3] = ynegative;
    fbos[4] = zpositive;
    fbos[5] = znegative;

    if (cmId < 0)
        cmId = Gdx.gl.glGenTexture();

    // Make active
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0 + u_texture1);
    Gdx.gl.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, cmId);

    // Call glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i) for all sides
    for (int i = 0; i < cubemapSides.length; i++) {
        if (cubemapSides[i].getType() == TextureData.TextureDataType.Custom) {
            cubemapSides[i].consumeCustomData(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
        }
    }

    for (int i = 0; i < cubemapSides.length; i++) {
        fbos[i].begin();
        Gdx.gl.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, GL20.GL_COLOR_ATTACHMENT0,
                GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, cmId, 0);
        fbos[i].end();
    }

    Gdx.gl.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MAG_FILTER, GL20.GL_LINEAR);
    Gdx.gl.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_LINEAR);
    Gdx.gl.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_S, GL20.GL_CLAMP_TO_EDGE);
    Gdx.gl.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_T, GL20.GL_CLAMP_TO_EDGE);
    Gdx.gl.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, 0);

    setParam(Param.Cubemap, u_texture1);

}

From source file:com.perfectplay.org.SkyBox.java

License:Open Source License

public void reloadCubemap() {
    g_cubeTexture = createGLHandle();/*from  ww w.  j  a  v  a 2 s  .  c om*/
    Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture);

    Pixmap temp = manager.get(textures[0], Pixmap.class);
    Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, temp.getGLInternalFormat(), temp.getWidth(),
            temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels());
    temp = manager.get(textures[1], Pixmap.class);
    Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, temp.getGLInternalFormat(), temp.getWidth(),
            temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels());
    temp = manager.get(textures[2], Pixmap.class);
    Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, temp.getGLInternalFormat(), temp.getWidth(),
            temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels());
    temp = manager.get(textures[3], Pixmap.class);
    Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, temp.getGLInternalFormat(), temp.getWidth(),
            temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels());
    temp = manager.get(textures[4], Pixmap.class);
    Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, temp.getGLInternalFormat(), temp.getWidth(),
            temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels());
    temp = manager.get(textures[5], Pixmap.class);
    Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, temp.getGLInternalFormat(), temp.getWidth(),
            temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels());

    Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture);

    Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MAG_FILTER, GL20.GL_LINEAR);
    Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_NEAREST);
    Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_S, GL20.GL_CLAMP_TO_EDGE);
    Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_T, GL20.GL_CLAMP_TO_EDGE);
}