PDA

View Full Version : Update Texture Alpha channel



clint3112
07-12-2011, 03:09 AM
Hi there,

does anyone know a way to update the Alpha Channel of a Texture thats already on the GPU. glTexSubImage2D will update a region in a Texture but you have to upload all color channels.

Thanks in advance,
clint3112

V-man
07-12-2011, 08:38 AM
I would attach the texture to a FBO. Bind the FBO (glBindFrameBuffer) and then glColorMask(FALSE, FALSE, FALSE, TRUE) and render on your texture. Only alpha will get updated.

Don't forget to call glColorMask again with TRUE.

clint3112
07-13-2011, 12:57 AM
Sound good but I can't use that because my Texture is generated from the Vertices of my Model and can not be generated by RtT. To get less textures I added a boolean for the Light-Vertex visibility to the alpha channel, which will change every time i move the Light source. But Vertices and normals wont change. So it would be nice to just update the alpha.

BionicBytes
07-13-2011, 06:50 AM
But you can still use glColorMask as suggested.