glTexImage2D - single channel blitting

Started by
2 comments, last by Genjix 17 years, 1 month ago
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.
Advertisement
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.
Author Freeworld3Dhttp://www.freeworld3d.org
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]
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]

This topic is closed to new replies.

Advertisement