I'm having some problems with my Frustum Culling and I want to debug it, so I'm trying to render it's planes, to see exatly the Frustum. But I'm using the Clip Coordinates to do the culling (like OpenGL pipeline do), but I dont know how to render a frustum, in another words, I dont know how to convert a frustum in Clip Coordinates to a "Frustum Mesh".
Actually to calculate the frustum I use this function:
glm::vec3 point = MVP * glm::vec4(-radius, -radius, -radius, 1.0f)) //leftTopPoint return (point.x > -point.w) && //Inside left clipping pane (point.x < point.w) && //Inside right clipping pane (point.y > -point.w) && //Inside bottom clipping pane (point.y < point.w) && //Inside top clipping pane (point.z > -point.w) && //Inside near clipping pane (point.z < point.w); //Inside far clipping pane
Where MVP is a glm::mat4 of Projection * View * Model matrices.
This function is activated only when I press the left click of mouse, so I want to render the Frustum and see how it is.
Also I dont use a "
lookAt" function to rotate the camera, I'm using
Quaternions (dont know if that matters).
Sorry if it is a bit confusing, it's hard to explain. So I just need a tip or a orientation/example of how achive this.
Thanks for your attention.