Sign in to follow this  

Alpha Test: doesn't work!!!

This topic is 4673 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys!!! I' ve another problem in my engine: alpha test doesn't work!!! this is a piece of my code, that control the alpha test:
if((texture->MultiTexture==false) && (texture->BumpMapping==false) && (texture->CubeMapping==false)){
			
			glActiveTextureARB(GL_TEXTURE0_ARB);
			glEnable(GL_TEXTURE_2D);

			if( texture->Tipe != 1 )

				glBindTexture(GL_TEXTURE_2D, texture->Texture);

			else{
/*
				glEnable( GL_BLEND );
				glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

				glEnable( GL_ALPHA_TEST );
				glAlphaFunc( GL_GREATER, 0.0f );
*/
				glBindTexture(GL_TEXTURE_2D, texture->Texture);

			}
	
			glActiveTextureARB(GL_TEXTURE1_ARB);
			
			glDisable(GL_TEXTURE_2D);












and the results is: Free Image Hosting at www.ImageShack.us but if I try to enable alpha test, the little spongebob doesn't compare!! all the mesh is transparent!!! code
if((texture->MultiTexture==false) && (texture->BumpMapping==false) && (texture->CubeMapping==false)){
			
			glActiveTextureARB(GL_TEXTURE0_ARB);
			glEnable(GL_TEXTURE_2D);

			if( texture->Tipe != 1 )

				glBindTexture(GL_TEXTURE_2D, texture->Texture);

			else{

				glEnable( GL_BLEND );
				glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

				glEnable( GL_ALPHA_TEST );
				glAlphaFunc( GL_GREATER, 0.0f );

				glBindTexture(GL_TEXTURE_2D, texture->Texture);

			}
	
			glActiveTextureARB(GL_TEXTURE1_ARB);
			
			glDisable(GL_TEXTURE_2D);












and pic Free Image Hosting at www.ImageShack.us I've compared my source with a tutorial from codesampler.com... the TGA loader is ok (it loads the image!) and the initialization looks equal...where is the error? [Edited by - _biobrain_ on April 1, 2005 2:08:18 PM]

Share this post


Link to post
Share on other sites
I don't know how you created the texture, but if it was Photoshop try to get an updated version. In version 7.0 (I believe), the alpha channel of TGA files is not exported correctly. Took some time to find that out, since you always doubt your own creations first.

Greetz,

Illco.

Share this post


Link to post
Share on other sites
I've took the texture from the tutorial from codesampler.com... I don't know how it's create, but in the tuts the TGA file works!

Share this post


Link to post
Share on other sites

This topic is 4673 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this