Engine Rendering pipeline : Making shaders generic

后端 未结 4 2057
广开言路
广开言路 2021-01-23 19:57

I am trying to make a 2D game engine using OpenGL ES 2.0 (iOS for now). I\'ve written Application layer in Objective C and a separate self contained RendererGLES20 in C++. No GL

4条回答
  •  时光取名叫无心
    2021-01-23 20:23

    As datenwolf says, shaders are not supposed to be generic.

    That said, in theory, you can just swap out shaders code as you wish, as long as it uses all the same uniform, in and out parameters nothing will really be able to tell the difference. That said, this is probably not a good idea at all.

    If you want such flexibility, you probably want to look at introducing some sort intermediary scripting layer. Your engine can provide this scripting layer all the information you want it to, and the script layer can take care of working out what uniforms to set and what to set them to. It is not a trivial thing do, but then what you are trying to do is not exactly easy.

提交回复
热议问题