GLSL Problem: Multiple shaders in one program

前端 未结 4 737
醉话见心
醉话见心 2020-12-29 09:30

I must have misunderstood something with shaders:

I thought that as you can attach multiple shaders to one program, you\'d be able to simply attach more than one fra

4条回答
  •  星月不相逢
    2020-12-29 10:03

    You can have multiple programs in a shader, but not the other way around.

    To make multiple combinations, the easiest way is to store each major chunk as a fragment with a named entry point, then include them from another program or combine them at runtime into a single program, calling them in the order you need. That can get messy though, when handling input and outputs.

    You can use multiple passes, with different effects and programs in each pass. That has some additional overhead, but can be easier to set up.

提交回复
热议问题