Advertisement

Alpha Testing

Started by December 29, 2003 07:43 AM
3 comments, last by cippyboy 21 years, 2 months ago
I`m using Alpha Testing for something like fencing but it doesn`t really matter. Here`s 2 pictures->with Alpha testing and without-> http://www.geocities.com/cippyboy_7/alphatest0.jpg http://www.geocities.com/cippyboy_7/alphatest1.jpg My problem would be-> Why does the Alpha Test Mess up the texture filtering ? It seems very unfiltered when Alpha Testing is used and in both cases I use

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
//and

gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGB, pImageData->sizeX, pImageData->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pImageData->data);
//for the first pic and

//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,pImageData->sizeX, pImageData->sizeY, GL_RGBA, GL_UNSIGNED_BYTE, data);

//for the second one

//and the alpha test enabled and set to

glAlphaFunc(GL_GREATER,0.1f);
Note that I have the original pixel data in ''pImageData->data'' and in ''data'' the pixels in RGBA format and even if I remove the Alpha Test, the texture is still... not rendered as the original RGB texture. Thanks in advance .

Relative Games - My apps

Check if you missed glEnable(GL_ALPHA_TEST)

[edited by - _Idan_ on December 29, 2003 9:12:54 AM]
Advertisement
normally I''d suggest you change the internal format to GL_RGB8 or GL_RGBA8 instead of GL_RGB/GL_RGBA. but your using gluBuild3DMipmaps, so I''m not sure what would happen if you did set the second arguement to that.. since the docs say it only accepts 1,2,3 or 4... but since your already using GL_RGB (the second param ) I guess thats wrong.... hopfully

| - My (new) little website - | - email me - |
Thanks a lot RipTorn , this was really interesting to see and... compare, the internal format seems to make a big difference... I`ll try to use it on my normal texture loading as well, I tryed GL_RGBA16 as well... should it be any different ? I know there`s 4 8 16 , 4 being the crapyest and 8 the standard but I don`t see any difference in 16...

Anyways I`ll be using GL_RGB8 and stuff from now on

Relative Games - My apps

even if your hardware did support GL_RGBA16 (I don''t think any consumer level stuff does) - it wouldn''t make any difference since your loading your texture as bytes... 8 bit (aka, GL_RGB8)...



| - My (new) little website - | - email me - |

This topic is closed to new replies.

Advertisement