4

I am looking for a "Hello World" type example that makes use of OpenGL-ES2 via SDL2. So far I could gather:

  • SDL2 that ships with Raspbian does not support OpenGL-ES2 out of the box
  • SDL-2.0.3 manually compiled from source should support OpenGL-ES2 in theory

However even with a manually compiled SDL-2.0.3 I can't get OpenGL-ES2 to work, the displays goes black, so something is working, but even a simple glClearColor()/glClear() doesn't have any effect. The same code via EGL or run via OpenGL on a desktop computer however works as expected.

Source code is available at: https://github.com/Grumbel/rpi-opengl

2

The problem turned out to not be in the code, but in the library path. A simple -L/opt/vc/lib/ added to the compile command line fixed it. Without that the compiler would pick:

/usr/lib/arm-linux-gnueabihf/libGLESv2.so.2

While the right one would be (use ldd to check):

/opt/vc/lib/libGLESv2.so

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.