Get better OpenGL version than 2.1 on macOS by metayan · Pull Request #3895 · Genymobile/scrcpy (original) (raw)
Normally macOS gives us only OpenGL 2.1, but if we request 3.3 and create a new context, we get the best OpenGL version it has to offer.
Before: INFO: Renderer: opengl INFO: OpenGL version: 2.1 NVIDIA-14.0.32 355.11.11.10.10.143 WARN: Trilinear filtering disabled (OpenGL 3.0+ or ES 2.0+ required)
After: INFO: Renderer: opengl DEBUG: Creating GL Context INFO: OpenGL version: 4.1 NVIDIA-14.0.32 355.11.11.10.10.143 INFO: Trilinear filtering enabled
when running with --verbosity=verbose --render-driver=opengl
Note: Since SDL_CreateRenderer causes a fallback to OpenGL 2.1, the profile and version attributes have to be set and the context created after. This took a while to figure out.
This way we get the best available OpenGL version on macOS.
Explanation at Genymobile#3895
metayan deleted the get-better-opengl-version-on-macos branch
metayan restored the get-better-opengl-version-on-macos branch
rom1v pushed a commit that referenced this pull request
By default, SDL creates an OpenGL 2.1 context on macOS for an OpenGL renderer. As a consequence, mipmapping is not supported.
Force to use a core profile context, to get a higher version.
Before:
INFO: Renderer: opengl
INFO: OpenGL version: 2.1 NVIDIA-14.0.32 355.11.11.10.10.143
WARN: Trilinear filtering disabled (OpenGL 3.0+ or ES 2.0+ required)After:
INFO: Renderer: opengl
DEBUG: Creating OpenGL Core Profile context
INFO: OpenGL version: 4.1 NVIDIA-14.0.32 355.11.11.10.10.143
INFO: Trilinear filtering enabledwhen running with:
scrcpy --verbosity=debug --render-driver=openglNote: Since SDL_CreateRenderer() causes a fallback to OpenGL 2.1, the profile and version attributes have to be set and the context created after.
Signed-off-by: Romain Vimont rom@rom1v.com
metayan deleted the get-better-opengl-version-on-macos branch
rom1v pushed a commit that referenced this pull request
The field gl_context is initialized from SDL_GL_CreateContext(), which returns a raw SDL_GLContext, not a pointer.
The type mismatch was silently ignored by SDL2 because SDL_GLContext
was defined as an alias to void * (in SDL3, it is instead an alias to
struct SDL_GLContextState *, so compilation fails).
Refs #3895 <#3895> PR #6259 <#6259>
Signed-off-by: Romain Vimont rom@rom1v.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})