PDA

View Full Version : Fade in-out a textured quad ?



07-30-2005, 01:25 PM
How can I change the transparency of a textured quad in OpenGL ? because I tried using glColor4f(255,255,255,0) and it was still visible, isnt the last parameter the alpha one? - Im confused ..!

I need to fade in and out textured quads .. and perhaps move them from point A to point B smoothly - I can only do a rough movement (from point a to b no interpolation) is there any examples on doing this? also mouse picking? I got an example and it was very well loaded of crap!! why isnt there any example with 2 cubes on screen and nothing else than that, where it lets you mouse pick on them... instead of moving crap with sounds and stupidity for a mouse picking example..!!

dvm
07-30-2005, 02:34 PM
Have you created a 32-bit texture? You actually need an image (say targa) that supports transparency. I haven't ever changed the transparency values on the fly though. Another reason would be that you haven't set up properly glBlendFunc. Look it up in the manual. I think that if your texture is all opaque then you've got a problem with glBlendFunc and you don't really need a 32-bit texture.
As for mouse picking I think the example in the red book is a simple one. Good luck!

07-30-2005, 02:52 PM
Well My blendfunc is nice, everything works as it should - I want to fade a quad out and then fade another one in, ever used FlashMX? like that, change the transparency of the "object" (a simple quad in this case).

Were can i get that redbook example? is it the one with the snowmans? it didnt work nice here, I clicked the right top snowman and it didnt get which one I clicked on...!

07-30-2005, 03:02 PM
somehow when i tried again it worked nice glcolor4f ! this is weird .. too weird.

dvm
07-30-2005, 03:11 PM
Hmm, something must've slipped through the cracks then :) Good job, finding it.
For the red book do a search for OpenGL Programming Guide. "red book" is just the nick, err..because it's red. There's an old version lurking around for free. As for the example, it's just 3 quads. Very fancy :D

07-30-2005, 07:13 PM
http://www.opengl.org/resources/code/basics/redbook/

hmm but i only have VC++ 6.0 standard how im going to compile this ?

dvm
07-31-2005, 06:01 AM
If you're talking about glut go here (http://xmission.com/~nate/opengl)