@Override public void glBindFramebuffer (int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
@Override public void glBindFramebuffer (int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
@Override public void glBindFramebuffer (int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
@Override public void glBindFramebuffer (int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
@Override public void glBindFramebufferEXT(int param1, int param2) { GL30.glBindFramebuffer(param1, param2); }
@Override public void glBindFramebufferEXT(final int target, final int frameBuffer) { GL30.glBindFramebuffer(target, frameBuffer); }
public LwjglFrameBufferObject(ResourceUrn urn, BaseVector2i size) { this.size = ImmutableVector2i.createOrUse(size); IntBuffer fboId = BufferUtils.createIntBuffer(1); GL30.glGenFramebuffers(fboId); frame = fboId.get(0); Texture texture = generateTexture(urn); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frame); GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture.getId(), 0); int result = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER); if (result != GL30.GL_FRAMEBUFFER_COMPLETE) { throw new IllegalStateException("Something went wrong with framebuffer! " + result); } GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); }
@Override public void unbindFrame() { GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); GL11.glViewport(vp.get(0), vp.get(1), vp.get(2), vp.get(3)); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 0, 2048f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }
@Override public void bindFrame() { vp = BufferUtils.createIntBuffer(16); GL11.glGetInteger(GL11.GL_VIEWPORT, vp); GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frame); GL11.glViewport(0, 0, size.x(), size.y()); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, size.x(), size.y(), 0, 0, 2048f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } }
@Override public void glBindFramebuffer(int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
@Override public void glBindFramebuffer (int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
@Override public void glBindFramebuffer (int target, int framebuffer) { GL30.glBindFramebuffer(target, framebuffer); }
public void bind() { glBindFramebuffer(GL_FRAMEBUFFER, id); }
public void unbind() { glBindFramebuffer(GL_FRAMEBUFFER, 0); }
@Override public void glBindFramebufferEXT(int param1, int param2) { GL30.glBindFramebuffer(param1, param2); }
public void blitFrameBuffer(int sourceAttachment, int destinationAttachment, int writeFBO, int width, int height){ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, writeFBO); glBindFramebuffer(GL_READ_FRAMEBUFFER, id); glReadBuffer(GL_COLOR_ATTACHMENT0 + sourceAttachment); glDrawBuffer(GL_COLOR_ATTACHMENT0 + destinationAttachment); glBlitFramebuffer(0,0,width,height,0,0,width,height, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); }
private void actualUnbindRead() { if (LOG.isTraceEnabled()) { LOG.trace("unbind read {} -> none", this.bind_read); } if (this.bind_read != null) { GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, 0); this.bind_read = null; } else { if (LOG.isTraceEnabled()) { LOG.trace( "redundant unbind read ignored {} -> none", this.bind_read); } } }
private void actualUnbindDraw() { if (LWJGL3Framebuffers.LOG.isTraceEnabled()) { LWJGL3Framebuffers.LOG.trace("unbind draw {} -> none", this.bind_draw); } if (this.bind_draw != null) { GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0); this.bind_draw = null; } else { if (LWJGL3Framebuffers.LOG.isTraceEnabled()) { LWJGL3Framebuffers.LOG.trace( "redundant unbind draw ignored {} -> none", this.bind_draw); } } }
private void endLightRendering() { // Bind screen for writing glBindFramebuffer(GL_FRAMEBUFFER, 0); glEnable(GL_DEPTH_TEST); glDisable(GL_BLEND); }
private void initLightRendering() { // Bind scene buffer glBindFramebuffer(GL_FRAMEBUFFER, sceneBuffer.getBufferId()); // Clear G-Buffer clear(); // Disable depth testing to allow the drawing of multiple layers with the same depth glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_ONE, GL_ONE); // Bind GBuffer for reading glBindFramebuffer(GL_READ_FRAMEBUFFER, gBuffer.getGBufferId()); }