WIP: OpenGL: use a single framebuffer instead of 1 per texture #2959
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What issue is this addressing?
No associated issue yet, related to: #2930 and #2953
What type of issue is this addressing?
Refactorization
What this PR does | solves
This PR uses a single framebuffer instead of creating a new one for each isolated texture for OpenGL.
This is a necessary step in order to introduce MRT, since a single framebuffer should be bound (itself containing the multiple destinations textures) for the MRT draw call.
Since a framebuffer represents a logical object, that is a group of buffers in openGL, it is not necessary to mark it with a size or create one for each texture, so it also should ease the internal logic hopefully!
Notes:
DeleteFramebuffer
function has been removed as there shouldn't be any need to delete one, since we want to control them to be exactly 2Edit: It's actually more recommended to swap framebuffers, instead of changing its state every frame (its color attachments). Also, I realized manipulating attachments this way introduced some complexity, and MRT can be introduced without this by using a dedicated framebuffer.