While solving a FBO leak in my code, I discovered a possible problem in the cleanup() method of the LWJGLTextureRenderer.
ORIGINAL
public void cleanup() {
if (!isSupported) {
return;
}
if (fboID > 0) {
IntBuffer id = BufferUtils.createIntBuffer(1);
id.put(fboID);
EXTFramebufferObject.glDeleteFramebuffersEXT(id);
}
}
Mmmh, the id.put(fboID) moves the buffer position forward, so the glDeleteFramebuffersEXT() will not get the right id as it does not rewind().
IT SHOULD IT BE LIKE THIS:
public void cleanup() {
if (!isSupported) {
return;
}
if (fboID > 0) {
IntBuffer id = BufferUtils.createIntBuffer(1);
id.put(0,fboID);
EXTFramebufferObject.glDeleteFramebuffersEXT(id);
}
}
Cheers!
Looks like that a similar problem is also present when deleting textures (GL11.glDeleteTextures()) in:
- LWJGLPbufferTextureRenderer.setupTexture()
- LWJGLTextureRenderer.setupTexture()
Mik of ClassX