37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
First we start with a vertex shader.
|
|
There are a couple of intermediary processes that have to go into this, but this is good for our puposes.
|
|
Then we do Vertex Post-Processing.
|
|
Then we do primitive assembly.
|
|
Face culling (every face away will be removed).
|
|
Rasterization: convert primitives to fragments: not quite pixels, the values are interpolated
|
|
Fragment shader: Is where we can output color. Lighting, shadows.
|
|
Per-sample operations: series of thests to see if the fragment should be drawn.
|
|
Most important test is the depth test for shadows.
|
|
|
|
|
|
The most important shaders: Vertex and Fragment.
|
|
|
|
|
|
Origin of shaders. Shader programs are a group of shaders (Vertex, Tessellation, Geometry, Fragment...) associated with one another.
|
|
They are created in OpenGL with functions.
|
|
|
|
|
|
|
|
Creating a Shader program
|
|
1. Create an empty program
|
|
- glUseProgram(shader_id)
|
|
-
|
|
2. Create empty shaders
|
|
3. Attach shader source code to shaders.
|
|
4. Compile shaders.
|
|
5. Attach shaders to program.
|
|
6. Link program (creates executables from shaders and links them together).
|
|
7. Validate program (because things run on the GPU it's harder to debug).
|
|
|
|
|
|
|
|
Projections: Coordinate systems
|
|
- Local space: raw position of each vertex draw relative to origin.
|
|
- World space: position in the word itself if camery is assumed to be positioned at the origin.
|
|
|