source: trunk/tutorial/08_fbo.lolfx @ 1730

Last change on this file since 1730 was 1730, checked in by sam, 8 years ago

tutorial: make the FBO example display something at last, so we can port
it to DirectX.

File size: 1.0 KB
Line 
1-- GLSL.Vert --
2
3#version 120
4
5attribute vec2 in_Position;
6
7varying vec2 pass_Position;
8
9void main()
10{
11    pass_Position = in_Position;
12    gl_Position = vec4(in_Position, 0.0, 1.0);
13}
14
15-- GLSL.Frag --
16
17#version 120
18
19uniform sampler2D in_Texture;
20uniform float in_Flag;
21uniform vec3 in_Point;
22uniform vec3 in_Color;
23
24varying vec2 pass_Position;
25
26void main(void)
27{
28    if (in_Flag == 0.0)
29    {
30        float s = 4.0 + 4.0 * in_Point.z;
31        vec2 p = pass_Position - in_Point.xy * 0.8;
32        float f = clamp(1.0 - dot(s * p, s * p), 0.0, 1.0);
33        f = sqrt(f);
34        gl_FragColor = vec4(f * in_Color, f + 0.1);
35    }
36    else
37    {
38        vec2 texcoords = pass_Position * 0.5 + vec2(0.5, 0.5);
39        gl_FragColor = vec4(texture2D(in_Texture, texcoords).xyz, 1.0);
40    }
41}
42
43-- HLSL.Vert --
44
45void main(float2 in_Position : POSITION,
46          out float4 out_Position : POSITION)
47{
48    out_Position = float4(in_Position, 0.0, 1.0);
49}
50
51-- HLSL.Frag --
52
53void main(out float4 out_FragColor : COLOR)
54{
55    out_FragColor = float4(0.7, 0.2, 0.5, 1.0);
56}
57
Note: See TracBrowser for help on using the repository browser.