private static void setupShadowFrameBuffer() { if (shadowPassInterval <= 0) { return; } setupShadowRenderTexture(); glDeleteFramebuffersEXT(sfb); sfb = glGenFramebuffersEXT(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, sfb); glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); glDeleteRenderbuffersEXT(sfbDepthBuffer); sfbDepthBuffer = glGenRenderbuffersEXT(); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, sfbDepthBuffer); glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, shadowMapWidth, shadowMapHeight); glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, sfbDepthBuffer); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, sfbDepthTexture, 0); int status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { System.out.println("Failed creating shadow framebuffer! (Status " + status + ")"); } }
private static void setupFrameBuffer() { setupRenderTextures(); if (dfb != 0) { glDeleteFramebuffersEXT(dfb); glDeleteRenderbuffersEXT(dfbRenderBuffers); } dfb = glGenFramebuffersEXT(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, dfb); glGenRenderbuffersEXT(dfbRenderBuffers); for (int i = 0; i < colorAttachments; ++i) { glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, dfbRenderBuffers.get(i)); if (i == 1) { // depth buffer glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB32F_ARB, renderWidth, renderHeight); } else { glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, renderWidth, renderHeight); } glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, dfbDrawBuffers.get(i), GL_RENDERBUFFER_EXT, dfbRenderBuffers.get(i)); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, dfbDrawBuffers.get(i), GL_TEXTURE_2D, dfbTextures.get(i), 0); } glDeleteRenderbuffersEXT(dfbDepthBuffer); dfbDepthBuffer = glGenRenderbuffersEXT(); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, dfbDepthBuffer); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, renderWidth, renderHeight); glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, dfbDepthBuffer); int status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { System.out.println("Failed creating framebuffer! (Status " + status + ")"); } }
public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers) { EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffers); }
public void free() { EXTFramebufferObject.glDeleteRenderbuffersEXT(this.id); }