lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
156 stars 24 forks source link

Use NPOT textures for large sprites #2

Closed lordmauve closed 4 years ago

lordmauve commented 5 years ago

Currently the packer will fail to pack any sprite larger than 512 pixels in either dimension.

Rather than make larger power-of-two textures to accomodate these, we should just return a single non-power-of-two texture.

These will need to be deallocated when no longer referenced.

lordmauve commented 5 years ago

Added in 8532f120cdd4b8c8d43e71904fcda6f613a88c4f.

Deallocation is not yet implemented. The ownership of these textures is with the Atlas so this can be managed with a WeakValueDictionary; this will ensure textures are shared as long as they are loaded.

Additionally VAOs need to be deallocated when they are empty for the texture to actually be freed.

lordmauve commented 4 years ago

Sprite arrays are now deleted but the texture regions for these are still cached by the atlas. Probably better to track the deallocation under #31.