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

Brightness.frag fails to load visual studio 2017 #10

Open
dburchill opened this issue Aug 6, 2018 · 1 comment
Open

Brightness.frag fails to load visual studio 2017 #10

dburchill opened this issue Aug 6, 2018 · 1 comment

Comments

@dburchill
Copy link

sample code compiled with visual studio 2017 fails to load shader, to fix change Brightness.frag line 12
from:
sourceFragment *= clamp(luminance - Threshold, 0.0, 1.0) * Factor;
to:
sourceFragment *= clamp(luminance - Threshold, 0.f, 1.f) * Factor;

@Bromeon
Copy link
Member

Bromeon commented Jun 23, 2019

That's strange, because both 0.0 and 1.0 are float literals in GLSL, and also the expression luminance - Threshold is float.

Do you know what OpenGL/GLSL versions you have?

Context:

uniform sampler2D source;

const float Threshold = 0.7;
const float Factor   = 4.0;

void main()
{
	vec4 sourceFragment = texture2D(source, gl_TexCoord[0].xy);
	float luminance = sourceFragment.r * 0.2126 + sourceFragment.g * 0.7152 + sourceFragment.b * 0.0722;
	sourceFragment *= clamp(luminance - Threshold, 0.0, 1.0) * Factor;
	gl_FragColor = sourceFragment;
}

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

No branches or pull requests

2 participants