Issue Understanding Lighting in OpenGL

后端 未结 1 1454
臣服心动
臣服心动 2020-12-12 05:52

I am having some problems understanding how lighting works in OpenGL (especially understanding the pre-defined variables. is there a list of them somewhere?). I have been me

相关标签:
1条回答
  • 2020-12-12 06:33
    ambient = ambient * in_Position ; // HERE IS WHAT I DONT GET!
    

    That makes two of us. I have no idea what it is that you intend to accomplish with this. That will certainly produce a color. But it won't be meaningful in any real way. It certainly doesn't qualify as "lighting".

    What does "precision highp float;" does?

    Nothing. Not in desktop OpenGL. I really have no idea why someone put that there; the precision highp stuff is for GL ES compatibility, but version 3.30 shaders are fundamentally incompatible with GL ES 2.0, since ES 2.0 doesn't use in/out qualifiers and desktop GLSL 3.30 does.

    Ok how does interpolation works?

    Way too broad to answer here. This is better answered here, which is part of my much larger tutorial series.

    How does Opengl know where to stop the interpolation ?

    The edge of your triangle.

    0 讨论(0)
提交回复
热议问题