On page 89 of David Wolff - OpenGL 4.0 Shading Language Cookbook book, it suggests a way to set up up a Phong shader in the fragment stage. It lists some different matrices to pass via uniform, and I suspect I might be passing slightly incorrect matrices, as my results are a bit off. This could be from somewhere else in the code of course, but I'd rather know for sure.
These are the matrices used that I'm curious about:
uniform mat4 ModelViewMatrix; uniform mat3 NormalMatrix; uniform mat4 MVP;
What exactly are these? At the moment I'm sending these matrices:
view*model //ModelViewMatrix; transpose(inverse(model))) //top 3x3 row of modelview projection*view*model //MVP;
The shader "works", but I can't get the lighting direction right.