2D. Rendering to a Masked Texture
This is more for a cool feature rather than a gameplay critical effect, but I was wondering if there's a fast way in basic OpenGL to draw to a texture but keep that texture's original alpha channel (I'm using 32 bit RGBA textures). I can see ways of doing it off-card by doing the effect with the CPU (ie re-copying the alpha bytes over the result), but I was wondering if OpenGL has any built in methods.
Preferably, any effect would have to be 'clear' OpenGL rather than via the extensions, as I've found that otherwise cool extensions (like the multipass textures) only work on NVidia cards (it passes if it works on my iBook 500
)
Preferably, any effect would have to be 'clear' OpenGL rather than via the extensions, as I've found that otherwise cool extensions (like the multipass textures) only work on NVidia cards (it passes if it works on my iBook 500

Um, I've never done render-to-texture, but would glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE) work?
"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat
Bring Alistair Cooke's America to DVD!
So, get a context with 8-bit destination alpha, render your texture to it, ColorMask like inio says, render the color channels, ColorMask back to normal, then CopyTexSubImage2D. Seems like it should work 
AFAICT, ColorMask doesn't affect the behavior of CopyTexSubImage2D, so just ColorMasking before you do that probably won't work.

AFAICT, ColorMask doesn't affect the behavior of CopyTexSubImage2D, so just ColorMasking before you do that probably won't work.
neat, that sounds like a good solution (was playing about with CopyTexSubImage2D, but hadn't spotted the glColorMask). I'll give it a try.
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Rendering Heightmap using texture data | ardowz | 4 | 6,027 |
Nov 17, 2015 03:32 AM Last Post: mark89 |
|
FBO rendering to GL_ALPHA texture | Fenris | 11 | 10,354 |
Jun 4, 2009 03:18 PM Last Post: Fenris |
|
glOrtho setup for rendering "impostors" into a texture. | TomorrowPlusX | 22 | 17,048 |
May 22, 2006 07:21 AM Last Post: TomorrowPlusX |
|
Masked Textures | Dan Potter | 1 | 3,205 |
Feb 26, 2005 10:07 AM Last Post: Dan Potter |
|
Halo around masked sprites | Bachus | 3 | 5,971 |
Feb 4, 2003 06:26 PM Last Post: NYGhost |