sajis997

01-25-2015, 04:49 AM

Hello forum,

I came to know that we calculate the lighting in eye coordinates. In that case we have to transform the light position to the eye coordinates using the model-view matrix multiplication. The point of my confusion is that when do we have to do this multiplication.

When i send the light position from the application to the shader, we do it as follows:

glm::vec4 lightPosition = glm::vec4(....);

glUniformMatrix4fv((*shader)("lightPosition"),1,glm::value_ptr(model-view * lightPositon));

But i also came across some code snippet(OpenGL Superbible recent edition), where the light position is defined inside the shader and the light position did not go through the model-view transformation.

I am puzzled here. What is that I am missing conceptually ?

Thanks

I came to know that we calculate the lighting in eye coordinates. In that case we have to transform the light position to the eye coordinates using the model-view matrix multiplication. The point of my confusion is that when do we have to do this multiplication.

When i send the light position from the application to the shader, we do it as follows:

glm::vec4 lightPosition = glm::vec4(....);

glUniformMatrix4fv((*shader)("lightPosition"),1,glm::value_ptr(model-view * lightPositon));

But i also came across some code snippet(OpenGL Superbible recent edition), where the light position is defined inside the shader and the light position did not go through the model-view transformation.

I am puzzled here. What is that I am missing conceptually ?

Thanks