I followed the very thorough instructions on https://github.com/gosu/gosu/wiki/Getting-Started-on-Raspbian-(Raspberry-Pi)
. I'm pretty sure that I got everything correct as I copied all the commands from the wiki page into the command line.
When I run a very simple test program, I get this error:
pi@raspibplus ~/Code/Ruby/Gosu $ ruby test.rb
initialize': Could not create window: Could not initialize OpenGL / GLES library (RuntimeError)initialize'
from test.rb:15:in `<main>'
terminate called after throwing an instance of 'std::runtime_error'
what(): Could not create window: Could not initialize OpenGL / GLES library
Any suggestions as to what I may have done incorrectly?
Thanks in advance
I wonder if I have broken something in Gosu 0.9.x - I didn't have a chance to test this version on a Raspberry Pi. Can you please try using Gosu 0.8.x? If that helps, I'll need to grab a Raspi again and debug Gosu 0.9.x. Thanks.
I tried with Gosu 0.8.7.2 and got a similar error when I tried to run the tutorial program:
pi@raspibplus /usr/local/lib/ruby/gems/2.2.0/gems/gosu-0.8.7.2/examples $ gem list gosu
*** LOCAL GEMS ***
pi@raspibplus /usr/local/lib/ruby/gems/2.2.0/gems/gosu-0.8.7.2/examples $ ruby Tutorial.rb
initialize': Could not open window: Could not initialize OpenGL / GLES library (RuntimeError)initialize'
I've diffed the sources for Gosu 0.8.0 (which I know worked on Raspbian) and 0.8.7.2 and couldn't find anything that should cause this issue. =/ I wonder if anything in SDL 2 or Raspbian has changed since then. The only advice I can give is to compile an OpenGL ES 1.x demo that uses SDL 2 and see if it works on your machine. Sorry! I've already given away my Pi.
I'll try to do that over the next few days. If I'm able I'll let you know how I got on.
It took me a little longer than I had hoped. I wasn't able to get any of the SDL2 test programs working but that was probably because I was making mistakes.
However, by following these instructions - https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/
- I was able to compile and run the simple test program at the end of the blog.
I installed gosu 0.9.2 again using the command from the Gosu wiki but still got the "Could not initialize OpenGL / GLES library message" when I ran the tutorial.
(By the way, it seems that the examples don't get installed with 0.9.2)
Right, the examples live in the
gem now: https://github.com/gosu/gosu-examples
(a recent and not very well documented move)
Can you please try calling
after creating the window and see what it returns?
Thanks for the reply. I'm afraid I don't know any C++ and only a little C. I found from the compiler that SDL_CreateContext returns a pseudonym for void. I printed this value as an integer, it contained 1. (I'm not sure if this is what you needed or any use).
Please let me know what I can do to help (given my limitations).
This is the line of code that I inserted:
printf("SDL_GL_CreateContext returns %d\n", int(SDL_GL_CreateContext(window)));
I put that immediately after:
SDL_Window* window = SDL_CreateWindow("Test SDL 2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
800, 600, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);
check_error_sdl(window == nullptr, "Unable to create window");
This is the output:
~/SDL2test $ ./sdl2_test
SDL_GL_CreateContext returns 1
I am a little confused why SDL_GL_CreateContext would return 1 – but anything that's not 0 is good, I guess!
There's been a GitHub issue about the Pi just this week: https://github.com/gosu/gosu/issues/285
...so I guess Gosu does *theoretically* work on Raspbian, but at this point I can only say that the Pi is terrible platform for SDL 2/OpenGL (ES), and that I don't know how to support it properly. :(
Being an optimist, I hope that in the not so distant future Raspian will include a decent SDL 2 implementation. In the meantime, I will enjoy learning about Gosu on my Mac.
Thanks for taking a look into the issue.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill