Modifying texture's mask

Posts: 161
Joined: 2005.07
Post: #1
This is probably a general OpenGL question and not iPhone-specific, but...

How do I modify the pixel values for a texture's mask? I just need to be able to take a texture and mask that is already loaded and change some of the mask values from 0 to 1 or vice versa, of course with the results appearing on the screen immediately.

The only thing I can think of off the top of my head is keeping the pixel data around after I use it as a texture, then delete the old texture and assign the new data every time I make a change. There's probably a better way of doing things.
Quote this message in a reply
Posts: 1,234
Joined: 2002.10
Post: #2
Bind the texture to an FBO.
Set ColorMask to only affect the alpha channel.
Draw your new mask.
Unbind the FBO.
Use the texture.

That's the best way to do this, in general. Of course, you didn't specify what type of changes you want to make to the mask.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  procedural textures (modifying pixel data) using Texture2D class mrbgty 4 6,854 Mar 12, 2009 07:51 PM
Last Post: mrbgty