SDL2 Effects

What is the best way to achieve 2D effects, similar to what is seen in Tower Climb, in SDL2?

Here’s a video of Tower Climb for reference:

Some of the effects seen:

  1. Dynamic lighting on normal maps.
  2. Glow effects.
  3. Particle/Smoke effects.
  4. Post-processing.

I am pretty certain that we would need to use sdl-gpu along with OpenGL/shaders to achieve all the above.

Has anyone done anything like this in SDL2 with sdl-gpu? Any examples?

2 Likes

Hello there, I was asking the exact same question for some time now but I haven’t been really able to find time to look into it. Have you found anything about this?

Hi,

Take a look on SDL2_gfx, SDL2 graphics drawing primitives and other support functions

https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/

:slight_smile:

Any update on this? I’ve checked out the SDL2 GFX lib and its just drawing primitives? How do you make glowing or neon effects? Explosion? Fire? Is it even possible with SDL2?

Okay, so you’ve necroed a post from the stoneage, but I’ll give you, I think, a proper answer. I wrote some code to mask images, no promises that you can call it 60 times a second, though. Between clever masking, additive/modulative blend-modes, and lots and lots of render-targets, you could do all of those things, but has anyone tried it? No, nobody has done this with SDL because it’s not worth it. If you want these things, the best advice for you is to forget about SDL, in my opinion.

ŌK, sure, but then which graphic lib should I be looking at? I can’t find anything that does these flashy graphics from the 90s?

It looks like you may be looking for a particle effects engine. I would try searching for particle effects. It’s possible that there was a particle effects engine written on top of SDL2. Explosions and fire are definitely within the realm of particle effects. For glowing and or neon effects that may be a little different but are somewhat similar in a way.

Outline effects, such as glows, are not something you want to try with a particle system. They’re best done with a custom shader instead. (Which puts them beyond the reach of SDL for the moment, though there has been some talk recently of supporting custom shaders at some point in the near future.)