How to draw several sprites one by one (successive) per frame

I want to draw one sprite, change some GL states, draw another sprite, change some GL states, etc…
Is this possible in Defold?

It sounds possible but it’s not perfectly clear to me what you want to do.

You can selectively draw different render predicates in your render script.

You can set materials dynamically onto sprites in any script. Materials can have different render predicate tags assigned to them.

You can change the properties of a material assigned to a sprite in any script.

Well, If your have a mac, look at this project (render script). I want generalize this hard coded implementation, but no avail.

Edit: Perhaps I found a solution, we’ll see.
shadow_casters.zip (132.6 KB)