The Wayback Machine - https://web.archive.org/web/20200405185128/https://github.com/libgdx/libgdx/pull/5960
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

Updated default shaders for OpenGL 3.2 core profile #5960

Open
wants to merge 8 commits into
base: master
from

Conversation

@crykn
Copy link
Contributor

crykn commented Mar 20, 2020

Mac OS only supports the OpenGL 3.2 core profile for OpenGL 3. As core profiles are not backward compatible, this leads to compilation issues with the default shaders in libGDX. This PR adds updated versions of all default shaders and only applies them when using OpenGL 3 on Mac OS.

Furthermore a gwt-compatible PlatformUtils class was added to determine whether the current system is a mac. The need for a class like this was already indicated elsewhere, as the available UIUtils is a Scene2D class.


Progress in the past: The shader compilation problem in the OpenGL 3.2. core profile is nothing new and was, for example, discussed in this context. At least for SpriteBatch, work on an updated default shader was already begun. However, those changes where never merged nor did they cover all default shaders in libgdx.

To test these changes: Just create a new libGDX project or open an already existing one on Mac OS. Then set the useGL30-flag to true (this only works with the lwjgl3 background, as libgdx doesn't allow you to use a core profile with lwjgl2). You may have to set ShaderProgram.preprendVertex/FragmentCode to #version 150 \n, as this is the only supported shader version for Mac and OpenGL 3. Then use any of your favourite classes that has a default shader (SpriteBatch, ShapeRenderer, etc.). Without the PR this will fail, as the shader cannot be compiled - with this PR everything works fine.

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

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.