Advertisement Jump to content
Sign in to follow this  

problem with glBlendFunc, 2d soft shadows, difference between ATI/NVIDIA Cards

This topic is 2484 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 there. I'm having this weird problem.
I've been working on some 2d soft shadows. It works ok on several ATI cards, tested on 4 different models so far.

But on NVIDIA (3 different models) it behaves differently

So first here's the problem


Here's how I'm doing it

// accumulate lighting in a texture
// Set viewport to texture size
//loop all lights
glColorMask(false, false, false, true);
// write shadow volumes to alpha
glBlendFunc(GL_ONE, GL_ONE);

// Here I draw all the shadows projections
for (bsSize b = 0; b<_lightBlockers.size(); ++b)
renderShadow(light, _lightBlockers);

//// draw light
glColorMask(true, true, true, false);
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); // <--- I think this might be the problem
// Switching to glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); results in the image below this code
// I draw a quad with the light texture
//end loop lights

// copy lighting into a texture
glBindTexture(GL_TEXTURE_2D, texID);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 0, 0, 512, 512, 0);
// apply lighting by rending light texture on top
// Simple quad drawing with the texture

However, switching to glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); to glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
gives me the same result on both cards, but obviously I don't want that effect, it's ugly :P


Can anyone help me out?


Share this post

Link to post
Share on other sites

Hmm... did you check if you really render to a RGBA target ?

Hum...I'm creating the context using SDL so I'm kind of lost on how to assure that, maybe I'll check on an SDL specific forum. Thanks

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!