views:

1192

answers:

1

This is a rather old problem I've had with an OpenGL application.

I have a rather complex model, some polygons in it are untextured and colored using a plain color with glColor() and others are textured. Some of the texture is the same color as the untextured polygons and there should be no visible seam between the two.

The problem is that when I turn up the ambient component of the light source, a seam between the two kinds of polygons emerge.

see this image: http://www.shiny.co.il/shooshx/colorBug2.png

The left image is without any ambient light and the right image is with ambient light of (0.2,0.2,0.2).

the RGB value of the color on the texture is identical to the RGB value of the colored faces. The textures alpha is set to 1.0 everywhere.

To shade the texture I use GL_MODULATE.

Can anyone think of a reason why that would happen and of a possible solution?

+2  A: 

You mention that you set the color with glColor(), so I assume that GL_COLOR_MATERIAL is on? What setting do you use for glColorMaterial()? In this case it should be GL_AMBIENT_AND_DIFFUSE, so that the glColor() call affects the ambient color as well as the diffuse color. (This is the default.)

You could also try to set all material colours to white (with glMaterial()) before rendering the texture mapped faces. With some settings (don't remember which), the texture itself gets modulated by the current color.

Hope this helps or at least points you into a useful direction.

Thomas