Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No CRT Effect When Used with SDL2?
I have been using Tilengine with C++ for a project I have been making the past few weeks, and I have to say, I am very pleased with it.
The biggest reasons I came to this graphics engine is the CRT effect and the retro-graphics focus.
However, when I use SDL to render the window instead of Tilengine's window system, there is no more CRT effect, but everything else renders perfectly.
I used:
And it still had no effect.
I really liked the look of the CRT effect, and it would be a great addition to my project, but I had to use SDL for some features I needed.
Is there any way I can use the CRT effect with SDL?
If requested, I can post some of the code I used.
Hi Jakers! I'm glad you're enjoying tilengine  Smile

The absence of the CRT effect you're experiencing it's not a bug, it's normal: the CRT effect is implemented inside the windowing system, not in the rendering core. Since you're using SDL to render directly to your environment, bypassing the windowing system, you're bypassing the CRT effect too.

What features of SDL 1.2 do you forcibly need? The windowing system uses SDL2, can't you use this version?

The CRT effect is a post-processing effect, and as such it needs some level of GPU assistance (graphic hardware acceleration and composition). SDL 1.2 is a legacy library that doesn't use any kind of 3D API for rendering, so you'll be unable to implement or inject any kind of post-processing effect with it.
Thanks for the reply!
I am actually using SDL2, I should've put that in there, and I'm doing it so I can play music and sound effects, as well as more control over the input system.
Like you said, I am using Tilengine to render directly to SDL2, so it does make sense that it is bypassing the effects as well.
What is the best option to go about using the CRT effect within SDL2?
Do I take the CRT-related code from Tilengine's source files, and put it into my own project?
Or is there a better way to do this?
Of course, you can adapt it to your own needs. The source files that cointain everything related to the CRT effect are Window.c and GaussianBlur.c.
It renders the framebuffer to a SDL_Texture and the uses it to produce the desired effect.

Keep in mind that my implementation is somewhat cheap and doesn't take advantage of modern GPU capabilities. There are much better CRT shaders out there -albeit more GPU demanding too- such as CRT Lottes.

Forum Jump:

Users browsing this thread: 1 Guest(s)