Can blending be done with depth test on?

Started by
9 comments, last by anist 18 years, 11 months ago
Hi all, I am trying to do some blending with GL_DEPTH_TEST enabled. However, this does not seem to work. My question is, is there a way to do blending of textures without making the whole thing transparent? Thanks!
Advertisement
glDepthWrite(GL_FALSE)
hmm, how exactly do you use this? It gives me an error if I compile the code.

error C3861: 'glDepthWrite': identifier not found, even with argument-dependent lookup
think he meant depth mask. check the spec.
[size="1"]
your question of not making textures totally transparent has nothing to do with the depth buffer. to load a texture with only some transparency, use a loading function like in this post

you will want ot leave the depth buffer enabled and set glBelndFunc(GL_SRC_ALPHA, GL_SRC_ALPHA_MINUS_ONE); more than likely. you will want ot draw the transparent parts last, so if you have complicated geometry within the transparent sections you want to sort the triangles drawing furthest to closest.
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
Should that not be glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ?

-=[ Megahertz ]=-

-=[Megahertz]=-
Quote:Original post by Megahertz
Should that not be glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ?


whoops. yeah, what he said.
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
Ok, thx for all the replies. What I am trying to do here is to texture a terrain. I have divided the mesh into pieces so that each one sub-mesh would use a same texture. Now, I need to do the transistion between two different textured meshes. If I enable depth test, then the blending does not seem to happen at all. If I disable the depth test, I can see the blending effect, but the terrain would be see-thru. Btw, my textures do not have alpha channel, could this be why? Thanks again!
EDIT: sounds like you're trying to multitexture maybe? have you read NeHe's tutorial on it?
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
I am trying to do multi-texture on a terrain, without using shaders. I read a post here somewhere (but I cant find it now) saying that you can just render the mesh many times with different blending factor to get the transistion effect between different textures. The guy even posted some some ss and looked pretty nice. I am not sure but I could have read it wrong.

EDIT: Yea, I had the terrain working with multi-texture. I am just wondering if I can do it this way using blending. =)

This topic is closed to new replies.

Advertisement