@Override public FloatFrameBuffer build () { return new FloatFrameBuffer(this); } }
public void render () { Gdx.gl20.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT); fb.begin(); fbshader.begin(); fbshader.setUniformf("u_viewport", fb.getWidth(), fb.getHeight()); fbshader.setUniformf("u_color", 0.0f, 1.0f, 0.0f); quad.render(fbshader, GL20.GL_TRIANGLES); fbshader.end(); fb.end(); ffb.begin(); fbshader.begin(); fbshader.setUniformf("u_viewport", ffb.getWidth(), ffb.getHeight()); fbshader.setUniformf("u_color", 1.0f, 0.0f, 0.0f); quad.render(fbshader, GL20.GL_TRIANGLES); fbshader.end(); ffb.end(); shader.begin(); fb.getColorBufferTexture().bind(0); ffb.getColorBufferTexture().bind(1); shader.setUniformMatrix("u_worldView", screenCamera.combined); shader.setUniformi("u_fbtex", 0); shader.setUniformi("u_ffbtex", 1); screenQuad.render(shader, GL20.GL_TRIANGLES); shader.end(); }
/** Creates a new FrameBuffer with a float backing texture, having the given dimensions and potentially a depth buffer attached. * * @param width the width of the framebuffer in pixels * @param height the height of the framebuffer in pixels * @param hasDepth whether to attach a depth buffer * @throws GdxRuntimeException in case the FrameBuffer could not be created */ public FloatFrameBuffer (int width, int height, boolean hasDepth) { FloatFrameBufferBuilder bufferBuilder = new FloatFrameBufferBuilder(width, height); bufferBuilder.addFloatAttachment(GL30.GL_RGBA32F, GL30.GL_RGBA, GL30.GL_FLOAT, false); if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer(); this.bufferBuilder = bufferBuilder; build(); }
/** Creates a new FrameBuffer with a float backing texture, having the given dimensions and potentially a depth buffer attached. * * @param width the width of the framebuffer in pixels * @param height the height of the framebuffer in pixels * @param hasDepth whether to attach a depth buffer * @throws GdxRuntimeException in case the FrameBuffer could not be created */ public FloatFrameBuffer (int width, int height, boolean hasDepth) { FloatFrameBufferBuilder bufferBuilder = new FloatFrameBufferBuilder(width, height); bufferBuilder.addFloatAttachment(GL30.GL_RGBA32F, GL30.GL_RGBA, GL30.GL_FLOAT, false); if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer(); this.bufferBuilder = bufferBuilder; build(); }
@Override public FloatFrameBuffer build () { return new FloatFrameBuffer(this); } }
/** Creates a new FrameBuffer with a float backing texture, having the given dimensions and potentially a depth buffer attached. * * @param width the width of the framebuffer in pixels * @param height the height of the framebuffer in pixels * @param hasDepth whether to attach a depth buffer * @throws GdxRuntimeException in case the FrameBuffer could not be created */ public FloatFrameBuffer (int width, int height, boolean hasDepth) { FloatFrameBufferBuilder bufferBuilder = new FloatFrameBufferBuilder(width, height); bufferBuilder.addFloatAttachment(GL30.GL_RGBA32F, GL30.GL_RGBA, GL30.GL_FLOAT, false); if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer(); this.bufferBuilder = bufferBuilder; build(); }
@Override public void create () { fb = new FrameBuffer(Format.RGBA8888, 200, 100, false); ffb = new FloatFrameBuffer(200, 100, false);
@Override public FloatFrameBuffer build () { return new FloatFrameBuffer(this); } }