🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Additive Blending in SDL?

Started by
2 comments, last by c-gibson-s 19 years, 10 months ago
I'm thinking of using SDL's blting functions (no OpenGL) for a game, but there's one feature I can't seem to find information on: additive blending, i.e. doing an alpha op where a pixel with RGB(5,5,5) superimposed on a pixel (100,100,100) gives a pixel (105,105,105). Does this feature exist in sdl itself, or do I need to go to OpenGL? If it does exist, can anyone tell me how to do it?
Advertisement
technically, blending is done by multiplying the pixels. You can do this pixel by pixel using SDL_mapRBGA, or affecting the whole surface by calling SDL_SetAlpha.

You could go in and do the additive thing by hand... you would get some really wierd looking sprites though.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
SDL is a simple 2D api and that sort of capability isn't included as far as I know. Blending is a slow operation anyway so you should really consider moving to OpenGL for your graphics if speed is an issue.
Couldnt you just use a getpixel thing to get the rgb and then physically add the two numbers together onto the new pixel?


Er wait....right..its coming to me..

use OpenGL.
gib.son

This topic is closed to new replies.

Advertisement