use GLAD to link OpenGL#942
Conversation
33e4364 to
ecd0b4e
Compare
|
@kblaschke I have been testing the glad integration. It's starting to shape up, I was able to run projectM with egl + gl core profile 3.3. Now I am looking at wrapping up the lifecycle management for the resolver. There are 2 options: Using glad with MX (multi-context) or without. Technically, the C api with |
|
Just keep it simple for now. I don't think a single application would use different GL implementations within the same process. Multiple GL contexts, sure, but these would all use the same GL functions and libraries. The only use for this I can imagine would be some development test application which runs projectM on multiple backends in parallel for direct comparison, but this can easily be done with several processes as well. For end users, this is an edge case nobody really needs IMO, so a single set of functions is good for now. Besides that, changing to multi-context would only require internal refactoring and no API changes as the resolver callback is already per-instance. I'd postpone this and only implement if there's a real-world demand for it. |
|
Compiled and ran, with this fix. Built with directions here: https://github.com/projectM-visualizer/projectm/blob/master/BUILDING-cmake.md?plain=1#L21-L26
M1 Mac Air |
Yeah, it's a remnant of older SDL2 releases. They've been changing the CMake config scripts multiple times over different releases, so this check might require some additional branching for older SDL releases. We can also try and find out when this behavior actually changed (probably at some point after the 2.0.16 release), and make this version the minimum build requirement. At runtime, it's not an issue as SDL2 is fully backwards compatible at the ABI/API level. |
|
The last issue that I am trying to get right is with Emscripten. Currently |
|
Turned out there is a simple way to support Emscripten/WebGL in the resolver. |
|
re-tested GLX, GLES, EGL, WGL, Emscripten and Android |
|
I think the resolver should be reasonably robust now.
|
|
Can you elaborate on how you are running on these test platforms? Is this all in the cloud? Or since this is LibProjectM; is this just testing that it compiles? May want to add some more linux targets, like different versions of deb/Ubuntu; as well as Redhat and an Arch/Bazzite exotic distro. I also think it needs testing against different GPUs, because they package their own GL libs. - Noveau, Nividia, AMD, Intel, Raspberri Pi / ARM. Great work 👍 |
|
Nothing fancy. It's a painful manual process. 2 computers, one with Mint (X11/Nvidia) and Ubuntu (Wayland/AMD) and dual-boot Windows. I am starting up the sdl-test-ui everywhere, build with and without gles, and let it render a preset. Also running gstreamer for testing. I got the Android example updated, using that to test Android, build the app, run on an ARM emulator. For Emscripten I got the example running. So I actually start them up and look if it renders. |
|
ANGLE can be pulled in via vcpkg and CMake, so it requires a few changes to the build files, but it's to quick to. |
26f5646 to
110bb98
Compare
110bb98 to
00686f7
Compare
|
Building on Linux with GLX/X11 still gives me linker errors: There are two possible solutions I could imagine:
I'd personally go with 1, see my suggestion below for a quick fix. |
| if(WIN32) | ||
| find_package(OpenGL REQUIRED) | ||
| set(PROJECTM_OPENGL_LIBRARIES OpenGL::GL) |
There was a problem hiding this comment.
Is this really required on Windows? glad should load opengl32.dll from the OS, which is exactly what we'd link here.
There was a problem hiding this comment.
yes, for some reason, it appears to be a hard requirement to link opengl32.dll on Windows for desktop GL.
src/api/include/projectM-4/core.h
Outdated
| * NULL if the instance could not be created successfully. | ||
| * @since 4.2.0 | ||
| */ | ||
| PROJECTM_EXPORT projectm_handle projectm_create_with_opengl_load_proc(void* (*load_proc)(const char*, void*), void* user_data); |
There was a problem hiding this comment.
I'd suggest to define a typedef for the load_proc callback, as it's easier to read/find, we can add specific Doxygen documentation for the callback there and it can be used as a type in proxy functions if needed.
See callbacks.h for examples.
|
Tested everything at least on Linux, works just fine! One little edit I've overlooked so far: now that GLEW is gone, the Windows-only dependency should be removed from the After that, I guess we are ready merge it. Any small issues popping up, if there are any, can be fixed later. |
749c7f9 to
f1c4761
Compare
…, glx 1.4, loader=true, alias=true, extensions=none)
9ea85ec to
59bf8f9
Compare
59bf8f9 to
b75b318
Compare
replace OpenGL depencencies with GLAD add GL resolver, GL probe, GLAD loader remove GLEW
b75b318 to
bb40fc8
Compare
|
Testing done. Retested Linux (GLX, EGL, Angle+Vulkan, GLES) on X11 and Wayland in some combinations, Windows (WGL, GLES, Angle), Android, Emscripten, Gstreamer, SDL2. One thing to note is that some environments provide GLES 3.1 only (the Android emulator I used, Angle on Windows). |
Changes
Test status - OS/GL API
Test status - framework integrations
closes #681