Skip to main content
1 of 2

Multiple Shaders With Sprite Bathcing

I have coded a game on OpenGL and for rendering I used Sprite Bathing technique to draw many sprites in a single call to glDrawElements(). But as soon as I wanted to use a different shader for a different state of the character, I noticed that I couldn't do it.

As I understood all the necessary data is entered into the shader at the moment of renderer initialization and when I call Flush function, the renderer doesn't care which shader I use for drawing, all the data is already entered into the main one.

Will I have to give up with Sprite Bathing or is there a way to use several shaders at once?