PDA

View Full Version : Water transparence problem



FatalError
04-06-2001, 07:57 AM
Hi,

I have a model with a ground and a river.
I want the water texture to be transparent and then to see the rocks in the river.
For that I render the scene first with the opaque textures (the ground) and then I make
glEnable(GL_BEND);
glDisable(GL_DEPTH_TEST);
and I render the triangles with the water texture.
The triangles are send to Opengl from the furthest to the nearest.

I init OPengl with
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

I use a glColor4f(1,1,1,0.5f);

But I can't see trough the water.

Does someone have an idee of the problem ?

Thanks

Sancho
04-06-2001, 09:08 AM
Do you make a glTexEnv(GL_TEXTURE_2D, GL_MODULATE) and not a GL_REPLACE ?

Sancho
04-06-2001, 09:50 AM
Oups, of course I would like to say glTexEnvi(GL_TEX_ENV, GL_TEX_ENV_MODE, GL_MODULATE) which is done by default...

Korval
04-06-2001, 10:30 AM
Don't forget to turn on glColorMaterial (or just use the glMaterial functions to set the alpha value).

FatalError
04-06-2001, 02:12 PM
it's strange: if I don't disable the DEPTH_TEST & disable the lighting: it works !!!
Any idea ?

j
04-06-2001, 05:15 PM
What about when both lighting and the depth buffer are disabled?

If it works in this case, then like Korval said, you need to use glMaterial instead of glColor.

j

zed
04-06-2001, 08:40 PM
>>it's strange: if I don't disable the DEPTH_TEST & disable the lighting: it works !!!
Any idea ?<<

read the FAQ (link first page)
basically unless youre using color_material. glColor..(..) commands have no effect when lighting is enabled.

FatalError
04-07-2001, 08:49 AM
You were right: i forgot to enable GL_COLOR_MATERIAL :-)
Thanks

But it still works only with DEPTH_TEST enabled.