Advertisement

influencing GL_BLEND_FUNCS

Started by January 27, 2003 09:56 AM
16 comments, last by arkansas 22 years, 1 month ago
Hey... How can I influence the transparency?? I coded a Water animation engine, but the water is too hollow. Is there a way to decrease the transparency. arkansas
do some research on alpha blending. you will need to call
glEnable(GL_BLEND);
and set up a few other parameters as well. but most importantly, when you specify color for something, call glColor4f(), and the last param is for alpha, which specified how much you want your object to blend with whatever is behind it. it ranges from 0 - 1, 0 being completely transparent, and 1 being completely solid. check the red book, they talk about it pretty well

Advertisement
thanks...

*smile* I forgot about glColor4f hehe.
How is created your texture ? Is it read from disk ? If so, you can for sure open this file with an image editor (eg photoshop or paint shop pro) and edit the alpha channel to fit in your rendering requirements.
its only color for now. But glColoe4f ain''t working either.
by "it''s only color", you mean there''s no alpha channel ? Well you can also change RGB components using an image editor.

BTW, what''s your blending function actually ?
Advertisement
my BlendFunc

glBlendFunc(GL_SRC_ALPHA, GL_ONE);
So you have an alpha channel, don''t you ?

Could you also please post the piece of code that uploads the texture image from client memory to server (ie call to glTexImage2D) ?
I don''t need to use a texture. I only need glColor3f(0,0,1); because I animated the water.
No texture ? Ok it''s clear now

So if you call glColor3f that means your alpha channel is 1. Your water looks opaque, isn''t it ? Otherwise how do you setup transparency ?

This topic is closed to new replies.

Advertisement