Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop GLEW in favour of built-in GLAD #418

Closed
wants to merge 2 commits into from
Closed

Drop GLEW in favour of built-in GLAD #418

wants to merge 2 commits into from

Conversation

mlauss2
Copy link
Contributor

@mlauss2 mlauss2 commented Jun 27, 2024

Drop GLEW in favor of GLAD-generated built-in loader.

  • This drops an extra external library dependency (glew)
  • On Linux no system OpenGL libraries/headers are required to build TFE any more
  • All the platform specific stuff (windowing, library loading, symbol
    resolution) is now fully handled by SDL2, no more wayland workarounds necessary (i.e. Added workaround for GLEW on wayland #386 )

The GLAD loader is GL4.6, while TFE's minimum is still GL3.3;
the Anisotropy stuff, which is core GL4.5, has been wrapped around
availability of EXT_texture_filter_anisotropic (which most GL2
drivers support).

This PR also updates ImGUI to version 1.90.9 because after the current in-tree 1.72 it also dropped GLEW.

This should also fix #395 which was caused by TFE explicitly linking to an OpenGL library, which, after this PR, is no longer necessary.

After applying this PR, the dependencies change to:

-Shared library: [libOpenGL.so.0]
-Shared library: [libGLX.so.0]
-Shared library: [libGLU.so.1]
-Shared library: [libGLEW.so.2.2]
-Shared library: [libGL.so.1]
-Shared library: [libX11.so.6]
 Shared library: [libSDL2-2.0.so.0]
 Shared library: [libSDL2_image-2.0.so.0]
 Shared library: [librtmidi.so.7]

i.e. no explicit dependency on OpenGL and windowing system, just SDL2.

Another nice sideeffect at least on Linux is that "zink" (OpenGL over Vulkan) also works now:
image
Performance on my radeon is about 66% of the direct opengl path.

@mlauss2 mlauss2 marked this pull request as draft June 28, 2024 05:11
@mlauss2 mlauss2 marked this pull request as ready for review June 28, 2024 07:35
@mlauss2 mlauss2 mentioned this pull request Jul 8, 2024
@mlauss2 mlauss2 marked this pull request as draft July 9, 2024 07:42
@mlauss2
Copy link
Contributor Author

mlauss2 commented Jul 9, 2024

editor needs more imgui fixing

Update ImGUI to 1.90.9
Fix up all ImGUI interface changes
Add the diff for the custom TFE widgets to contrib/
@mlauss2
Copy link
Contributor Author

mlauss2 commented Jul 9, 2024

I fixed up the non-opening modal windows in the editor.

@mlauss2 mlauss2 marked this pull request as ready for review July 9, 2024 10:06
Add a GLAD-generated opengl loader to the OpenGL renderbackend, to
remove the dependency on external GLEW.

This should not be noticeable on Windows, but is beneficial on Linux
for several reasons:
- at build time, no system opengl libraries and headers are required.
- TFE does no longer have any built-in OpenGL or windowing system
  dependecy, just SDL2.
- at run time, OpenGL is loaded by the system SDL, which also handles
  all the ugly windowing system (X11/Wayland/KMS/...) and platform
  (Linux/BSD/...) stuff.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
@mlauss2
Copy link
Contributor Author

mlauss2 commented Jul 13, 2024

I've also now tested this successfully on Windows as well.

@mlauss2
Copy link
Contributor Author

mlauss2 commented Jul 15, 2024

I've split the 2 patches into separate PRs (with #421 to start)

@mlauss2 mlauss2 closed this Jul 15, 2024
@mlauss2 mlauss2 deleted the noglew2 branch July 15, 2024 08:15
@luciusDXL
Copy link
Owner

I don't have any specific attachment to GLEW (other than using it in several projects), so this seems fine. I will patch it in after the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Linux] Native Linux version launch but black screen
2 participants