Raspberry Pi (Raspbian) + OpenglES + no X |
Raspberry Pi (Raspbian) + OpenglES + no X |
MrOzBarry
|
I'd say build it yourself, distribute the library files with your app. I think most people are building with the flags you mentioned.  Here is the script the buildbot uses to test raspberry pi builds. You might not need all of those flags (ie prefix, sysroot, etc.), but that's a good starting point for a known, good configure. There are a few others that probably do more SDL apps for raspberry pi than myself that could give you better directions, but that's at least a start.
On Thu, Oct 6, 2016 at 11:59 AM, cleger wrote:
|
|||||||||||||
|
Raspberry Pi (Raspbian) + OpenglES + no X |
gabomdq
|
2016-10-06 12:59 GMT-03:00 cleger:
It depends on how that library was built. If it has both X11 and RPi video backends in it, you need to make sure the right one is selected when launching your app (SDL by default just goes through the list of video backends compiled in until one works). That's why I suggest disabling X11 support when building for the RPi, since it doesn't really work and gets in the way. Â
It doesn't assume anything, in terms of "preference", you can see the video backend selection logic here: https://hg.libsdl.org/SDL/file/tip/src/video/SDL_video.c#l472 It can be affected by the environment variable SDL_VIDEODRIVER, otherwise it'll go through the bootstrap array, where X11 is listed in second place thus it'll be initialized before the RPi direct hardware backend. Gabriel. |
|||||||||||||||
|
cleger
|
Thank you MrOzBarry and Gabriel, I think you answered what I need to know. I'll post again whenever I get a chance to make progress on this. Cheers![/quote]
|
|||||||||||
|
blacktm
|
cleger – I've also had to figure this out for my little 2D graphics engine: https://github.com/simple2d/simple2d
Unfortunatly, the Raspbian packages are configured for desktop OpenGL and X11, so I currently have the Simple 2D install script build SDL2 from source, which works great (and is very fast) using OpenGL ES without X. For a shortcut, you can build/install just SDL2 (along with SDL2_mixer, SDL2_image, SDL2_ttf, and SMPEG2) by running the script with the `--sdl` flag:
See all the details under the hood here: https://github.com/simple2d/simple2d/blob/v0.4.1/bin/simple2d.sh#L280 I might also recommend giving Simple 2D a try, browse through the internals – lots of SDL examples on display here that work across platforms/OSes, GL2, GL3, GLES, etc. Good luck, and happy to answer any more Q's you have, blockers you encounter. SDL is awesome and I'm always looking for ways to make it easier for folks to get started. Tom |
|||||||||||||
|
Now working |
cleger
|
Hi all,
Thanks for the feedback it was extremely helpful. After a very long sequence of distractions... Here is where I am: I was able to build SDL2 and run an OpenGL-enabled program, entirely from the RPI console - which is amazing! What remains weird is this: - I was entirely unable to build or run the app without specifying LD_LIBRARY_PATH=/opt/vc/lib:./lib (where the first path holds opengl es and the latter was where I had my self-built SDL2 libs). No ordering of -L parameters seemed to override the system default of looking for libOpenGLES2 in /usr/lib/arm-etc. which for some reason never works (x11 dependent?). - for some reason even though building SDL2 produce three separate identical (diff==empty) lib files named libSDL2-2.0.so, libSDL2-2.0.so.0.4.1, libSDL2.so, the only way the linker and the runtime are happy is if I have at least libSDL2.so in my ld-library-path, along with a symlink to it called libSDL2-2.0.s0.0. If the symlink is missing, no go. If I have the lib with only the name of the symlink, no go. If both names are there, with files of exactly the same content, all is good. Anybody know why? I'm not by any means an expert in binaries and linking matters. Also, I've tried all manner of SDL_SetHint and SDL_WINDOW_INPUT_GRABBED values at initialization, but I always get ^[[6~ showing up a bunch of times in the console output. I'll probably post a new question about that. Thanks so much for the feedback so far, it was what I needed to get going and now I'm back in this fun game! |
|||||||||||
|