@Override public FrameBuffer build () { return new FrameBuffer(this); } }
@Override public FrameBuffer build () { return new FrameBuffer(this); } }
/** @deprecated Experimental, likely to change, do not use! */ public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight, float shadowNear, float shadowFar) { fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true); cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight); cam.near = shadowNear; cam.far = shadowFar; halfHeight = shadowViewportHeight * 0.5f; halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear); textureDesc = new TextureDescriptor(); textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest; textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge; }
/** @deprecated Experimental, likely to change, do not use! */ public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight, float shadowNear, float shadowFar) { fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true); cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight); cam.near = shadowNear; cam.far = shadowFar; halfHeight = shadowViewportHeight * 0.5f; halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear); textureDesc = new TextureDescriptor(); textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest; textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge; }
protected void init1 () { frameBuffers[FIRST_PASS] = new FrameBuffer(Pixmap.Format.RGBA8888, allocator.getWidth(), allocator.getHeight(), true); }
protected void init2 () { frameBuffers[SECOND_PASS] = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight(), true); passShaderProviders[SECOND_PASS] = new Pass2ShaderProvider(new Pass2Shader.Config(this)); }
@Override public void create () { mesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(Usage.ColorPacked, 4, "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords")); float c1 = Color.toFloatBits(255, 0, 0, 255); float c2 = Color.toFloatBits(255, 0, 0, 255); float c3 = Color.toFloatBits(0, 0, 255, 255); mesh.setVertices(new float[] {-0.5f, -0.5f, 0, c1, 0, 0, 0.5f, -0.5f, 0, c2, 1, 0, 0, 0.5f, 0, c3, 0.5f, 1}); stencilMesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute( Usage.ColorPacked, 4, "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords")); stencilMesh.setVertices(new float[] {-0.5f, 0.5f, 0, c1, 0, 0, 0.5f, 0.5f, 0, c2, 1, 0, 0, -0.5f, 0, c3, 0.5f, 1}); texture = new Texture(Gdx.files.internal("data/badlogic.jpg")); spriteBatch = new SpriteBatch(); frameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false); stencilFrameBuffer = new FrameBuffer(Format.RGB565, 128, 128, true, true); createShader(Gdx.graphics); }
@Override public void create () { fb = new FrameBuffer(Format.RGBA8888, 200, 100, false); ffb = new FloatFrameBuffer(200, 100, false);
public void create () { ShaderProgram.pedantic = false; /* * shader = new ShaderProgram(Gdx.files.internal("data/shaders/default.vert").readString(), Gdx.files.internal( * "data/shaders/depthtocolor.frag").readString()); if (!shader.isCompiled()) { Gdx.app.log("EdgeDetectionTest", * "couldn't compile scene shader: " + shader.getLog()); } */ batchShader = new ShaderProgram(Gdx.files.internal("data/shaders/batch.vert").readString(), Gdx.files.internal( "data/shaders/convolution.frag").readString()); if (!batchShader.isCompiled()) { Gdx.app.log("EdgeDetectionTest", "couldn't compile post-processing shader: " + batchShader.getLog()); } ObjLoader objLoader = new ObjLoader(); scene = objLoader.loadModel(Gdx.files.internal("data/scene.obj")); sceneInstance = new ModelInstance(scene); modelBatch = new ModelBatch(); fbo = new FrameBuffer(Format.RGB565, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(0, 0, 10); cam.lookAt(0, 0, 0); cam.far = 30; batch = new SpriteBatch(); batch.setShader(batchShader); fboRegion = new TextureRegion(fbo.getColorBufferTexture()); fboRegion.flip(false, true); logger = new FPSLogger(); calculateOffsets(); }
@Override public FrameBuffer build () { return new FrameBuffer(this); } }
fbo = new FrameBuffer(); fbo.begin(); // draw your stuff // ... fbo.end();
/** Creates a new ping-pong buffer and owns the resources. */ public PingPongBuffer (int width, int height, Format frameBufferFormat, boolean hasDepth) { ownResources = true; owned1 = new FrameBuffer(frameBufferFormat, width, height, hasDepth); owned2 = new FrameBuffer(frameBufferFormat, width, height, hasDepth); set(owned1, owned2); }
/** Creates a new ping-pong buffer and owns the resources. */ public PingPongBuffer (int width, int height, Format frameBufferFormat, boolean hasDepth) { ownResources = true; owned1 = new FrameBuffer(frameBufferFormat, width, height, hasDepth); owned2 = new FrameBuffer(frameBufferFormat, width, height, hasDepth); set(owned1, owned2); }
/** Creates a new ping-pong buffer and owns the resources. */ public PingPongBuffer (int width, int height, Format frameBufferFormat, boolean hasDepth) { ownResources = true; owned1 = new FrameBuffer(frameBufferFormat, width, height, hasDepth); owned2 = new FrameBuffer(frameBufferFormat, width, height, hasDepth); set(owned1, owned2); }
private FrameBuffer getFrameBuffer(int w, int h, int extra) { int key = getKey(w, h, extra); if (!fbcm.containsKey(key)) { fbcm.put(key, new FrameBuffer(Format.RGB888, w, h, true)); } return fbcm.get(key); }
public FrameBuffer getFrameBuffer(int w, int h) { String key = getKey(w, h); if (!fbmap.containsKey(key)) { FrameBuffer fb = new FrameBuffer(Format.RGB888, w, h, true); fbmap.put(key, fb); } return fbmap.get(key); }
/** @deprecated Experimental, likely to change, do not use! */ public DirectionalShadowLight (int shadowMapWidth, int shadowMapHeight, float shadowViewportWidth, float shadowViewportHeight, float shadowNear, float shadowFar) { fbo = new FrameBuffer(Format.RGBA8888, shadowMapWidth, shadowMapHeight, true); cam = new OrthographicCamera(shadowViewportWidth, shadowViewportHeight); cam.near = shadowNear; cam.far = shadowFar; halfHeight = shadowViewportHeight * 0.5f; halfDepth = shadowNear + 0.5f * (shadowFar - shadowNear); textureDesc = new TextureDescriptor(); textureDesc.minFilter = textureDesc.magFilter = Texture.TextureFilter.Nearest; textureDesc.uWrap = textureDesc.vWrap = Texture.TextureWrap.ClampToEdge; }
public void resize(int width, int height) { fbo = new FrameBuffer(Format.RGBA8888, width, height, false); finalShader.begin(); finalShader.setUniformf("resolution", width, height); finalShader.end(); }
@Override public void init() { render = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); renderTexture = render.getColorBufferTexture(); }
@Override public void resize(int width, int height) { this.width = width; this.height = height; if (frameBuffer != null) frameBuffer.dispose(); frameBuffer = new FrameBuffer(Pixmap.Format.RGB565, width, height, false); bufferTexture = new TextureRegion(frameBuffer.getColorBufferTexture()); bufferTexture.flip(false, true); }