I plan to make objects slowly vanish when distancing from the camera. Theoretically I should use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), but it’s not working in my context, so I should be missing something.
I’m working with textured objects, GL_MODULATE, and lights enabled.
The code follows:
glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4F(1,1,1,alfa); glEnable(GL_CULL_FACE); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, FSkinID); //starts drawing with gl_begin(GL_TRIANGLE_FAN)
The alfa values range from 0 to 1 according with camera distance.
This code results in a normal drawing with no blending.