Jump to content

  • Log In with Google      Sign In   
  • Create Account

Alpha Zone on Targa Texture just won't show alpha


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Cydriic   Members   -  Reputation: 143

Like
0Likes
Like

Posted 28 June 2014 - 09:52 AM

Hi Everyone, I found a targa loader that works great and implemented it in my code.

But for some reason, the alpha region of my texture , just won't be alpha when I load the Texture in my code.

If I make a texture that is a full purple colored rectangle, and carve out the central part with an alpha zone, in-game the quad is all full purple, instead of having the central part being transparent.

I tried the following code too, and it doesn't work, I don't understand
//NPC
glEnable(GL_BLEND); // Enable Blending

NPC00->Draw();

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Set The Blending To A Nice 50/50 Mode
glDisable(GL_BLEND); // Disable Blending


Draw Function, basically draws a Quad and applies the texture to it.


Can anybody help me understand whats missing I'm just trying to get textures with alpha to work, I usually work with targas, so thats why I got a targa loader.

Thanks.


Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 4092

Like
0Likes
Like

Posted 28 June 2014 - 11:32 AM

Are you sure your texture has a proper alpha channel? What program did you use to make it, and have your tried loading it in another program to check?



#3 xDarkShadowKnightx   Members   -  Reputation: 425

Like
0Likes
Like

Posted 28 June 2014 - 12:56 PM

It could be the order of your opengl calls, try calling glBlendFunc before you call NPC00->Draw();

#4 Cydriic   Members   -  Reputation: 143

Like
0Likes
Like

Posted 28 June 2014 - 04:44 PM

I used Gimp for the creation of the alpha channel.

 

Also I tried changing the order, putting glBlenFunc before (which makes total sense btw) and no change.



#5 LorenzoGatti   Crossbones+   -  Reputation: 2762

Like
1Likes
Like

Posted 29 June 2014 - 01:40 PM

What about the creation of the OpenGL texture? The alpha channel could be lost after loading the file correctly.


Produci, consuma, crepa

#6 L. Spiro   Crossbones+   -  Reputation: 14223

Like
1Likes
Like

Posted 29 June 2014 - 01:42 PM

Post the .TGA file.

 

 

L. Spiro


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS