zelda3 icon indicating copy to clipboard operation
zelda3 copied to clipboard

Fix OpenGL ES support.

Open vanfanel opened this issue 2 years ago • 1 comments

Description

This PR lets the game to be built in GLES mode, so it can run in OpenGL mode even if only OpenGL ES 3.0 is available. This is useful for Raspberry Pi and other ARM SBCs where OpenGL 3.3 is not available but GLES 3.x is, which is enough for this game and it's shaders.
Shaders are essential in this game, as it was designed to look as it does on a CRT, so bringing up GLES brings the shaders and makes the game look "as expected".

Also, GL context version is now checked via SDL2 API calls, using SDL_GL_GetAttribute(), since previous method using ParseVersionFromString() from third_party/gl_core/gl_core_3_1.c doesn't work with GLES version strings. That's because ParseVersionFromString() uses atoi() which doesn't work with GLES version strings since they start with letters instead of numbers: a typical OpenGL version string is "4.5 (Core Profile) Mesa 22.0.5" while a GLES version string looks like "OpenGL ES 3.2 Mesa 22.0.5", which confuses atoi().

Will this Pull Request break anything?

No.

Suggested Testing Steps

Build with CFLAGS="-DUSE_GLES=1" make and run the game.

vanfanel avatar Dec 12 '22 12:12 vanfanel

Thank you so much for the fix!! I can confirm that with this it is possible to use some shaders like the zfast_crt ones which are great and run smoothly on the pi 4. I suggest making a fork specific for the pi, maybe.

fac3l3ss79 avatar Feb 06 '23 22:02 fac3l3ss79