We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1344 - No OpenGL headers when compiling -> no working Software renderer at runtime neither
Summary: No OpenGL headers when compiling -> no working Software renderer at runtime n...
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 blocker
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-15 17:19 UTC by Ellie
Modified: 2012-01-08 14:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ellie 2011-12-15 17:19:31 UTC
It appears from testing on Debian 6 in VirtualBox that when installing all required X headers but no libGL dev headers, SDL will compile fine but fail when this command is used:

 SDL_CreateRenderer(window, -1, SDL_SOFTWARE);

with the error:

 index must be in the range of 0 - 0

When installing the OpenGL headers and rebuilding SDL with OpenGL support, the error disappears and software mode works perfectly with exactly the same code line.

Since the workaround isn't obvious (installing OpenGL drivers for software renderer) and Debian 6 seems to install without GL headers and without OpenGL on systems with no 3d drivers, I made the guess that this qualifies as a blocker: SDL seems to be quite useless for any sort of 2d game without a working renderer. Please readjust severity if I was wrong with that.
Comment 1 Sam Lantinga 2012-01-06 22:14:07 UTC
SDL will no longer compile if there aren't any renderers available.
http://hg.libsdl.org/SDL/rev/aa4d1d639f2e

Thanks!
Comment 2 Ellie 2012-01-06 22:21:40 UTC
Are you sure that fixes this case?

The problem appeared to me to be different than SDL allowing no renderers. In fact, there should have been one, the software renderer! X11 dev libs should have been there, just OpenGL headers weren't. I will test now if with the latest SDL revision, the software renderer is available as it should be (I still have the faulty situation conserved in a virtual machine for further testing).

If the latest revision still doesn't offer software rendering in that situation, I think this bug should be reopened since the software renderer should be available even if the OpenGL one isn't, right? (assuming X11 dev headers are there)

Will report back soon with test results.
Comment 3 Sam Lantinga 2012-01-07 11:18:26 UTC
You're right, the software renderer is still there, and creating a renderer still fails.
Comment 4 Sam Lantinga 2012-01-07 11:38:32 UTC
Actually, I did some more digging and if you don't have OpenGL, but you do have X11, the software renderer should still work.

I verified that this is the case on Ubuntu by configuring SDL with --disable-video-opengl:
slouken@ubuntu:~/projects/SDL/test$ ./testgl
Couldn't set GL mode: No OpenGL support in video driver
slouken@ubuntu:~/projects/SDL/test$ ./testsprite2
1949.35 frames per second

Can you debug it a bit more and see what is actually happening in your case?
Comment 5 Ellie 2012-01-08 13:47:09 UTC
I messed up the debug output/misinterpreted it. It was actually my own fault because it ran into another code branch than I thought it did, and that code branch said:

SDL_Renderer* mainrenderer = SDL_CreateRenderer(mainwindow, -1, SDL_RENDERER_ACCELERATED|SDL_PRESENT_VSYNC);

Obviously, no such renderer was available under the given conditions. As soon as I changed the flags to 0, the problem went away. Sorry for wasting your time with my own bug :-) should probably do a minimal test case again next time.

The only suggestion I would still have resulting out of this is:
Maybe "index must be in the range of 0 - 0" isn't as good as "no renderer with the given flags is available" which I'd suggest instead to make the problem obvious for other misguided souls that run into a similar situation.
Comment 6 Sam Lantinga 2012-01-08 14:03:34 UTC
No problem.

I'm wondering where that message came from, because looking at the code, the relevant message would be:
"Couldn't find matching render driver"

Are you still seeing that same message with the latest snapshot?
http://www.libsdl.org/tmp/SDL-1.3.zip