Jump to content
  • Advertisement
Sign in to follow this  
tanissian

Can blending be done with depth test on?

This topic is 4751 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Megahertz
Should that not be glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ?


whoops. yeah, what he said.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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. =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!