tags:

views:

38

answers:

1

In openGL, I've got an object that I scale by -1 along an axis... this results in the object not rendering properly because all the front faces are now back faces. Short of disabling culling, how would I get this object to render right? Is there a way to do it without modifying the textured normal vertices that make up my model?

+6  A: 

You can simply switch the culling mode. You can use glCullFace(mode) to decide which triangles should be culled. Supplying a parameter of GL_BACK means that only front-facing polygons are rendered, while a parameter of GL_FRONT means that only backfacing polygons are rendered. So if your transformation means that the "backfacing" polygons are in fact frontfacing, calling glCullFace(GL_FRONT) should do the trick.

As an alternative you can also control which polygons are considered front/backfacing using glFrontFace(dir), with a parameter of GL_CW (clockwise) or GL_CCW (counterclockwise) (default is counterclockwise so if you set it to clocksie originaly backfacing polygons would be considered frontfacing).

Grizzly