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

remove deprecated gl_FragColor api that made compiling impossible #82

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

Conversation

iustusae
Copy link

Changed shader code to remove deprecated gl_FragColor api

The changes made to the code are intended to fix a bug that was causing the following error messages to occur:

GL version 3.3
WARNING: GLEW_ARB_debug_output is not availableERROR: could not compile GL_FRAGMENT_SHADER
ERROR: 0:8: Use of undeclared identifier 'gl_FragColor'

ERROR: failed to compile `./shaders/simple_image.frag` shader file
GL version 3.3
WARNING: GLEW_ARB_debug_output is not availableERROR: could not compile GL_FRAGMENT_SHADER
ERROR: 0:12: Use of undeclared identifier 'gl_FragColor'

ERROR: failed to compile `./shaders/simple_text.frag` shader file
GL version 3.3
WARNING: GLEW_ARB_debug_output is not availableERROR: could not compile GL_FRAGMENT_SHADER
ERROR: 0:21: Use of undeclared identifier 'gl_FragColor'

ERROR: failed to compile `./shaders/simple_epic.frag` shader file
GL version 3.3
WARNING: GLEW_ARB_debug_output is not availableERROR: could not compile GL_FRAGMENT_SHADER
ERROR: 0:21: Use of undeclared identifier 'gl_FragColor'

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

Summary of all the changes

The simple_color.frag, simple_epic.frag, simple_image.frag, and simple_text.frag files all underwent similar changes:

The API used to declare the output color variable gl_FragColor was deprecated, and the new API requires the use of an out variable.

from:
gl_FragColor = texture(image, out_uv); 

to:
out vec4 FragColor;
FragColor = texture(image, out_uv);

Thus, the out variables FragColor and out_color were declared in the modified files to replace the deprecated gl_FragColor.

These changes ensure that the output color variables are properly declared and can be used in the code without throwing any errors.

Additionally, in the simple_epic.frag file, the frag_uv variable was modified to use the out_uv variable instead of gl_FragCoord.xy / resolution.

from:
vec2 frag_uv = gl_FragCoord.xy / resolution;

to:
vec2 frag_uv = out_uv;

This change was made because gl_FragCoord.xy / resolution is deprecated in newer versions of OpenGL and may not be supported in future versions.

Using out_uv ensures that the code is compatible with current and future versions of OpenGL.

@iustusae iustusae changed the title remove deprecated gl_FragColor api remove deprecated gl_FragColor api that made compiling impossible Mar 28, 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.

None yet

1 participant