The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Invalid renderer
blackwolf12333


Joined: 07 Mar 2015
Posts: 4
Hi,

I have been working on a little engine for a couple of days now, but one problem I can't solve is the fact that SDL won't give me a valid renderer. I create a new renderer with SDL_CreateRenderer(this->window, -1, SDL_RENDERER_SOFTWARE);. I use SDL_RENDERER_SOFTWARE because I assume that that should always work. However even this doesn't work. When I put 0 for flags or any other flag it will give me an Invalid renderer error anyway.

I wonder if this is a problem with my code, or if there might be something wrong with my SDL install, or some other part of the graphics stack. I'm working on Linux btw.

Source code for my engine can be found here, and the init code is here.

Thanks in advance,

Peter.
G-Shadow


Joined: 07 Sep 2014
Posts: 5
Hi.

Have you tried to disable all available renderers information obtaining loop?
I just tried this loop and it shows me only "direct3d" and "opengl" and the crashes (total 4 renderers returned by GetNumRenderDrivers()).
May be it causes some problems with one of renderers which does not crash your system but prevents from opening any renderer in future?

Also you could see what SDL_GetError() will say.
blackwolf12333


Joined: 07 Mar 2015
Posts: 4
G-Shadow wrote:
Hi.

Have you tried to disable all available renderers information obtaining loop?
I just tried this loop and it shows me only "direct3d" and "opengl" and the crashes (total 4 renderers returned by GetNumRenderDrivers()).
May be it causes some problems with one of renderers which does not crash your system but prevents from opening any renderer in future?

Also you could see what SDL_GetError() will say.


I have tried using all available renderers, including the software one. I still get the error when I comment out the loop that gets all the renderers. This is probably the weirdest bug I have ever seen so far.
blackwolf12333


Joined: 07 Mar 2015
Posts: 4
blackwolf12333 wrote:
G-Shadow wrote:
Hi.

Have you tried to disable all available renderers information obtaining loop?
I just tried this loop and it shows me only "direct3d" and "opengl" and the crashes (total 4 renderers returned by GetNumRenderDrivers()).
May be it causes some problems with one of renderers which does not crash your system but prevents from opening any renderer in future?

Also you could see what SDL_GetError() will say.


I have tried using all available renderers, including the software one. I still get the error when I comment out the loop that gets all the renderers. This is probably the weirdest bug I have ever seen so far.


I also tried building a minimal program with just a main function and basic SDL init functions. I still get the same error. I am completely lost :/
G-Shadow


Joined: 07 Sep 2014
Posts: 5
What SDL_GetError() says after renderer creation failure?
blackwolf12333


Joined: 07 Mar 2015
Posts: 4
G-Shadow wrote:
What SDL_GetError() says after renderer creation failure?


I fixed it. I don't know why, but calling SDL_GL_LoadLibrary("/usr/lib/libGL.so"); fixed it. I'm guessing because I was trying to use the opengl backend that it needs to load that library. But I would expect that to happen in SDL_Init.