How to check if an object lies outside the clipping volume in OpenGL?

前端 未结 3 1564
太阳男子
太阳男子 2020-12-14 13:16

I\'m really confused about OpenGL\'s modelview transformation. I understand all the transformation processes, but when it comes to projection matrix, I\'m lost :(

If

3条回答
  •  天涯浪人
    2020-12-14 13:38

    For anyone relying on the accepted answer, it is incorrect (at least in current implementations). OpenGL clips in the z plane the same as the x and y as -w < z < w (https://www.khronos.org/opengl/wiki/Vertex_Post-Processing).

    The two tests for z should then be: std::abs(Pclip.z) < Pclip.w

    Checking for zero will exclude all the drawn points that are closer to the near field clip plane than the far field clip plane.

提交回复
热议问题