Skip to main content
Typos
Source Link
DMGregory
  • 141k
  • 23
  • 258
  • 401

Multiple Shaders With Sprite BathcingBatching

I have coded a game onin OpenGL and for rendering I used a Sprite BathingBatching 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 BathingBatching, or is there a way to use several shaders at once?

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?

Multiple Shaders With Sprite Batching

I have coded a game in OpenGL and for rendering I used a Sprite Batching 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 Batching, or is there a way to use several shaders at once?

Source Link

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?