Example usage for com.badlogic.gdx.graphics.glutils FrameBuffer getHeight

List of usage examples for com.badlogic.gdx.graphics.glutils FrameBuffer getHeight

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.glutils FrameBuffer getHeight.

Prototype

public int getHeight() 

Source Link

Usage

From source file:com.bitfire.postprocessing.effects.CameraMotion.java

License:Apache License

@Override
public void render(FrameBuffer src, FrameBuffer dest) {
    if (dest != null) {
        camblur.setViewport(dest.getWidth(), dest.getHeight());
    } else {//  w w  w .  jav  a2s  .com
        camblur.setViewport(width, height);
    }

    camblur.setInput(src).setOutput(dest).render();
}

From source file:com.bladecoder.engineeditor.ui.SceneList.java

License:Apache License

private TextureRegion createBgIcon(String atlas, String region) {
    TextureAtlas a = new TextureAtlas(Gdx.files
            .absolute(Ctx.project.getProjectPath() + "/" + Project.ATLASES_PATH + "/1/" + atlas + ".atlas"));
    AtlasRegion r = a.findRegion(region);

    if (r == null) {
        a.dispose();/*from www  .  j  av  a  2 s.  c o m*/
        return null;
    }

    FrameBuffer fbo = new FrameBuffer(Format.RGBA8888, 200,
            (int) (r.getRegionHeight() * 200f / r.getRegionWidth()), false);

    SpriteBatch fboBatch = new SpriteBatch();
    fboBatch.setColor(Color.WHITE);
    OrthographicCamera camera = new OrthographicCamera();
    camera.setToOrtho(false, fbo.getWidth(), fbo.getHeight());
    fboBatch.setProjectionMatrix(camera.combined);

    Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST);
    fbo.begin();
    fboBatch.begin();
    fboBatch.draw(r, 0, 0, fbo.getWidth(), fbo.getHeight());
    fboBatch.end();

    TextureRegion tex = ScreenUtils.getFrameBufferTexture(0, 0, fbo.getWidth(), fbo.getHeight());
    // tex.flip(false, true);

    fbo.end();
    Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST);

    fbo.dispose();
    a.dispose();
    fboBatch.dispose();

    return tex;
}

From source file:com.blastedstudios.ledge.ui.postprocessing.effects.CameraMotion.java

License:Apache License

@Override
public void render(FrameBuffer src, FrameBuffer dest) {
    if (dest != null) {
        camblur.setViewport(dest.getWidth(), dest.getHeight());
    } else {/*  ww w  .  j a v  a  2  s.  c o m*/
        camblur.setViewport(width, height);
    }

    restoreViewport(dest);
    camblur.setInput(src).setOutput(dest).render();
}

From source file:org.illarion.engine.backend.gdx.GdxScene.java

License:Open Source License

/**
 * Check if a frame buffer is fitting the requirements.
 *
 * @param width    the width the image needs to have
 * @param height   the height the image needs to have
 * @param original the original image, if this is {@code null} a new image will be created
 * @return the image fitting the requirements
 *///from  w  w w .  jav a2  s .c o  m
@Nonnull
private static FrameBuffer validateFrameBuffer(final int width, final int height,
        @Nullable final FrameBuffer original) {
    if (original == null) {
        return new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
    }
    if ((original.getHeight() == height) && (original.getWidth() == width)) {
        return original;
    }
    original.dispose();
    return new FrameBuffer(Pixmap.Format.RGBA8888, width, height, false);
}