List of usage examples for com.badlogic.gdx.graphics.g2d SpriteBatch SpriteBatch
public SpriteBatch(int size, ShaderProgram defaultShader)
From source file:com.cyphercove.doublehelix.FilmGrain.java
License:Apache License
public FilmGrain(Texture noiseTexture, Texture borderTexture, Texture scanlineTexture, boolean forBloom) { this.forBloom = forBloom; this.noiseTexture = noiseTexture; this.borderTexture = borderTexture; this.scanlineTexture = scanlineTexture; String prefix = forBloom ? "filmgrain_bloom" : "filmgrain"; String vertexShaderSrc = Gdx.files.internal(prefix + "_vs.glsl").readString(); String fragmentShaderSrc = Gdx.files.internal(prefix + "_fs.glsl").readString(); filmGrainShaderProgram = new ShaderProgram(vertexShaderSrc, fragmentShaderSrc); if (!forBloom) { batch = new SpriteBatch(1, filmGrainShaderProgram); batch.setProjectionMatrix(new Matrix4().idt()); }/*w w w. ja v a2 s . c o m*/ u_grainInverse = filmGrainShaderProgram.getUniformLocation("u_grainInverse"); u_grainOffset = filmGrainShaderProgram.getUniformLocation("u_grainOffset"); u_flicker = filmGrainShaderProgram.getUniformLocation("u_flicker"); u_noiseTexture = filmGrainShaderProgram.getUniformLocation("u_noiseTexture"); u_scanLineTexture = filmGrainShaderProgram.getUniformLocation("u_scanLineTexture"); u_scanLineInverse = filmGrainShaderProgram.getUniformLocation("u_scanLineInverse"); if (forBloom) { u_borderTexture = filmGrainShaderProgram.getUniformLocation("u_borderTexture"); u_flipped = filmGrainShaderProgram.getUniformLocation("u_flipped"); } }
From source file:com.forerunnergames.peril.client.ui.SpriteBatchFactory.java
License:Open Source License
public static SpriteBatch create(final AssetManager assetManager) { Arguments.checkIsNotNull(assetManager, "assetManager"); if (GraphicsSettings.USE_OPENGL_CORE_PROFILE) { return new SpriteBatch(GraphicsSettings.SPRITES_IN_BATCH, assetManager.get(AssetSettings.SPRITE_BATCH_SHADER_PROGRAM_ASSET_DESCRIPTOR)); } else {/*from w w w . ja v a 2 s . c om*/ return new SpriteBatch(GraphicsSettings.SPRITES_IN_BATCH); } }
From source file:de.bioviz.ui.BioViz.java
License:Open Source License
@Override public void create() { messageCenter = new MessageCenter(this); float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); camera = new OrthographicCamera(1, h / w); batch = new BioVizSpriteBatch(new SpriteBatch(1000, BioViz.createDefaultShader())); inputProcessor = new BioVizInputProcessor(this); Gdx.input.setInputProcessor(inputProcessor); logger.trace("BioViz started"); }
From source file:org.illarion.engine.backend.gdx.GdxGraphics.java
License:Open Source License
/** * Create a new instance of the graphics engine that is using libGDX to render. * * @param gdxGraphics the libGDX graphics instance that is used *///from w w w .j a v a 2s . c o m GdxGraphics(@Nonnull final GdxEngine engine, @Nonnull final com.badlogic.gdx.Graphics gdxGraphics) { this.gdxGraphics = gdxGraphics; this.engine = engine; shapeRenderer = new ShapeRenderer(); spriteBatch = new SpriteBatch(1000, 10); tempColor1 = new com.badlogic.gdx.graphics.Color(); tempColor2 = new com.badlogic.gdx.graphics.Color(); tempColor3 = new com.badlogic.gdx.graphics.Color(); tempColor4 = new com.badlogic.gdx.graphics.Color(); tempRegion = new TextureRegion(); tempEngineRectangle = new Rectangle(); camera = new OrthographicCamera(); camera.zoom = 1.f; camera.setToOrtho(true); }