Skip to content

Dynamically load EGL and GLES extensions as is done for desktop GL#1603

Merged
eXpl0it3r merged 1 commit intomasterfrom
feature/gles_extensions
Sep 12, 2019
Merged

Dynamically load EGL and GLES extensions as is done for desktop GL#1603
eXpl0it3r merged 1 commit intomasterfrom
feature/gles_extensions

Conversation

@binary1248
Copy link
Copy Markdown
Member

This makes it possible to build/run SFML applications on more (all?) systems that support EGL and GLES1. Previously, it would fail to build on Raspbian due to linker errors caused by missing entry points in the GLES1 library provided.

The idea behind OpenGL extensions is that applications can determine at run-time which extensions are support on the target platform and adjust their behaviour accordingly or in certain cases just terminate gracefully. In order to allow functions to optionally be available, the underlying library will have to be dynamically linked and the entry points loaded at runtime, if they are available.

It seems like standard practice that mobile applications are built for a certain target platform and are neither forward or backward compatible with other theoretically compatible platforms. This might seem normal for experienced mobile app developers, but it seems like a completely broken philosophy to me, especially because I come from a desktop world.

Because EGL and OpenGL ES were never meant to be used exclusively on mobile platforms, dynamically loading their entry points at runtime is the only reasonable path forward in order to support all platforms with a single implementation.

Currently, the choice between desktop OpenGL and OpenGL ES still has to be made at build configuration time, but maybe that can change in the future. I don't see any reason why they can't co-exist in a single library instance. Loading EGL and GLES entry points dynamically is the first step in this direction.

I replaced the glLoadGen loaders with loaders generated by glad, simply because glad is actually being maintained and generates stuff we can use. In order to avoid symbol conflicts with a user provided loader, the glad loader symbols have been manually prefixed with sf_ and SF_ and the loading functions all made static. This feature is likely to be built into future versions of glad.

Obviously, this change affects all platforms that SFML currently supports, and since I can only test on those I have at my disposal, it would be nice if people with access to other platforms could test to see if this change builds/runs on their system. It is not unlikely there will be crashes and weird behaviour all over the place, but that's why we test.

This would supersede #1577.

…nd GLES extensions as is done for desktop GL.
@eXpl0it3r eXpl0it3r force-pushed the feature/gles_extensions branch from e524216 to 6c75914 Compare September 1, 2019 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants