Author: davedes (posted 2012-11-11 20:50:53, viewed 406 times)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| + ------- VERT SHADER -------- +
uniform mat4 u_projView;
attribute vec4 Color;
attribute vec2 TexCoord;
attribute vec2 Position;
varying vec4 vColor;
varying vec2 vTexCoord;
void main() {
vColor = Color;
vTexCoord = TexCoord;
gl_Position = u_projView * vec4(Position.xy, 0, 1);
}
+ ------- FRAG SHADER -------- +
uniform sampler2D u_texture;
uniform sampler2D u_texture1;
uniform sampler2D u_mask;
varying vec4 vColor;
varying vec2 vTexCoord;
void main(void) {
vec4 texColor0 = texture2D(u_texture, vTexCoord);
vec4 texColor1 = texture2D(u_texture1, vTexCoord);
float mask = texture2D(u_mask, vTexCoord).a;
gl_FragColor = vColor * mix(texColor0, texColor1, mask);
} |
Special syntax:
- To highlight a line (yellow background), prefix it with '@@'
- To indicate that a line should be removed (red background), prefix it with '-'
- To indicate that a line should be added (green background), prefix it with '+'
- To post multiple snippets, seperate them by '~~~~'
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|