excessive / DOMy

A DOM-like GUI framework for the *awesome* LÖVE framework
Other
32 stars 2 forks source link

Batching Elements #21

Closed karai17 closed 9 years ago

karai17 commented 9 years ago

So I have decided to use a SpriteBatch for each individual family tree. A family tree is defined as having a root element with no parent.

I will be using a Canvas as the texture for the batches (maybe a canvas for each batch, but I can probably get away with a single texture).

I will draw each object to the canvas on init, and use scissors to select objects to clear when a style needs to be changed (such as for animations, deletions, interactions, etc).

This method should allow me to render all objects to look exactly as expected while maintaining the efficiency of batching draw calls since every single object will not need to be updated every single frame.

adrix89 commented 9 years ago

Actually now that I remembered, Sprite-batch has support for IDs. So you can just update individual changes, but that might or might not be efficient to a constantly updating elements(animations), maybe with stream flag? I am not sure why you would use canvas. If it's just to collect all the graphics you can just make a new image and copy to the image data the graphics, no need for canvas so it would work on more toaster PCs. If you are using canvas for something else remember that if you draw over you might get transparency issues.

karai17 commented 9 years ago

I am using a canvas specifically so I can draw things to it and use transparency.

Also LOVE requires a minimum OpenGL version of 2.1, which supports canvas. I think it's safe to say that anyone running a LOVE game will have canvases, and if not, oh well.

karai17 commented 9 years ago

I no longer want to pursue this method.