Remove the remaining bits of deprecated GL usage
The drawing is now completely shader based, which makes away with all usage of the depracted matrix stack. This also allows us to do things like simple translations and texture coordinate translation directly instead of doing everything indirectly through matrices. Fixed vertex attributes ('vertexPointer()' etc) are also replaced with user defined attribute arrays.
This commit is contained in:
parent
88c1489554
commit
9e63fb6b64
29 changed files with 701 additions and 295 deletions
36
shader/plane.frag
Normal file
36
shader/plane.frag
Normal file
|
@ -0,0 +1,36 @@
|
|||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform vec4 tone;
|
||||
|
||||
uniform float opacity;
|
||||
uniform vec4 color;
|
||||
uniform vec4 flash;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
const vec3 lumaF = { .299, .587, .114 };
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Sample source color */
|
||||
vec4 frag = texture2D(texture, v_texCoord);
|
||||
|
||||
/* Apply gray */
|
||||
const float luma = dot(frag.rgb, lumaF);
|
||||
frag.rgb = mix(frag.rgb, vec3(luma), tone.w);
|
||||
|
||||
/* Apply tone */
|
||||
frag.rgb += tone.rgb;
|
||||
|
||||
/* Apply opacity */
|
||||
frag.a *= opacity;
|
||||
|
||||
/* Apply color */
|
||||
frag.rgb = mix(frag.rgb, color.rgb, color.a);
|
||||
|
||||
/* Apply flash */
|
||||
frag.rgb = mix(frag.rgb, flash.rgb, flash.a);
|
||||
|
||||
gl_FragColor = frag;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue