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

Declare fragment shader outputs, improving compatibility (macOS) #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fabjan
Copy link

@fabjan fabjan commented Feb 18, 2023

Problem

The build went fine without warnings or errors on my Mac, but the shaders cannot be compiled:

❯ ./ded     
GL version 3.3
WARNING: GLEW_ARB_debug_output is not availableERROR: could not compile GL_FRAGMENT_SHADER
ERROR: 0:6: Use of undeclared identifier 'gl_FragColor'

ERROR: failed to compile `./shaders/simple_color.frag` shader file

Is the program written for a different GL version than what macOS 11.7.2 provides perhaps (see caveats)?

Solution

Update each of the shaders/simple_*.frag programs to stop using gl_FragColor, instead declare out vec4 fragColor; and use that.

Fixes #65.

Compare for this fix in dlangui:

buggins/dlangui@6cfe98a#diff-0671d7c48bc6543434a3b3c9b6671be5b41902e679cfa0520fa7f0c780d670e4L231

Caveats

I don't write many graphical programs. Perhaps macOS is always a pain and you don't want to support it. Given that build.sh contains a uname check for "Darwin" though, I'm giving it a shot.

I used the following versions of the dependencies (latest in Homebrew):

  • sdl2 2.26.3
  • freetype 2.13.0
  • glew 2.2.0_1

@fabjan fabjan changed the title Declare fragment shader outputs Declare fragment shader outputs, improving compatibility (macOS) Feb 18, 2023
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.

GL issues on macOS 11.7.2
1 participant