Jump to content
  • Advertisement
Sign in to follow this  
Nguyen Khac Thanh

Blend Mode in SDL

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


The _NONE mode is basically "overwrite" - when you write a pixel to the location that you already wrote a pixel to, the pixel underneath is completely replaced with the new one.

The _BLEND mode instead gives you a mixture of the old pixel and the new one, based on how large the 'A' or 'alpha' value of the new pixel is. If 'A' is 1, you just see the new pixel (like with the _NONE mode), if 'A' is 0, the old pixel is left in place, and values between 0 and 1 will be a blend between the 2.

_ADD is like _BLEND except the new pixel's colour (scaled by the new pixel's alpha) is 'added' to the old pixel. This means the pixel can only get brighter, based on how bright the new pixel is. This might be useful for bright particles like electrical sparks or fire.

_MOD is like _ADD, except the pixels can only get darker, based on how dark the new pixel is. You might use this for dark particles like smoke or flying debris.

There are many other more advanced rendering techniques that use these, and other, blend modes. But usually you will want _NONE or _BLEND.

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.

GameDev.net 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!