I’ve written a test program using OpenGL on OS X that loads a PNG, compresses it in memory to DXT5 using libsquish (http://code.google.com/p/libsquish/), and textures a plane.
When I upload an image that contains an alpha channel, but no pixels have alpha values other than fully opaque, it displays correctly: https://i.stack.imgur.com/WlRcD.png
Given the same image but the black part is replaced with transparency, this is the output I get: https://i.stack.imgur.com/wOPqA.png
The code is not pretty, it is a thrown together proof of concept:
- The C++ source: http://pastebin.com/m0RqpgUS
- The vertex shader: http://pastebin.com/QyaWCaTk
- The fragment shader: http://pastebin.com/KEuFJ83C
- The test images: http://dl.dropbox.com/u/4597377/images.zip
Any thoughts?
Turns out I forgot this: