Using fog with glOrtho

I use glOrtho to draw the orthogonal projection of three-dimensional geometric objects. My program allows users to select the edges or faces of a geometric object. When two objects appear on top of each other, the user can select the background object with the right button, and the foreground object with the left mouse button. The selected object is colored.

The problem is that the user cannot distinguish between the choice of foreground or background. I tried to use fog so that the color on the back looked different than the one on the front, but this does not work. I guess this is because the z of the front and back are almost the same ...? Is there still a way I could achieve this with a foggy function?

PS: I do not want to determine the position of the object (in front of the background) only when the user clicks, because the object can be rotated, and this information is no longer suitable.

+3
source share
1 answer

Could you write a simple shader that takes into account the z-depth and colors the grid using this value? For example, using a ramp of one color for "foreground" objects for another for "background" objects?

+1
source

Source: https://habr.com/ru/post/1780679/


All Articles