List of usage examples for com.badlogic.gdx.graphics GL30 GL_DRAW_FRAMEBUFFER
int GL_DRAW_FRAMEBUFFER
To view the source code for com.badlogic.gdx.graphics GL30 GL_DRAW_FRAMEBUFFER.
Click Source Link
From source file:de.fatox.meta.graphics.buffer.MultisampleFBO.java
License:Apache License
/** Convenience method to return the first Texture attachment present in the fbo **/ public Texture getColorBufferTexture() { if (nonMultisampledFbo == null) { // TODO fix return null; }/*from w w w. j a va2 s. com*/ Gdx.gl30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, framebufferHandle); Gdx.gl30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, nonMultisampledFbo.getFramebufferHandle()); Gdx.gl30.glBlitFramebuffer(0, 0, getWidth(), getHeight(), 0, 0, getWidth(), getHeight(), GL30.GL_COLOR_BUFFER_BIT, GL30.GL_NEAREST); Gdx.gl30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0); Gdx.gl30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, 0); FrameBuffer.unbind(); return nonMultisampledFbo.getColorBufferTexture(); }
From source file:de.fatox.meta.graphics.buffer.MultisampleFBO.java
License:Apache License
/** Return the Texture attachments attached to the fbo **/ public Array<Texture> getTextureAttachments() { checkError(Gdx.gl.glGetError());/*from w w w . j av a 2 s.c o m*/ FrameBuffer.unbind(); Gdx.gl30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, framebufferHandle); Gdx.gl30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, nonMultisampledFbo.getFramebufferHandle()); IntBuffer intBuffer = BufferUtils.newIntBuffer(1); for (int i = 0; i < textureAttachments; i++) { if (i == textureAttachments - 1 && textureAttachments > 1) { Gdx.gl30.glReadBuffer(GL30.GL_NONE); intBuffer.put(GL30.GL_NONE); checkError(Gdx.gl.glGetError()); } else { Gdx.gl30.glReadBuffer(GL30.GL_COLOR_ATTACHMENT0 + i); intBuffer.put(GL30.GL_COLOR_ATTACHMENT0 + i); } intBuffer.rewind(); Gdx.gl30.glDrawBuffers(1, intBuffer); if (i == textureAttachments - 1 && textureAttachments > 1) { Gdx.gl30.glBlitFramebuffer(0, 0, getWidth(), getHeight(), 0, 0, getWidth(), getHeight(), GL30.GL_DEPTH_BUFFER_BIT, GL30.GL_NEAREST); } else { Gdx.gl30.glBlitFramebuffer(0, 0, getWidth(), getHeight(), 0, 0, getWidth(), getHeight(), GL30.GL_COLOR_BUFFER_BIT, GL30.GL_NEAREST); } } FrameBuffer.unbind(); return nonMultisampledFbo.getTextureAttachments(); }