Up next


OpenGL Fragment Shaders | How Do Fragment Shaders Work?

7 Views
an_object_is_a
an_object_is_a
subs count
43
Published on 17 Dec 2019 / In How-to & Style

How are fragment shaders actually working?
More than one color on screen?
Why so difficult?

This series is based off of the free on-line book, "The Book Of Shaders", by Patricio Gonzalez Vivo and Jen Lowe.
https://thebookofshaders.com/
If you feel like donating, please donate to those two; a donation link is found on their website linked above.

Previous video: https://www.mgtow.tv/watch/ope....ngl-fragment-shaders

Editor used: https://patriciogonzalezvivo.github.io/glslEditor/

Code used:

1.

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;

void main() {
vec2 st = gl_FragCoord.xy/u_resolution;

if (st.x >= 0.500 && st.x <= 0.503 && st.y >= 0.500 && st.y <= 0.503) {
gl_FragColor = vec4(1.,1.0,1.0,1.0);
} else {
gl_FragColor = vec4(0.,0.0,0.0,1.0);
}
}

2.

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;

void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec3 canvas = vec3(1.0);

canvas = mix(canvas, vec3(1.0,0.0,0.0), st.x);
gl_FragColor = vec4(canvas, 1.0);
}

Subscribe to my channel: https://www.mgtow.tv/@an_object_is_a

If you find value in what I do, think about supporting my channel: https://www.paypal.me/anobjisa

Find me here:
Youtube: https://www.youtube.com/channe....l/UCar-9GMCRk9QdKJXq
Bitchute: https://www.bitchute.com/channel/gPUmRsVcChxX/
Twitter: https://twitter.com/anobjectisa1
Minds: https://www.minds.com/an_object_is_a/
Instagram: https://www.instagram.com/an_object_is_a/

Show more
0 Comments sort Sort By


Up next