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

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

Introduction

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

Prototype

int GL_TEXTURE0

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

Click Source Link

Usage

From source file:color.guard.GameplayScreen.java

License:Open Source License

@Override
public void render(float delta) {
    //GLProfiler.reset();
    glp.reset();//w w  w  .  j a va2s  . c o m
    Gdx.graphics.setTitle("Color Guard, running at " + Gdx.graphics.getFramesPerSecond() + " FPS");
    currentTime += delta;
    //        float swap = (NumberTools.zigzag(currentTime * 1.141592653589793f)
    //                + NumberTools.zigzag(currentTime * 1.218281828459045f)
    //                + NumberTools.zigzag(currentTime * 0.718281828459045f)
    //                + NumberTools.sway(currentTime * 0.141592653589793f)) * 0.125f + 0.5f;

    //        cameraTraversed = Math.min(1f, cameraTraversed + delta * 8);
    //        tempVector3.set(prevCameraPosition).lerp(nextCameraPosition, cameraTraversed);
    //        viewport.getCamera().position.set(tempVector3);
    if (inputMode == INPUT_LOCKED) {
        if (dijkstra.path.isEmpty())
            inputMode = INPUT_ALLOWED;
        else if ((turnTime += delta) >= 0.75f) {
            turnTime = 0f;
            //dijkstra.path.size() - 1
            Coord pt = state.world.battle.moveTargets.getAt(0), next = dijkstra.path.remove(0);
            //, playerPos = state.world.battle.pieces.keyAt(0);

            Piece p;
            if (state.world.battle.pieces.keyAt(0).equals(pt))
                p = state.world.battle.pieces.getAt(0);
            else
                p = state.world.battle.pieces.alterAtCarefully(0, pt);
            if (p != null) {
                p = state.world.battle.pieces.getAt(0);
                lastArrow = Direction.getRoughDirection(next.x - pt.x, next.y - pt.y);
                p.faceDirection(lastArrow);
                int idx = state.world.battle.moveTargets.indexOf(next);
                if (idx >= 0)
                    state.world.battle.moveTargets.alterAt(idx, state.world.battle.pieces.keyAt(idx));
                if (!state.world.battle.pieces.containsKey(next))
                //&& (p.pieceKind.permits & 1 << map[next.x][next.y]) != 0
                {
                    state.world.battle.moveTargets.alter(pt, next);
                    lastArrow = Direction.NONE;
                }
            }
        }
    } else if ((turnTime += delta) >= 1.5f) {
        turnTime = 0f;
        Coord pt = state.world.battle.moveTargets.getAt(0);
        Piece p;
        if (state.world.battle.pieces.keyAt(0).equals(pt))
            p = state.world.battle.pieces.getAt(0);
        else
            p = state.world.battle.pieces.alterAtCarefully(0, pt);
        if (p != null) {
            p = state.world.battle.pieces.getAt(0);
            p.faceDirection(lastArrow);
            Coord next = pt.translateCapped(lastArrow.deltaX, lastArrow.deltaY, map.length, map[0].length);
            if (!state.world.battle.pieces.containsKey(next) && !state.world.battle.moveTargets.contains(next))
            //                    && (p.pieceKind.permits & 1 << map[next.x][next.y]) != 0)
            {
                state.world.battle.moveTargets.alter(pt, next);
                lastArrow = Direction.NONE;
            }
            state.world.battle.advanceTurn();
        }
    }

    //displayString = state.world.mapGen.atlas.getAt(((int)currentTime >>> 2) % 24 + 2);
    Gdx.gl.glClearColor(0.45F, 0.7F, 1f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    int currentKind;
    Piece currentPiece;
    Sprite sprite;
    Coord c, n;
    BattleState battle = state.world.battle;
    OrderedMap<Coord, Piece> pieces = battle.pieces;
    float offX, offY;
    int idx;
    c = pieces.keyAt(0);
    n = battle.moveTargets.getAt(0);
    offX = MathUtils.lerp(0f, 32f * ((n.y - c.y) - (n.x - c.x)), Math.min(1f, turnTime * 1.6f));
    offY = MathUtils.lerp(0f, 16f * ((n.y - c.y) + (n.x - c.x)), Math.min(1f, turnTime * 1.6f));
    Vector3 position = viewport.getCamera().position.set(32 * (c.y - c.x) + offX + 9f,
            16 * (c.y + c.x) + offY + 13f, 0f);
    viewport.getCamera().update();

    viewport.apply(false);

    batch.setProjectionMatrix(viewport.getCamera().combined);

    batch.setShader(indexShader);
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE1);
    palettes.bind();
    batch.begin();

    //indexShader.setUniformi("u_texPalette", 2);
    indexShader.setUniformi("u_texPalette", 1);
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    //textures.first().bind(1);
    //        indexShader.setUniformi("u_texture", 1);

    int centerX = -(int) ((position.x) - 2 * (position.y)) >> 6,
            centerY = (int) ((position.x) + 2 * (position.y)) >> 6, minX = Math.max(0, centerX - 13),
            maxX = Math.min(centerX + 14, mapWidth - 1), minY = Math.max(0, centerY - 14),
            maxY = Math.min(centerY + 13, mapHeight - 1);
    batch.setColor(208f / 255f, 1f, 1f, 1f);
    for (int x = maxX; x >= minX; x--) {
        for (int y = maxY; y >= minY; y--) {
            currentKind = map[x][y];
            //batch.setColor(208f / 255f, MathUtils.clamp((float) fog.getNoise(32 * y - 32 * x, 16 * y + 16 * x, currentTime * 60) * 0.7f + 0.7f, 0.1f, 1f), 1f, 1f);
            batch.draw(terrains[currentKind], 32 * (y - x), 16 * (y + x));
            //                tempSB.setLength(0);
            //                font.draw(batch, tempSB.append(state.world.bioGen.heatCodeData[x][y]),
            //                        32 * y - 32 * x, 16 * y + 16 * x + 32, 64f, 1, false);
        }
    }
    /*int centerX = (int)(position.x) >> 5,
        centerY = (int)(position.y) >> 5,
        minX = Math.max(0, centerX - 13), maxX = Math.min(centerX + 13, mapWidth - 1),
        minY = Math.max(0, centerY - 8), maxY = Math.min(centerY + 8, mapHeight - 1);
    for (int y = maxY; y >= minY; y--) {
    for (int x = maxX; x >= minX; x--) {
        currentKind = map[x][y];
        batch.setColor((208) / 255f, 1f, 1f, 1f);
        batch.draw(terrains[currentKind], 32 * x, 32 * y);
    }
    }
    */
    for (int y = maxY; y >= minY; y--) {
        for (int x = maxX; x >= minX; x--) {
            if ((currentPiece = pieces.get(c = Coord.get(x, y))) != null) {
                idx = pieces.indexOf(c);
                n = battle.moveTargets.getAt(idx);
                currentKind = currentPiece.kind << 2 | currentPiece.facing;
                if (c.equals(n) && idx != 0) {
                    if (inputMode == INPUT_LOCKED) {
                        sprite = (Sprite) standing[currentKind].getKeyFrame(currentTime, true);
                        offX = 0f;
                        offY = 0f;
                    } else {
                        switch (currentPiece.pieceKind.weapons) {
                        case 2:
                            sprite = (Sprite) acting0[currentKind].getKeyFrame(turnTime, false);
                            offX = -40f;
                            offY = -20f;
                            break;
                        case 3:
                            sprite = (Sprite) (((currentKind * (x << 4 | 13) * (y << 4 | 11) & 256) == 0)
                                    ? acting0
                                    : acting1)[currentKind].getKeyFrame(turnTime, false);
                            offX = -40f;
                            offY = -20f;
                            break;
                        case 1:
                            sprite = (Sprite) acting1[currentKind].getKeyFrame(turnTime, false);
                            offX = -40f;
                            offY = -20f;
                            break;
                        default:
                            sprite = (Sprite) standing[currentKind].getKeyFrame(currentTime, true);
                            offX = 0f;
                            offY = 0f;
                            break;
                        }
                    }
                    sprite.setColor(currentPiece.palette, 1f, 1f, 1f);
                    //MathUtils.clamp((float) fog.getNoise(32 * (y - x) + offX + 9f, 16 * (y + x) + offY + 13f, currentTime * 60) * 0.7f + 0.7f, 0.1f, 1f)
                    sprite.setPosition(32 * (y - x) + offX + 9f, 16 * (y + x) + offY + 13f);
                    sprite.draw(batch);

                    batch.setColor(Math.max(1, currentPiece.paint) / 255f, 0, 1, 1);
                    font.draw(batch, currentPiece.stats, 32 * (y - x) + 9f, 16 * (y + x) + 73f, 48f,
                            Align.center, true);
                    //batch.setColor(-0x1.fffffep126f); // white as a packed float
                } else {
                    boolean isPlayer = currentPiece.equals(playerPiece);
                    if (inputMode == INPUT_LOCKED && !isPlayer) {
                        offX = 0;
                        offY = 0;
                    } else {
                        offX = MathUtils.lerp(0f, 32f * ((n.y - c.y) - (n.x - c.x)),
                                Math.min(1f, turnTime * 1.6f));
                        offY = MathUtils.lerp(0f, 16f * ((n.y - c.y) + (n.x - c.x)),
                                Math.min(1f, turnTime * 1.6f));
                    }
                    sprite = (Sprite) standing[currentKind].getKeyFrame(currentTime, true);
                    sprite.setColor(currentPiece.palette, 1f, 1f, 1f);
                    //MathUtils.clamp((float) fog.getNoise(32 * (y - x) + offX + 9f, 16 * (y + x) + offY + 13f, currentTime * 60) * 0.7f + 0.7f, 0.1f, 1f)
                    sprite.setPosition(32 * (y - x) + offX + 9f, 16 * (y + x) + offY + 13f);
                    sprite.draw(batch);
                    batch.setColor(Math.max(1, currentPiece.paint) / 255f, 0, 1, 1);
                    font.draw(batch, currentPiece.stats, 32 * (y - x) + offX + 9f, 16 * (y + x) + offY + 73f,
                            48f, Align.center, true);
                    //batch.setColor(-0x1.fffffep126f); // white as a packed float
                }
            }
        }
    }
    //batch.setColor(1f / 255f, 1f, 1f, 1f);
    //font.draw(batch, "DC: " + drawCalls + ", TBINDS: " + textureBindings, position.x, position.y, 100f, Align.center, true);
    batch.end();
    int drawCalls = glp.getDrawCalls();
    int textureBindings = glp.getTextureBindings();
    tempSB.setLength(0);
    tempSB.append(Gdx.graphics.getFramesPerSecond()).append(" FPS, Draw Calls: ").append(drawCalls)
            .append(", Texture Binds: ").append(textureBindings);
    screenPosition.set(16, 8);
    batch.begin();
    viewport.unproject(screenPosition);
    font.draw(batch, tempSB, screenPosition.x, screenPosition.y);
    //font.draw(batch, displayString, -300, 1160); //state.world.mapGen.atlas.getAt(guiRandom.between(2, 26))
    //batch.setColor(-0x1.fffffep126f); // white as a packed float
    batch.end();
    //drawCalls = GLProfiler.drawCalls;
    //textureBindings = GLProfiler.textureBindings;
}

