This is related to an earlier question "eglGetDisplay() fails on RaspBerry 3". On Raspbian Stretch with the full OpenGL driver, running hello_triangle or other GLES examples under /opt/vc/src/hello_pi/ results in:
failed to add service - already in use?
Per the Stack Overflow link below, this can be worked around by commenting out dtoverlay=vc4-kms-v3d in config.txt. Unfortunately that disables OpenGL, leading to odd configuration restrictions like being unable to run both Quake 3 and full Minecraft without rebooting.
How can I fix this in the source code of GLES apps while still linking with the Broadcom VideoCore GLES/EGL libraries? Note that although such apps could be ported to avoid dispmanx and use the Mesa open-source driver instead, performance would take a hit.
minecraft-pi doesn't have this error so it should be possible, but it would take some effort to step through that closed-source application. Maybe someone knows a working example with source code?
Links: