OpenGL: Alpha-fading a 32-bit texture
BlitzMax Forums/OpenGL Module/OpenGL: Alpha-fading a 32-bit texture
| ||
glColor4f does not appear to have any effect on the alpha-fading of an object textured with a 32-bit texture. The texture already has an alpha channel, and OpenGL seems to just use that, instead of combining it with the material color alpha. I am using glBlendFunc GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA. I also tried creating a temporary color array with the desired alpha value, but this had no effect. I am trying to get my grass to fade with distance. How can I alpha-fade an object that is already textured with a 32-bit texture? |
| ||
works fine here with all blend modes. Have you enabled GL_BLEND? glEnable GL_BLEND |
| ||
Yes. It works fine with 24-bit textures, but not 32. |
| ||
Nevermind, it works now |
| ||
Care to share the solution? |
| ||
My 32-bit textured objects were being added to a zsort stack, which gets sorted and rendered after all solid objects. The post-zsort render was not passing the distance fade value to my RenderSurface() routine. BTW, I really recommend using a universal RenderSurface() function for all surfaces. This is called after the matrix is set up, and just draws the vertex arrays. |