Hello, I’m trying to draw some water in modern OpenGL (greather than 3.x).
I’ve got model matrix, view matrix and projection matrix uniforms and my positions’ attribute. The problem is: how can I get the eye direction vector?
Thanks in advance.
The eye position is 0,0,0 in eye space, which is what the model-view matrix transforms to. So after you’ve transformed the vertex position by the model-view matrix, the eye direction is simply the negation of the transformed vertex position (ignoring the w coordinate, which should be 1; the model-view matrix shouldn’t contain any projective transformations).
Thanks. The error was that I’ve negated the entire output vertex including w coord.