GLSL fixed function fragment program replacement

后端 未结 3 544
独厮守ぢ
独厮守ぢ 2020-11-27 23:16

When using the OpenGL fixed function pipeline for vertex setup, how a fragment program looks like that is compatible to the fixed function vertex setup? I guess that usually

3条回答
  •  情深已故
    2020-11-27 23:47

    Well, in the normal GL fixed function pipeline, lighting and goraud shading are done entirely in the vertex stage of the pipeline (with a little bit of help from the rasterizer), so if you have no texturing, the fragment shader becomes a simple pass-through (gl_FragColor = gl_Color;) and doesn't actually do anything.

    Now you CAN do per-fragment lighting, by writing your own fragment shader that does it, and it may even make sense to do that if you want directional spotlights or some such, but that has nothing to do with the fixed function pipeline.

提交回复
热议问题