simon-bourque / OpenGameFramework

OpenGL Game Engine
MIT License
5 stars 0 forks source link

Create FramebufferCache #17

Open Gabbell opened 6 years ago

Gabbell commented 6 years ago

TASK

Description:

We need a FramebufferCache inspired from the other caches already made (look at TextureCache). One major difference is that framebuffers are not loaded from a file. Instead, they are generated during runtime. The cache should store and manage framebuffers. Similar to TextureCache, the GLuint representing the Framebuffer ID will be hashed and store in an unordered_map. One feature is that it should react if the window size is changed because all framebuffers will need to be regenerated based on the new window size.

Motivation:

Some CG features (like shadow mapping) require storage and manipulation of framebuffers. Having easy and clear access to them would be an asset.

Completion Criteria:

Gabbell commented 6 years ago

Will have to figure out how to regenerate framebuffers based on window resize. It's awkward because the only way to "resize" a framebuffer is to attach a new resized texture. It is unclear as of right now where that new texture would come from and how we would pass them down to every framebuffer in the cache to update.

simon-bourque commented 6 years ago

You should just be able to call glTexImage2D again to resize it, no need to create a new one. But as for the window resizing I think will need to implement a system to manage the resolution of the game, I don't think we should allow the user to resize the window to any size anymore

simon-bourque commented 6 years ago

Its possible to enumerate through every resolution available for all the screens connected, I think there is some commented code in the Win32Window.cpp file that does that