I’ve got a texture in which I want to set the alpha for a single color (e.g. (255,255,255)) to 0.
I use this calls at the moment (self.texture is a CCTexture2D from cocos2d)
glBindTexture(GL_TEXTURE_2D, self.texture.name);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, baseAddress);
The texture displays perfectly. I hope you can help me.
There’s no way to do this with OpenGL commands. You’ll have to either use a shader to filter for pixels of a certain color, or modify the pixel data at
baseAddressin a pixel-by-pixel loop before uploading it to glTexImage2D.