I'm pretty much a newbie with opengl. I imagine glReadPixels is horrible so whats the best way to do this? I was thinking of having a function that locks a texture rect, do something like glTexSubImage2D to copy the pixels to RAM, modify it, then use glTexSubImage2D to copy the ram back into the texture. Is this a good way? I can think of optimizations like a flag saying not to copy the texture since you'll be overwriting it all and caching.
What other methods can I use? Can any of you tell me the names of the gl functions I may want (so I can read the manual) or point me to a tutorial? I tried googling but most of the results look like it was not doing what I had in mind.