Cewein / nerv_pathtracer

a pathtracer with physically based rendering in mind
MIT License
27 stars 1 forks source link

Camera shader info #5

Closed Cewein closed 5 years ago

Cewein commented 5 years ago

To fix the problem with the camera sending the info to the shader we must use layout and not uniform with names .

In our case uniform with names need program linkage before sending the info to the shader program, thus using layout solve the problem because if we say :

in GLSL

layout (location = 10) uniform float pi

in C/C++

glUniform1f(10, 3.14f)

at the adress 10 it will always be the variable for pi and no linkage need!