View Full Version : OpenGL: dynamic depth sorting with BSP Tree

Eerie Code
08-14-2014, 09:54 AM

I have to create a draw() function that allows to print the contents of a BSP Tree applying the painter's algorithm, thus ensuring a correct view from any point of view. In the code that I've written, each node of the BSP tree contains the plane generated from the polygons that it contains, and during the execution of draw() the function should compare the point of view of the scene with the plane to determine the printing order. The use of a fixed point of view would lead to errors in the drawing after rotating the image, so I would need to recalculate the point of view each time. Is there a way to calculate the point of view of the scene at execution time?