Jump to content
  • Advertisement
Sign in to follow this  
_biobrain_

Alpha Test: doesn't work!!!

This topic is 4918 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!