I have this problem. I have a 3d scene and when I apply a texture to the floor the lighting gets darker. If I remove the texture the lights gets back to normal. I can’t understand why because even the menu characters that are not affected by light get darker. It’s weird because I only have this problem with some textures.
It seems like the darker the color of the texture is, the less light I have.
I tried to change glTexEnvf, I replaced GL_MODULATE and started to use GL_DECAL so the texture doesn’t get affected by lights. It worked, the texture has its original color, but everything else gets white with no shapes (like a 3d object with lighting off)
here’s my code
void LoadTexture(const char * bitmap_file)
{
glbmp_t bitmap;
if(!glbmp_LoadBitmap(bitmap_file, 0, &bitmap))
{
fprintf(stderr, "Error loading bitmap file: %s
", bitmap_file);
exit(1);
}
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texname);
glGenTextures(1, &texname);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bitmap.width, bitmap.height,
0, GL_RGB, GL_UNSIGNED_BYTE, bitmap.rgb_data);
glbmp_FreeBitmap(&bitmap);
}
and then I load the image that I want as texture. Maybe I have something missing or I have some code in the wrong place. Does anybody know how to solve this problem?