openGL shaders - use 2 shaders on top of each other

Is there a way to put 2 shaders
for example I want to do one frag shader that draws circle and in a different frag shader draw the border of the circle (as 2 separated layers ).
Thanks in advance :slight_smile:

I’m not sure if this is the juce way, or even the normal way, but I have done this in the past by simply repeating the process for each shader. Load shader, buffer data, draw, load shader, draw.

thanks for your answer will try that!
I don’t know if this is the right way either but I want to compute 2 different layers of graphics with shader and that seems the only option

If you’re doing this in a single OpenGL renderer callback:

  • Enable blending with glEnable(GL_BLEND).
  • Set the appropriate blending mode flags which can be found here.
  • Bind each shader/buffer pair sequentially and draw, not clearing the framebuffer in between draw calls.
4 Likes