PDA

View Full Version : Texture Problem



02-19-2005, 03:58 AM
Hi all!

I want my texture to look exactly like a bmp picture. Is this possible?

When I try to do this the texture get different colors than the BMP file. What is wrong?

I tried with both GL_MODULATE and GL_DECAL, but it does not work. What of these two enviroment options is correct to use in this case?

-NiCo-
02-19-2005, 04:30 AM
When using GL_MODULATE you need to set glColor4f(1.0,1.0,1.0,1.0)

Or just set it to GL_REPLACE:

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_REPLACE)

Nico

02-20-2005, 11:52 PM
Thanks for the quick replay.

I tried to use GL_REPLACE and it worked fine if I disabled GL_BLEND. The problem is that some parts of my texture is transparent. (Using alpa blending: 0 value=not visible, 255=visible). So when I turn of the blending the image is no longer transparent. And if I use blending the image have different colors than the original bmp file.

I want the image to look exactly like the bmp file with some pixels not visible. Is this possible in openGL?

Relic
02-21-2005, 01:17 AM
This can be done with glEnable(GL_ALPHA_TEST) instead of blending. Use glAlphaFunc to set the comparison function and reference alpha value.