Recommended Posts

Trying to draw a texture so that part of the texture is transparent.
Got it to work with a mask, but not keen on storing both a mask texture and the image texture. Can I use a single texture with an alpha channel for the same purpose instead?
I can build textures using image data with an alpha channel:

Setting the internalformat parameter to 3 corresponds to GL_RGB, so it will not create a texture with an alpha channel. You should use 4 or GL_RGBA*.

* It's actually "safer" to set the internal format so that it specifies the bit depth of the texture you want as well, because on some drivers it may see GL_RGBA and choose a 16-bit rgba format because all you're requesting is 4 color channels. So, for example, if you want 32-bit rgba you should specify it with GL_RGBA8.