OpenGL 3.2 以後的 pipeline
OpenGL | GLSL | info |
---|---|---|
2.0 | 1.10 | 110 |
2.1 | 1.20 | 120 |
3.0 | 1.30 | 130 |
3.1 | 1.40 | 140 |
3.2 | 1.50 | 150 |
3.3 | 3.30 | 330 |
4.0 之後以此類推 | 4.00 | 400 |
OpenGL ES | GLSL ES | WebGL | info |
---|---|---|---|
2.0 | 1.00 (GLSL 1.20) | 1.0 | 100 |
3.0 | 3.00 (GLSL 3.30) | 2.0 | 300 es |
keyword | |
---|---|
GL_ES | openGL ES |
uniform | |
gl_position | |
gl_FragColor | ES 3.0 已移除 |
conditional compilation | |
---|---|
#ifdef KEYWORD #endif |
is defined |
#ifndef KEYWORD #endif |
not defined |
precision | range | performance | quality | |
---|---|---|---|---|
highp | high precision | 16-bit floating point range: -2^62 to 2^62 integer range: -2^16 to 2^16 |
low | high |
mediump | medium precision | 10 bit floating point range: -2^14 to 2^14 integer range: -2^10 to 2^10 |
medium | medium |
lowp | low precision | 8 bit floating point range: -2 to 2 integer range: -2^8 to 2^8 |
high | low |
使用中等精度的浮點數
qualifier | |
---|---|
in | function arg read-only |
out | function arg write-only |
inout | function arg read/write |
uniform 變數由外部指定, 內部 read-only
glsl canvas 簡易測試
uniform 需要對應 glslcanvas.js 定義的名稱
native function
A varying variable must be written on a vertex shader
In the fragment shader the variable, whose value results from an interpolation of the vertex values computed previously, can only be read.
shader | access |
---|---|
vertex | write/read |
fragment | read-only |
ES 2.0 to 3.0
ES 2.0
ES 3.0 以後
輔助工具
GLSL