Hi
This is just to let some people know, maybe for AMD to look into this:
glGenerateMipmap on AMD cards acts kinda weird. First of all, you definitely MUST have the filtering mode set to something to use mipmaps (min filter = GL_XYZ_MIPMAP_ABC ...). Otherwise glGenerateMipmap seems to ignore that request entirely.
This is annoying, as one might use glGenerateMipmap just to setup everything for mipmapping and the filtering mode gets set "sometime later". The driver should not ignore this only because the filtering mode is not yet decided (one wouldn't call it, if one didn't intend to use mipmaps).
Some other thread also mentioned that additionally glEnable(GL_TEXTURE_XY) has to be enabled for the same reason. This would be even more stupid, as this state doesn't really have any use today anymore, but as far as I can tell, it isn't needed atm.
Apart from that, glGenerateMipmap seems to clear the alpha-channel of the texture to 1 the first or second time it is called on a texture. This is quite an irritating behavior.
Basically I cleared my texture to green, with alpha set to 0. Then I rendered to it, setting alpha to 1 where pixels were drawn. Afterwards I called glGenerateMipmap and got a texture where RGB was correct but alpha was set to all 1. The next time I repeated this action, alpha was correct everywhere.
The interesting thing here is, that alpha was correct for all texels that were somehow touched by the rasterizer. I am rendering a tree mesh and all around the branches 4x4 pixel blocks where correct (meaning the actually rendering pixels had alpha = 1 and the masked out pixels had alpha = 0). However everything that the rasterizer did not touch (where there were no polygons at all) had alpha = 1.
So I added one additional glGenerateMipmap call after the texture creation (the first glGenerateMipmap call actually CREATED the mipmap chain, the second now should fix ATI's strange behavior). That did the trick. Now every rendering to the texture creates correct results.
Took me several hours to find and fix this. Hopefully my description will help others in the future to figure out similar problems faster.
Bye,
Jan.



