c++ - What is the gl_NormalMatrix and gl_ModelViewMatrix in shaders? -


Many Google searches have made the impression that you represent these metrics, but I do not know.

I have knowledge of vectors and matrix and their operation.

I want to refer to the simplest shader code which I do not understand, putting normals and meridians in the eye space:

  // Vertex shader VC4 color changes; Curve 3n; VC3V is different; Zero main (zero) {v = vec3 (gl_ModelViewMatrix * gl_Vertex); N = normal (gl_NormalMatrix * gl_Normal); Color = gl_Color; Gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }   

My question:

(i) In the form of a top shider loop through each head, does gl_ModelViewMatrix change with every top loop? Or is gl_ModelViewMatrix stabilized in every vertical walk and can turn any head in the eye?

(ii) Similar to my first question, but what does gl_NormalMatrix contain information? Does it contain information on every general in the scene, and how can it change the normal of the current perimeter, which comes in place of eyes in the peak shidder? Or in the form of matrix changes, the top peak of each top comes in shad and how can it change the normal of the current perimeter, which comes in the place of eyes in the peak shader?

Both the specified matrix uniforms s are uniform values, they are Do not change between (as opposed to different variables, changes for each section, and attribute - for each header).

gl_ModelViewMatrix pre-defined uniform variable set GL_MODELVIEW from matrix ( glLoadIdentity , glTranslate, Affected by) glRotate , glScale or glLoadMatrix ).

gl_NormalMatrix is transfer (Inverted (Gl_ModelViewMatrix)) , which is the same matrix but with the reversal scale factors

Good description of this technique can be found

Please note that this pre-defined uniform is degraded in newer versions of OpenGL (and the Matrix manipulation function is also deprecated).

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -