OpenGL official Tutorial-Shader language Overview
- OpenGL official Tutorial-Shader language Overview
- Programmable graphics hardware pipeline (pipelining)
- Programmable Vertex processor
- Programmable Geometry processor
- Programmable chip-element processor
- Language
Programmable graphics hardware pipeline (pipelining)
将 Pertransformed Vertices (每一个待转换顶点)传人 Programmable Vertex Processor (可编程的顶点处理器)得到 Transformed Vertices (转换的顶点)将 Transformed Vertices (转换的顶点)传入 Programmable Geometry Processor (可编程的几何处理器)得到 Assenbled Polygons,Lines,or Points (组装 多边形、线或点)进行 Clipping,Rasterization and Interpolation (裁剪,光栅化和插值)得到 Rasterized Pertransformed Fragments (光栅化待转换的片元[片段])传入 Programmable Fragment Processor (可编程的片元处理器)得到 Transformed Ftagment (转换的片元)进行 Raster Operations (光栅运算)进行 Pixel Update (像素更新)传入 Frame Buffer (帧缓冲区)
Programmable Vertex processor
A vertex processor is a programmable unit that operates on incoming vertex attributes such as position, color, texture coordinates, and so on. The purpose of the vertex processor is to perform traditional graphical operations such as vertex transformations, normal transformations/normalization, texture coordinate generation, and texture coordinate transformations.
The vertex processor has only one vertex as input, and only one vertex is written as the output. The topology information for the vertex is not available.
Programmable Geometry processor
The geometry processor allows access to geometric shapes (lines, triangles, quads, and so on), and it can even create new geometric shapes. However, geometry shaders are not part of the OpenGL Shader language specification. This is a multi-vendor extension (multivendor extension), and the currently available (developer) graphics card is the NVIDIA GeForce 8 series graphics card. Because this is a very important extension of the OpenGL shader language, it is mentioned in this tutorial. (If you don't want or can't use a geometry shader, simply ignore it and use a fixed-function pipeline)
Programmable chip-element processor
The chip (fragment) processor is designed to perform some traditional graphics operations. Examples include calculating interpolation, texture access, texture applications, atomization, color summation, and so on.
Language
The OpenGL shader language is somewhat similar to the C language. Both the vertex shader, the geometry shader, and the slice (fragment) shader must have an entry function "void main()"
.
I can write a full language specification here, but I think the better way is to look at the learning examples. A simple coloring source code is described in the next section. Each paragraph has a simple source code to download. Download those examples and modify it to be a good way to learn GLSL yourself by practicing!
You should also download the official GLSL language specification. You can click here to get (under "Miscellaneous Documents").
OpenGL official Tutorial-Shader language Overview