1

Here is my code snippet how I rotate the model-view matrix:

mat4 modelViewMatrix;
vec3 eyePosition = vec3(0, 0, 6);
vec3 centerPosition = vec3(0, 0, 0);
vec3 upVector = vec3(0, 1, 0);
modelViewMatrix = glm::lookAt(eyePosition, centerPosition, upVector);

vec3 axis = vec3(0, 1, 0);
modelViewMatrix = glm::rotate(modelViewMatrix, rotation, axis);

As much as I know model-view matrix is the transformation matrix that is responsible for going from model coordinate from to eye/camera coordinate frame.

So if I have two uniforms such as:

vec4 lightPosition = vec4(15.0f, 0.0f, 0.0f, 1.0f);
vec3 lightIntensity = vec3(1.0f, 0.0f, 0.0f);

that I use to calculate ADS Phong shading using GLSL my model should rotate but the light should stay at the same position, right?

Sorry the code is not compile-able, but I am asking about general concept and hope this gives you enough info to be able to advice me. Thanks!

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Narek
  • 38,779
  • 79
  • 233
  • 389
  • 1
    That is completely up to you. If you want to define the light position in camera space, the lights will move together with the camera. You may also want to specify them in world space. – Nico Schertler Dec 18 '16 at 17:12

0 Answers0