I'm using SDL 2.0.2 (from the repository) in windowed mode on an RPi 3, using the 'experimental' OpenGL driver, and all the normal 2D SDL functions work as I would expect (and appear to be accelerated). However even the simplest attempt to access the OpenGL context directly isn't working:
Code: Select all
glcontext = SDL_GL_CreateContext(window);
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(window);
This works perfectly fine on other platforms (Windows, Linux, Mac OS) but on the RPi instead of clearing the window to black it clears it to green, and changing the parameters of glClearColor() seems to make no difference! I am at a loss to understand what is going on here.
The only other indication of a problem is this warning on the console:
Code: Select all
libGL error: MESA-LOADER: failed to retrieve device information
however I suspect this is a red herring because
glxgears reports the same warning but otherwise works correctly.
Can anybody suggest why my trivial SDL program isn't working on the RPi?
Richard.