Switching rendering method at runtime

Hello everyone,

It is possible to switch at runtime between differents rendering methods, for example from software to opengl rendering?

Kind regards

I did have it working at one time but I think a newer version of SDL caused it to then error out.

Running both is not supported so you can try at your own risk.

When I had them both running, I used the software rendering to display my loading animation. Worked perfectly for that while it lasted.

Why do you want to run both?

Thank you for the reply.

“Why do you want to run both?”

I have three rendering engine, actually.
Some video cards may run faster in openGL mode, while some other card may use the third engine.
Software mode should be the fallback mode in case none of the other drivers are available.

Being able to switch this at runtime would be cool.

1 Like

Having a software rendering mode as a fall back may have been a good idea back in the mid 90’s, today it’s just a waist of your time. Chances are you put a bunch of effort into supporting SDL software rendering capabilities and you just want make use of all that hard work. I understand where you are coming from but splitting your time between the two is a waist of effort. If there is even one person who would need to fall back on that software rendering, they will not be happy because they want the speed and look that comes from hardware rendering. Also, your engine design can be greatly simplified by just supporting OpenGL, which runs on everything. :slight_smile:

2016-10-29 17:22 GMT-03:00, GameCodingNinja :

If
there is even one person who would need to fall back on that software
rendering, they will not be happy because they want the speed and look that
comes from hardware rendering.

Eh, with 2D stuff it may still be fast enough, and I’ve seen cases
where hardware rendering wasn’t a good thing (e.g. some magnifiers
have trouble with GPU-rendered stuff).

As for the original question, I don’t think you can switch renderers
on the same window. Maybe with some trickery involving creating and
destroying renderers without destroying the window, but try at your
own risk (I doubt this would work honestly).

I’ve seen cases where hardware rendering wasn’t a good thing

That might be the case for some very old hardware no one is currently using and anyone one using it would not be looking to play “today’s” games on it. So it’s a moot point.

It’s hard enough just to come up with a game idea that is doable and actually finish it. To split your time between two very different API’s which will force you to gimp OpenGL, doesn’t make a lot of sense. There’s a lot of cool things you can do with OpneGL that can’t be done with the old SDL render API. Also, the more you know about OpenGL, the more marketable you are in the job market. There are no employers looking for SDL Render API experience. That should tell you all you need to know.