From source file:com.badlogic.gdx.tests.gles2.MipMap2D.java

License:Apache License

public void render() {
    Gdx.gl20.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE0);
    texture.bind();//from ww  w  .  j ava 2 s  .co m
    shader.begin();
    shader.setUniformf("s_texture", 0);

    Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_NEAREST);
    shader.setUniformf("u_offset", -0.6f);
    mesh.render(shader, GL20.GL_TRIANGLES);

    Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_LINEAR_MIPMAP_LINEAR);
    shader.setUniformf("u_offset", 0.6f);
    mesh.render(shader, GL20.GL_TRIANGLES);

    shader.end();
}

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;/*from  w w  w.  ja v  a2 s. com*/
    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.bitfire.postprocessing.filters.CubemapEquirectangularFilter.java

License:Apache License

@Override
protected void onBeforeRender() {
    // Bind cubemap
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0 + u_texture1);
    Gdx.gl.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, cmId);

    inputTexture.bind(u_texture0);/*from  w ww. jav a  2 s. c  om*/
}

From source file:com.bitfire.postprocessing.PostProcessor.java

License:Apache License

/**
 * Stops capturing the scene and apply the effect chain, if there is one.
 * If the specified output framebuffer is NULL, then the rendering will be
 * performed to screen./*from   w w  w.jav  a  2  s  . com*/
 */
