Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 902 Bytes

File metadata and controls

26 lines (15 loc) · 902 Bytes

How Shaders Work in OpenGL

Shaders are program that runs on our GPU. These hardware (GPU's) are designed to be much faster for specific tasks.

Two of the most used shaders are Vertex Shaders and Fragment Shaders

Some other examples of shaders are Tessellation, Geometry and Compute.

Shaders are used when the GPU start "drawing" our data.

Vertex Shader comes first than Fragment Shader. To understand this exact order we need to understand better the Render Pipeline.

Shaders work as a State Machine in OpenGL. We needs to enable/disable these Shaders.

Vertex Shaders

That gets called for every vertex that we have. "Where do we want that vertex to be?"

Fragment Shaders

a.k.a Pixel Fragment, (even though fragment and shader are a bit different in their terminologies). Runs once for each pixel that needs to be rasterized.

"Which color does this pixel needs to be?"