OpenGL Drivers not functioning with SDL2

Hello,

I’ve written a GUI using C++/SDL2 and I’ve been trying to get it to run on the Apalis T30. I’ve successfully created an angstrom-lxde-image Yocto build that incorporates SDL2 and it’s dependencies. The issue is when I compile my software using the SDK and run it on the T30 I get the following message:

Renderer could not be created! SDL Error: Invalid renderer                      
Failed to initialize!  

When I check what graphics drivers SDL can see I get the following output:

Driver name (0): opengl                                                         
 the renderer uses hardware acceleration                                        
 present is synchronized with the refresh rate                                  
 the renderer supports rendering to texture                                     
Driver name (1): software                                                       
 the renderer is a software fallback                                            
 the renderer supports rendering to texture    

If I force it to use the second driver, the software fallback, the program starts just fine but runs at far too slow of a frame rate, I really need to use hardware acceleration.

I have noticed when I build my image using bitbake I do get a warning:

WARNING: No recipes available for:
  /home/kelton/oe-core/build/../layers/meta-freescale/dynamic-layers/browser-layer/recipes-browser/chromium/chromium-wayland_48.0.2548.0.bbappend
  /home/kelton/oe-core/build/../layers/meta-freescale/dynamic-layers/browser-layer/recipes-browser/chromium/chromium_52.0.2743.76.bbappend
  /home/kelton/oe-core/build/../layers/meta-jetson-tk1/recipes-graphics/mesa/mesa_11.1.1.bbappend

I’m not so woried about the chromium parts but I do know mesa is related to OpenGL. Could this be my issue?

One solution I’ve attempted is using OpenGL ES drivers instead. My host machine defaults to OpenGL but also has OpenGL ES available and if I force my software to run using OpenGL ES it seems to run fine. However I can’t for the life of me figure out how to get OpenGL ES into my yocto build. Perhaps I’m misunderstanding something because my google searches turn up nothing about how to do this. If this is a potential solution, how exactly do I go about this?

Otherwise any suggestions for a fix would be greatly appreciated, thanks.

hi @Khislop

I’ve successfully created an angstrom-lxde-image Yocto build that incorporates SDL2 and it’s dependencies.

Could you share your changes to the configuration files (local.conf, …)?

the issue is when I compile my software using the SDK and run it on the T30 I get the following message

Could you share a sample code?

Thanks and best regards,
Jaski

All my changes have been in the local.conf file:

Commented:
#MACHINE ?= “colibri-t20”

Uncommented:
MACHINE ?= “apalis-t30”

Added:
IMAGE_INSTALL_append = "libsdl2 \

libsdl2-image \

libsdl2-ttf"

Everything else should be what came as the default, but I’ll add my conf files just incase.

I also atatched a bare-bones sample project. It’s all done in main.cpp and it simply renders a single image to the window. I included a compile script for a host linux machine and the t30 (uses $CC so the sdk needs to be sourced fist).

SDL has two ways to draw to the screen, using their “SDL_Surface” which uses software rendering techniques, and “SDL_Texture” which uses hardware accellerated rendering. I’m specifically having issues with using hardware rendering. Unfortunaly I need to do a lot of alpha blending and software rendering is just too slow. SDL should default to OpenGL drivers but it will try to find alternitives if they aren’t available.

When I run this on my host it works great but when I atempt to execute it on my t30 (Apalis eval board) I get an internal SDL error: “Couldn’t find matching render driver”.

Thanks for the assistance!

conf files

sample code

hi @Khislop

Thanks for your Input. We don’t have experience using SDL with Opengl. We have examples to use Opengl ES which is documented here.

Best regards,
Jaski