0
$\begingroup$

I've found a site that provides an overview of the OpenGL pipeline:

Rendering pipeline overview

Now in the 3th phase (vertex processing) it says that after the transform feedback, there is the primitive clipping. If I am not mistaken, the primitive clipping must occur after that the vertices are multiplied by the projection matrix, otherwise it's impossible to determine if the primitives are inside or outside the view volume defined with glFrustum().

I know that in a typical GLSL shader you need to apply the modelview matrix to the vertices, so that you obtain a vertex in eye coordinates. So if I am not mistaken, at the end of the vertex shader you don't have vertices defined in clip coordinates yet. But this makes me think: where is the projection matrix applied? it seems like it's missing in this pipeline overview.

$\endgroup$
  • $\begingroup$ "otherwise it's impossible to determine if the primitives are inside or outside the view volume defined with glFrustum()" That page defines the core profile of OpenGL; glFrustum does not exist in modern OpenGL anymore. Projection is the responsibility of the writer of the shader, not of the rendering pipeline. $\endgroup$ – Nicol Bolas Apr 26 '18 at 16:34
2
$\begingroup$

I know that in a typical GLSL shader you need to apply the modelview matrix to the vertices, so that you obtain a vertex in eye coordinates.

This is not quite correct, you need to apply the modelviewprojection matrix and thus transform your vertices into Clip Space Coordinates. You can apply the ModelView Matrix in certain instances, e.g. if you want to calculate light in Eye Space. However, the gl_Position will then still not use the ModelView but the ModelViewProjection Matrix and your light/whatever- position will use the ModelView Matrix and be transferred to the fragment shader via the out variables.

For a more detailed discussion, you can look into the comments on this question, I had to be corrected about that myself (since not all literature is clear/correct about Normalized Device Space and Clip Space).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.