public void render(FrameBuffer dest) {
    captureEnd();

    if (!hasCaptured) {
        return;
    }

    // Array<PostProcessorEffect> items = manager.items;
    Array<PostProcessorEffect> items = enabledEffects;

    int count = items.size;
    if (count > 0) {

        Gdx.gl.glDisable(GL20.GL_CULL_FACE);

        // render effects chain, [0,n-1]
        if (count > 1) {
            for (int i = 0; i < count - 1; i++) {
                PostProcessorEffect e = items.get(i);

                composite.capture();
                {
                    e.render(composite.getSourceBuffer(), composite.getResultBuffer());
                }
            }

            // complete
            composite.end();
        }

        if (listener != null) {
            listener.beforeRenderToScreen();
        }

        // render with null dest (to screen)
        items.get(count - 1).render(composite.getResultBuffer(), dest);

        // ensure default texture unit #0 is active
        Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    } else {
        Gdx.app.log("PostProcessor", "No post-processor effects enabled, aborting render");
    }
}

From source file:com.blastedstudios.ledge.ui.postprocessing.PostProcessor.java

License:Apache License

/** Stops capturing the scene and apply the effect chain, if there is one. If the specified output framebuffer is NULL, then the
 * rendering will be performed to screen. */
public void render(FrameBuffer dest) {
    captureEnd();//from  w w w .  ja va  2  s .c o  m

    if (!hasCaptured) {
        return;
    }

    // Array<PostProcessorEffect> items = manager.items;
    Array<PostProcessorEffect> items = enabledEffects;

    int count = items.size;
    if (count > 0) {

        Gdx.gl.glDisable(GL20.GL_CULL_FACE);
        Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);

        // render effects chain, [0,n-1]
        if (count > 1) {
            for (int i = 0; i < count - 1; i++) {
                PostProcessorEffect e = items.get(i);

                composite.capture();
                {
                    e.render(composite.getSourceBuffer(), composite.getResultBuffer());
                }
            }

            // complete
            composite.end();
        }

        if (listener != null && dest == null) {
            listener.beforeRenderToScreen();
        }

        // render with null dest (to screen)
        items.get(count - 1).render(composite.getResultBuffer(), dest);

        // ensure default texture unit #0 is active
        Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    } else {
        Log.log("PostProcessor", "No post-processor effects enabled, aborting render");
    }
}

From source file:com.cyphercove.doublehelix.FilmGrain.java

License:Apache License

public void render() {
    batch.enableBlending();/*from  w  w  w. ja va  2s.  com*/
    batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
    batch.begin();
    batch.setColor(Settings.filmGrain ? FILM_GRAIN_BRIGHTNESS : 0, Settings.scanLines ? SCANLINE_BRIGHTNESS : 0,
            Settings.vignette ? VIGNETTE_BRIGHTNESS : 0, 1);
    filmGrainShaderProgram.setUniformf(u_grainInverse, mFilmGrainInverse);
    filmGrainShaderProgram.setUniformf(u_scanLineInverse, mScanLineInverse);
    filmGrainShaderProgram.setUniformf(u_grainOffset, mRandom.nextFloat() * mFilmGrainInverse.x,
            mRandom.nextFloat() * mFilmGrainInverse.y);
    filmGrainShaderProgram.setUniformf(u_flicker, lerp(0.96f, 1f, mRandom.nextFloat()));
    noiseTexture.bind(1);
    scanlineTexture.bind(2);
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    filmGrainShaderProgram.setUniformi(u_noiseTexture, 1);
    filmGrainShaderProgram.setUniformi(u_scanLineTexture, 2);
    batch.draw(borderTexture, -1, -1, 2, 2);
    batch.end();
}

