PDA

View Full Version : glCopyTexImage2D()...from one pixel format to another



halo
10-20-2006, 03:06 PM
To render projected shadows, my engine draws a black background, then draws the model in pure white. I was previously using glReadPixels() followed by GLTexImage2D(), to turn the rendered image into a texture.

I switched to using glCopyTexImage2D(), which works flawlessly. However, I previously was reading the backbuffer pixels as GL_LUMINANCE, and then converting that to GL_ALPHA. Since glCopyTexImage2D() has only a single format parameter, I don't know how to convert the black and white image into an alpha texture.

Here is a shot using the black-and-white textures that I want to convert to alpha textures:
http://www.leadwerks.com/post/shaddies.jpg

ZbuffeR
10-21-2006, 04:58 AM
And what about using a luminance texture, with different blend mode ie. like GL_SRC_COLOR ?