How do multipass shaders work in OpenGL?

Posted by Boreal on Game Development See other posts from Game Development or by Boreal
Published on 2012-03-21T01:14:53Z Indexed on 2012/03/21 5:40 UTC
Read the original article Hit count: 613

Filed under:
|
|

In Direct3D, multipass shaders are simple to use because you can literally define passes within a program. In OpenGL, it seems a bit more complex because it is possible to give a shader program as many vertex, geometry, and fragment shaders as you want.

A popular example of a multipass shader is a toon shader. One pass does the actual cel-shading effect and the other creates the outline. If I have two vertex shaders, "cel.vert" and "outline.vert", and two fragment shaders, "cel.frag" and "outline.frag" (similar to the way you do it in HLSL), how can I combine them to create the full toon shader?

I don't want you saying that a geometry shader can be used for this because I just want to know the theory behind multipass GLSL shaders ;)

© Game Development or respective owner

Related posts about opengl

Related posts about shaders