PDA

View Full Version : How to map 2 else textures on two sides of polygon?



yaro_dup1
09-14-2002, 02:58 AM
Hi,

1. How to map 2 else textures on two sides of polygon?

2. Can I map the polygon with texture and with normal color at the same time? I don't want to use texEnv

thanks in advance
glYaro

Bob
09-14-2002, 03:55 AM
#1 You can't apply different textures on different sides. However, you can emulate this in two passes.

First pass: Enable backface culling (glEnable(GL_CULL_FACE)), set cull face to back (glCullFace(GL_BACK)), and bind the texture you want to appear on the front face. Draw your object.
Second pass: Change cull face to front, and bind the texture you want to appear on the back face. Draw your object again.

You may have to change winding order of your vertices. If you have your vertices in clockwise order, call glFrontFace(GL_CW) before the first pass.

#2 That's like saying you want to drive a car, but you don't want to touch the steering wheel. It will work as long as the car is lined up fine on the road, and the road is only going stright forward. When the road turns, you're out.

glTexEnv is what you use to set up the texture combiners, so that they can combine different color sources. Not using them will work as long as the default combiner setup is what you're after. When you want something else, you're out.

You're in luck this time, cause the road you're driving on is only going stright forward. The default combiner setup is actually modulation between primary color and the texture. Just bind the texture, specify your color, and they will be modulated.