New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FrameBuffer may not always dispose texture #3324
Comments
Thanks! Should be fixed now, you can now override the It would be possible to accept a Texture in the constructor and thus move ownership completely out of the FrameBuffer. But that would get messy when the texture isn't managed (currently the texture is recreated on context loss). |
Thanks for the very quick commit (less than 1 hour :-)) That's solve the first use case which is probably the most important. For the others use cases, I understand your point, maybe frame buffer have to be implemented specifically for those. |
I think a class YieldingFrameBuffer extends FrameBuffer{// if you call disposeAndTakeColorTexture, colorBuffer is prevented from being disposed and given to you
private boolean yielding = false;
public YieldingFrameBuffer(Pixmap.Format format, int width, int height, boolean hasDepth){
super(format, width, height, hasDepth);
}
@Override protected void disposeColorTexture(Texture t){
if(!yielding) t.dispose();
}
public Texture disposeAndTakeColorTexture(){
Texture r = getColorBufferTexture();
yielding = true;
dispose();
return r;
}
} |
Hi,
Has discussed here, it is not possible to dispose framebuffer and use the texture later since dispose method dispose the texture as well.
It's not possible to change the colorTexture neither which is a big limitation for some use-cases :
FBO and texture attached to it may not have the same lifecycle.
For now my "ugly" workaround is to extends FrameBuffer in that way :
But it's not a perfect solution for many reasons :
I could make a pull request with modifications on GLFrameBuffer class but i want to discuss about the solution before.
IMO, the color buffer may have to be controlled by user code.
The idea would be :
What do you think ?
The text was updated successfully, but these errors were encountered: