Im using glTexImage2D to create a texture. Where im having a problem is that my clear color is green and the texture keeps that color for the background in the created image. I was wondering if theres any way to make the background color transparent so that the only thing that shows is the black and blue lines that I want to show?
OpenGL glTexImage2D and Transparency
Started by jedij, Jan 30 2008 02:51 PM
3 replies to this topic
#1
Posted 30 January 2008 - 02:51 PM
#3
Posted 30 January 2008 - 03:31 PM
monjardin said:
Loop through all of the pixels and set the alpha value for the green ones.
can you give me an example of how to do this?
#4
Posted 30 January 2008 - 04:38 PM
Do you understand how texture images are laid out in memory? Assuming you're using GL_RGBA format, each pixel is just four bytes, one each for red, green, blue, and alpha. You just need to get a pointer to the image data and make a loop that goes through each pixel, examines the color components and determines if it's green, and if so sets the alpha of that pixel to zero (the alpha of the opaque pixels should be 255).
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