From source file:com.cyphercove.doublehelix.FilmGrain.java

License:Apache License

@Override
public void applyCustomShaderParameters(SpriteBatch spriteBatch, boolean flipped) {
    spriteBatch.setColor(Settings.filmGrain ? FILM_GRAIN_BRIGHTNESS : 0,
            Settings.scanLines ? SCANLINE_BRIGHTNESS : 0, Settings.vignette ? VIGNETTE_BRIGHTNESS : 0, 1);
    if (flipped) {
        swapVector2(mFilmGrainInverse);//  w  ww .j  a v a 2s .co  m
    }
    filmGrainShaderProgram.setUniformf(u_grainInverse, mFilmGrainInverse);
    filmGrainShaderProgram.setUniformf(u_scanLineInverse, mScanLineInverse);
    filmGrainShaderProgram.setUniformf(u_flipped, flipped ? 1f : 0f);
    filmGrainShaderProgram.setUniformf(u_grainOffset, mRandom.nextFloat() * mFilmGrainInverse.x,
            mRandom.nextFloat() * mFilmGrainInverse.y);
    filmGrainShaderProgram.setUniformf(u_flicker, lerp(0.96f, 1f, mRandom.nextFloat()));
    noiseTexture.bind(1);
    scanlineTexture.bind(2);
    borderTexture.bind(3);
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    filmGrainShaderProgram.setUniformi(u_noiseTexture, 1);
    filmGrainShaderProgram.setUniformi(u_scanLineTexture, 2);
    filmGrainShaderProgram.setUniformi(u_borderTexture, 3);
    if (flipped) {
        swapVector2(mFilmGrainInverse);
    }
}

From source file:com.lum.scram.postprocessing.PostProcessor.java

License:Apache License

/** Stops capturing the scene and apply the effect chain, if there is one. If the specified output framebuffer is NULL, then the
 * rendering will be performed to screen. */
public void render(FrameBuffer dest) {
    captureEnd();/*from  w  w w.  j a  va 2s .  c  o m*/

    if (!hasCaptured) {
        return;
    }

    // Array<PostProcessorEffect> items = manager.items;
    Array<PostProcessorEffect> items = enabledEffects;

    int count = items.size;
    if (count > 0) {

        Gdx.gl.glDisable(GL20.GL_CULL_FACE);
        Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);

        // render effects chain, [0,n-1]
        if (count > 1) {
            for (int i = 0; i < count - 1; i++) {
                PostProcessorEffect e = items.get(i);

                composite.capture();
                {
                    e.render(composite.getSourceBuffer(), composite.getResultBuffer());
                }
            }

            // complete
            composite.end();
        }

        if (listener != null && dest == null) {
            listener.beforeRenderToScreen();
        }

        // render with null dest (to screen)
        items.get(count - 1).render(composite.getResultBuffer(), dest);

        // ensure default texture unit #0 is active
        Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    } else {
        Gdx.app.log("PostProcessor", "No post-processor effects enabled, aborting render");
    }
}

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

License:Open Source License

public void render(PerspectiveCamera camera) {
    invView.set(camera.view);/* w w w .j a v  a  2 s  .  c o  m*/

    // Remove translation
    invView.val[Matrix4.M03] = 0;
    invView.val[Matrix4.M13] = 0;
    invView.val[Matrix4.M23] = 0;

    invView.inv().tra();

    mvp.set(camera.projection);
    mvp.mul(invView);

    Gdx.gl.glEnable(GL20.GL_CULL_FACE);
    Gdx.gl.glCullFace(GL20.GL_FRONT);
    Gdx.gl.glFrontFace(GL20.GL_CCW);

    Gdx.gl20.glDisable(GL20.GL_BLEND);
    Gdx.gl20.glDisable(GL20.GL_DEPTH_TEST);
    Gdx.gl20.glDepthMask(false);

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

    program.begin();

    program.setUniformMatrix("u_mvpMatrix", mvp);
    program.setUniformi("s_cubemap", 0);

    cube.render(program, GL20.GL_TRIANGLE_STRIP);

    program.end();

    Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
    Gdx.gl.glDepthMask(true);
}