Merging a texture on top of another

Hi,

Is it possible to place a texture on the top another without using two layers? I want to put a torch graphic over a tile graphic, would I need to use a pixmap or something and
what is a good way to animate the torch texture - particle maybe? Problem is the torch gfx would be part of the tile map.

Thanks

Just render the torch after you render the tile.

For animations, you would typically have a set of frames on a single texture and you’d just loop through the textures as time passes. If you’re talking about how the torch should emit smoke or something, that’s better suited for particles.

Thinking of levels, the last thing rendered will always be on top. It depends on how the pixels are handled. If they are just drawn naturally, and not with any special form, the pixel will color it entirely to the top-most rendered. However, if you use DST blend technique, then it will apply the color it it rather than dominate.

I think you want to use DST for the smoke and maybe particles, but you can use SRC_ALPHA. That is… if you are using OpenGL.

Same rules apply for the render methods though in a lot of other rendering distributions.

Rendering on top of tile as a sprite would work, but then need to keep track of where the torch is, atm I just put it inside the world map array as a LightEntity.
It would be simple to store the lights inside a List collection and check in here where the lights are, but feel this would be slow compared to just placing
directly into the world map array. If I was to put the lights inside a list I would use something like a quad tree for it as there could be thousands of lights and I don’t
want to be checking all them to see if they are in camera view or not - something like chunking would also work, check if chunk if view, if so, check if any light sprites
in the chunk, if so, do the lighting :slight_smile: