OpenGL: Alpha-fading a 32-bit texture

BlitzMax Forums/OpenGL Module/OpenGL: Alpha-fading a 32-bit texture

JoshK(Posted 2005) [#1]
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?


Oddball(Posted 2005) [#2]
works fine here with all blend modes.
Have you enabled GL_BLEND?
glEnable GL_BLEND



JoshK(Posted 2005) [#3]
Yes.

It works fine with 24-bit textures, but not 32.


JoshK(Posted 2005) [#4]
Nevermind, it works now


VP(Posted 2005) [#5]
Care to share the solution?


JoshK(Posted 2005) [#6]
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.