1#if defined(VERTEX)
2
3#if __VERSION__ >= 130
4#define COMPAT_VARYING out
5#define COMPAT_ATTRIBUTE in
6#define COMPAT_TEXTURE texture
7#else
8#define COMPAT_VARYING varying
9#define COMPAT_ATTRIBUTE attribute
10#define COMPAT_TEXTURE texture2D
11#endif
12
13#ifdef GL_ES
14#define COMPAT_PRECISION mediump
15#else
16#define COMPAT_PRECISION
17#endif
18
19COMPAT_ATTRIBUTE vec4 VertexCoord;
20COMPAT_ATTRIBUTE vec4 COLOR;
21COMPAT_ATTRIBUTE vec4 TexCoord;
22COMPAT_VARYING vec4 COL0;
23COMPAT_VARYING vec4 TEX0;
24
25uniform mat4 MVPMatrix;
26uniform COMPAT_PRECISION int FrameDirection;
27uniform COMPAT_PRECISION int FrameCount;
28uniform COMPAT_PRECISION vec2 OutputSize;
29uniform COMPAT_PRECISION vec2 TextureSize;
30uniform COMPAT_PRECISION vec2 InputSize;
31
32void main()
33{
34    gl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];
35    TEX0.xy = TexCoord.xy;
36}
37
38#elif defined(FRAGMENT)
39
40#if __VERSION__ >= 130
41#define COMPAT_VARYING in
42#define COMPAT_TEXTURE texture
43out vec4 FragColor;
44#else
45#define COMPAT_VARYING varying
46#define FragColor gl_FragColor
47#define COMPAT_TEXTURE texture2D
48#endif
49
50#ifdef GL_ES
51#ifdef GL_FRAGMENT_PRECISION_HIGH
52precision highp float;
53#else
54precision mediump float;
55#endif
56#define COMPAT_PRECISION mediump
57#else
58#define COMPAT_PRECISION
59#endif
60
61uniform COMPAT_PRECISION int FrameDirection;
62uniform COMPAT_PRECISION int FrameCount;
63uniform COMPAT_PRECISION vec2 OutputSize;
64uniform COMPAT_PRECISION vec2 TextureSize;
65uniform COMPAT_PRECISION vec2 InputSize;
66uniform sampler2D Texture;
67COMPAT_VARYING vec4 TEX0;
68
69void main()
70{
71    FragColor = COMPAT_TEXTURE(Texture, TEX0.xy);
72}
73#endif
74