PDA

View Full Version : Texture mapping to two sides of a polygon



tgorochowski
01-30-2004, 11:33 AM
I am currently creating a basic volume renderer by slicing through a vector space and creating a texture that corrisponds to a function at that location. This is all working well, however, when drawing the polgon and rendering the texture to it I find that the texture is visible on the front but not the back. I have tried creating forward and back facing one and mapping to both but this also does not seem to work.

Are there any simple ways to achieve this? (In a similar way to allowing both sides of a polygon to be visible)

Also, How does OpenGL determin the side of a polygon to render its contents?

Thanks in advance.

Tom

ZbuffeR
01-30-2004, 12:07 PM
To have double sided polygons :
glDisable(GL_CULL_FACE);

To control witch side is culled (not drawn) :
glCullFace(side); side can be GL_FRONT, GL_BACK(default), or GL_FRONT_AND_BACK

To control what is a "front" or "back" facing polygon :
glFrontFace(winding); winding can be GL_CW or GL_CCW

At first glance it may seem a lot redundant, and just using the normal would be enough, but as not all faces have normals, it is really needed.

[This message has been edited by ZbuffeR (edited 01-30-2004).]