Jump to content
  • Advertisement
Sign in to follow this  
Flawe

OpenGL Depth and Alpha problem

This topic is 4325 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

So i'm trying to draw two layers in OpenGL. I have Depth Test enabled and I clear the depth bit every frame. I draw the first layer normally and then I enable GL_BLEND, disable depth test and draw the second layer. What I get is the second layer looking normal and the first layer only diagonal lines with correct textures on them. Any idea why this happens?

Share this post


Link to post
Share on other sites
Advertisement
http://www.flaviusalecu.com/screen.jpg


here's what this picture is:

the first layer is drawn first and is almost completely black with hard to see diagonal lines and it's drawn with depth test on and alpha off. the second layer (the brown lumps with white around them) is drawn last with Alpha enabled and depth test disabled...this is what i get. If i don't disable depth test when I draw the second layer, it simply doesn't show up and I only see first layer.

[Edited by - Flawe on November 14, 2006 5:25:36 PM]

Share this post


Link to post
Share on other sites
im not 100% sure what u want
do u really need depth test?
what u have looks pretty 2d
perhaps try a different blending method eg GL_ONE GL_ONE

Share this post


Link to post
Share on other sites
thanx zed, GL_ONE, GL_ONE seemed to work for the map and it shows correctly now. I got a problem with the character sprite though. if I draw him GL_ONE, GL_ONE, he doesn't show up at all. However if I use GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA he shows up correctly but i get a trnasparent diagonal line right through the rectangle.

here's a pic. it's kinda hard to see the diagonal line on the character in this jpg but it's noticeable on his cheek, or whatever.


any idea why this happens?

Share this post


Link to post
Share on other sites
Quote:
Original post by Flawe
here's a pic. it's kinda hard to see the diagonal line on the character in this jpg but it's noticeable on his cheek, or whatever.

any idea why this happens?


can you mark and zoom that area? i can't even see what your character is.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!