Sign in to follow this  
Genjix

glTexImage2D - single channel blitting

Recommended Posts

Genjix    100
Hi, I see the formats GL_RGBA and such, but is there a fast way of doing single channel blitting to a texture rather than storing, and updating a character array which I then have to blit? Thanks.

Share this post


Link to post
Share on other sites
soconne    105
As long as the channel's data is all contiguous, just use GL_ALPHA for the format. This is assuming your texture data is in GL_ALPHA format. If not, then there is not a way to only update a single channel since the data is not stored contiguously.

Share this post


Link to post
Share on other sites
Genjix    100
Thanks so much, that's a great help!


// to update only R channel from a continuous block of red pixel data
glTexImage2D (textarget, 0, GL_RGBA8, actual_width,
actual_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, red_pixels-3);




[Edited by - Genjix on March 17, 2007 4:50:22 AM]

Share this post


Link to post
Share on other sites
Genjix    100
spoke too soon... this doesn't seem to work (see a black texture) whereas normal GL_RGBA is working there fine. Any ideas why?

[Edited by - Genjix on March 17, 2007 4:17:05 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this