Efficient tex coord update with constant texture

Hello, I’m still pretty new to OpenFL and am trying to efficiently render different parts of a BitmapData for thousands of items on each item, i.e. the bitmapData stays constant, but the texture coordinates change on each frame.

Currently I’m using a Sprite and then draw using something like this:

graphics.clear();
graphics.beginBitmapFill(myBitmapData, null, true, false);
graphics.drawTriangles(myVertices, myIndices, myUVs);

This works fine, but I wonder if it is efficient, since I imagine, the quad vertex data will be uploaded on each frame.

I saw that you can cut out data from a BitmapData by using a Bitmap and its scrollRect, but this seems to be limited to pixel boundaries in the BitmapData and it does not allow for repeating textures.

Are there any options I’m missing?

On a tangent: are there other Haxe frameworks similar to OpenFL that are geared towards 2D rendering that might enable this?

You can use Tilemap for squared Sprites. You can use different atlas formats. I have a simple importer for 2 formats.

For deformed meshes, you have only drawTriangles or you can directly make opengl calls.

2 Likes

Thank you for the answer. It’s good to know that I didn’t miss anything fundamental.