Members - Reputation: 103
Posted 22 May 2012 - 07:23 AM
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)
if(!glbmp_LoadBitmap(bitmap_file, 0, &bitmap))
fprintf(stderr, "Error loading bitmap file: %s\n", bitmap_file);
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);
then I apply the texture to a quad and 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?
Members - Reputation: 2759
Posted 22 May 2012 - 07:53 AM
GL_MODULATE should be fine, I'm not sure why the textured object appears poorly lit. Maybe you should post a "before-after" image about the issue (no texturing vs texturing and GL_MODULATE)
Edited by szecs, 22 May 2012 - 07:59 AM.