Update Texture Alpha channel

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

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.

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.

But you can still use glColorMask as suggested.