Opengl Mirror Hole

In openGL, I have an object that I scale by -1 along the axis ... this causes the object to not display properly, because all the front edges are now facing. Failed to turn off culling, how do I get this object for rendering? Is there a way to do this without changing the textured normal vertices that make up my model?

+3
source share
1 answer

You can simply switch the reject mode. You can use glCullFace(mode)to decide which triangles should be rejected. The supply of the parameter GL_BACKmeans that only the front polygons are displayed, and the GL_FRONT parameter means that only the reverse polygons are displayed. Therefore, if your transformation means that the "backfacing" polygons are actually in the foreground, the challenge glCullFace(GL_FRONT)should do the trick.

Alternatively, you can also control which polygons are considered forward / reverse using glFrontFace(dir), with the option GL_CW(clockwise) or GL_CCW(counterclockwise) (default is counterclockwise, so if you set it to clocksie the original reverse polygons will be considered interface).

+7
source

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


All Articles