5

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

asked Feb 10, 2015 at 18:24

2 Answers 2

3

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
answered Feb 11, 2015 at 16:46
0

On my RPI the file /opt/vc/lib/libGLESv2.so does not exist. And libGLESv2.so gives me a blank screen.

Found that linking to this file works: /opt/vc/lib/libbrcmGLESv2.so.

In order to compile a small program with both SDL2 and GLES I needed this command line:

g++ -o gltest gltest.cpp -L/opt/vc/lib `sdl2-config --libs` -lbrcmGLESv2
answered Jun 3, 2019 at 21:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.