PDA

View Full Version : Cannot force a color with glPixelTransfer?



Nocturnal
03-10-2001, 08:09 AM
I am trying to load a texture that has only one channel, alpha, into a multi-channel Luminance-Alpha or RGBA texture. I am using glTexImage2D with internal format of 2 or 4, and format GL_ALPHA, type GL_UNSIGNED_BYTE.

Prior to loading the texture, I call glPixelTransfer(GL_*_BIAS, 1) for each color (R,G,B). The description of glTexImage2D leads me to believe that what should happen is that each texel should be built as RGBA = 0, 0, 0, {alpha data}, then the pixel transfer bias should take hold producing a texel of 1, 1, 1, {alpha data}.

I do not see this occurring. I render the texture with GL_MODULATE texture mode and glColor3f(1, 1, 1) and I only get black? The texture is definitely in use due to the fact that the alpha test works fine (i.e. the texture pattern shows up on a non-black background).

Background:
I am doing this to draw text with a texture. The plan is to use the texture to determine which pixels to draw and to color the pixels with either the texture environment color or the color from glColor*.

RandyU
03-10-2001, 07:49 PM
glPixelTransferf? pixeltransferi needs 255 instead of 1
I found these commands may not work properly sometimes. Try calling it at startup.