c++ - How to set orthographic near/far clipping planes to display all vertices -


i rendering scenes using glm::ortho projection. want rendering include every vertex draw without adding unnecessary depth (i.e. minimal depth buffer resolution impact).

i've seen this post similar question on perspective projections, looking both near , far clipping plane values in orthographic projection.

i can calculate z values of each vertex using viewmatrix transform vertices screen coordinates. in pseudo code:

float near; float far;  (each glm::vec4 vertex) {     glm::vec4 trans = viewmatrix * vertex;     // invert z-buffer     trans.z = -trans.z;     if (trans.z < near)         near = trans.z;     if (trans.z > far)         far = trans.z; } 

this way, near , far represent z-values of nearest , farthest vertices in screen coordinates, respectively.

but when use these values znear , zfar in glm::ortho matrix, of rendering still clipped. missing?


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -