I’m trying to make a basic 2D engine, and am having problems…I enabled blending using glEnable(GL_BLEND);, set glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);, am loading a TGA that I know has an Alpha bit with some transparency(I exported the transparency bit to a file, and it’s there), Texture Mapped the TGA to a quad, then tried to display it over another texture mapped quad…I loaded it last, and the Z is much higher, and I’m in glOrtho, yet there’s nothing transparent at all in the quad. It’s still just a solid block.
I’m programming in C.
I don’t understand why it’s not working…though another odd thing is that when I call glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT), and I’ve used a glColor somewhere in my main loop, the color stays…it doesn’t clear it…seriously confusing me. I have set glClearColor… Any ideas? Particularly the first problem. Thanks.
Finder
[This message has been edited by Finder (edited 04-26-2003).]
About blending - check the glTexImage2D function for parameter GL_RGBA. Maybe the picture hasn’t transparancy background?
glClearColor doesn’t clear the color for function glColor, this function specifies the color for color buffer, that means what is the color of the screen after calling SwapBuffers.
How do you set glOrtho - specifically actual near and far parameters passed to the function and what is the z depth of your textured quad? Just want to make sure you aren’t placing the quad outside of the near and far clip planes.
The TGA with transparency is in front. The background TGA does have alpha, but all of it is set to 1.
Was also curious if it had something to do with the poor fact that I’m running windows? Normal polies work fine blended…just not RGBA textures. I’ve statically linked the library, so I don’t see a problem…but if that is it, is there a way to fix it?
[This message has been edited by Finder (edited 04-26-2003).]
Sure, I can see it…the whole picture that is. Same as with blending on. Just no transparency.
the funny thing is that if I set transparency with glColor4f(1.0,1.0,1.0,0.5)…it shows it with transparency. But of course I can’t change the individual bits easily with this.
Thanks for all of the help…sorry for being a pain. ;-p
Edit:
Yes, the “transparent” quad is drawn last…and I have tried both depth testing enabled and disabled…doesn’t seem to make a difference. But normally, it is enabled.
[This message has been edited by Finder (edited 04-26-2003).]
[This message has been edited by Finder (edited 04-26-2003).]
Yep, I can see it. But nothing is transparent.
I did have:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
and tried the new color one…but no difference. Everything’s still opaque.
Sorry for the confusion.
[This message has been edited by Finder (edited 04-26-2003).]
It might take a bit of looking to find the image that’s supposed to be transparent…it’s the little cursor in the cupboard. Btw, I’ll delete this image after you view it 'cause it copywritten(used with permission)
Yeah, pretty much…it’s just supposed to be a hand cursor(will rework the artwork later. ;-p), so the inside part of the hand should be opaque while the outside white should be transparent
Which I’ve checked time and time again that the Alpha channel was right, and it is…even output its contents to a file and it lined up perfectly.
[This message has been edited by Finder (edited 04-26-2003).]