In this tutorial, I cover the implementation of shaders in our code.
Precursor video: • Ncurses Render Engine Tutorial (Precursor)...
Github: https://github.com/youngbrycecode/Ren...
DataList.h (copy and paste this): https://github.com/youngbrycecode/Ren...
Shader: Code thats run many times during the render process allowing easy customization for various stages of the render process
Vertex Shader: Run on each vertex. Outputs the final position of the vertex as a Vector4.
Fragment Shader: Modifies the color of each pixel which is rendered. Used for lighitng, reflections, refractions, water, etc.
Uniforms: Used to update shader data in real time without modifying buffer data which is usually stored in a location in memory which is hard or slow to modify. Uniforms are typically used to update an object's location, or the camera's position/projection.
VertexArrayObject: Stores vertex data about an object. Can be used in a similar way as a uniform, but should generally be set once and not updated again unless necessary. The information here can be used to calculate the final position of a vertex in the vertex shader, but calculated data may also be interpolated and passed to the fragment shader in the same way.
Chapters:
0:00 Introduction
0:32 Minor bug fixes
2:07 DataList
3:19 Shaders
10:41 Render Context
12:57 Vertex Array Object
22:19 Using the interface
26:50 Creating vertex shader