Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In a newly created OpenGL context all matrices are identity, i.e. vectors go through untransformed. In fixed function OpenGL vertex transformation skips the "world" step, collapsing object→world and world→eye into a single transformation. This is no big deal however. Lighting calculations are easiest in eye space anyway. And since fixed function OpenGL doesn't know shaders (except as extension), there's no need to do things in world space.</p> <p><em>glTranslate, glRotate, glScale</em> don't transform objects. They manipulate the matrix on top of the stack active for manipulation. So ultimately they contribute to the transformation, but not on the object, but the vertex (position) level.</p> <blockquote> <p>it would move the cube from center of the eye space according to the translation?</p> </blockquote> <p>Indeed, but what's "moved" (actually transformed) are the cube's vertices; and it may be not just a translation.</p> <p><strong>EDIT due to comment</strong></p> <p>The key thing to understand is transformation composition. First and foremost a transformation is a mapping</p> <pre><code>T: R^4 -&gt; R^4, v' = v |-&gt; T(v) </code></pre> <p>There's a subset of transformation, namely the linear transformations which can be represented by matrix multiplication:</p> <pre><code>v' = T * v </code></pre> <p>one can concatenate transformations, i.e. <code>v = v |-&gt; T'○T (v)</code> again for the subset of linear transformations, written in matrix form you can expand this to</p> <pre><code>v' = T * v v'' = T' * v' =&gt; v'' = T' * T * v </code></pre> <p>Now let <code>V</code> denote the viewing transform and <code>W</code> the world transform. So the total transform is</p> <pre><code>M = V * W </code></pre> <p>The order of matrix multiplication matters (i.e. matrix multiplication is not commutative):</p> <pre><code>∃ M, N ∊ {Matrices}: M * N ≠ N * M </code></pre> <p>The view transform <code>V</code> is the transform of the whole world so that it is moved in a way, that the camera in the world ends up being at the origin, viewing down the negative Z axis. So let <code>V'</code> be the transform that moves "the camera" from the origin at it's place in the world, the inverse of that movement moves the world in a way that the camera comes to rest at the origin. So </p> <pre><code>V = inv(V') </code></pre> <p>Last but not least given some matrices A, B, C for which holds</p> <pre><code>A = B * C </code></pre> <p>then</p> <pre><code>inv(A) = inv(C) * inv(B) </code></pre> <p>i.e. the order of operations reversed. So if you "position" your "camera" using inverse OpenGL matrix operations, the order of the operations must be reversed. And since the overall order of operation matters the viewing transformations must happen before the model transformations.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload