1 | [vert.glsl] |
---|

2 | |
---|

3 | #version 130 |
---|

4 | |
---|

5 | attribute vec3 in_Position; |
---|

6 | attribute vec2 in_TexCoord; |
---|

7 | varying vec2 pass_TexCoord; |
---|

8 | |
---|

9 | uniform mat4 proj_matrix; |
---|

10 | uniform mat4 view_matrix; |
---|

11 | uniform mat4 model_matrix; |
---|

12 | |
---|

13 | void main() |
---|

14 | { |
---|

15 | gl_Position = proj_matrix * view_matrix * model_matrix |
---|

16 | * vec4(in_Position, 1.0); |
---|

17 | pass_TexCoord = in_TexCoord; |
---|

18 | } |
---|

19 | |
---|

20 | [frag.glsl] |
---|

21 | |
---|

22 | #version 130 |
---|

23 | |
---|

24 | #if defined GL_ES |
---|

25 | precision mediump float; |
---|

26 | #endif |
---|

27 | |
---|

28 | uniform sampler2D in_Texture; |
---|

29 | uniform vec2 in_TexSize; |
---|

30 | varying vec2 pass_TexCoord; |
---|

31 | |
---|

32 | void main() |
---|

33 | { |
---|

34 | vec4 col = texture2D(in_Texture, pass_TexCoord); |
---|

35 | gl_FragColor = mix(col, vec4(1.0, 1.0, 0.0, 1.0), 0.5); |
---|

36 | } |
---|

37 | |
---|

38 | [vert.hlsl] |
---|

39 | |
---|

40 | void main(float4 in_Position : POSITION, |
---|

41 | float2 in_TexCoord : TEXCOORD0, |
---|

42 | uniform float4x4 proj_matrix, |
---|

43 | uniform float4x4 view_matrix, |
---|

44 | uniform float4x4 model_matrix, |
---|

45 | uniform float2 in_TexSize, |
---|

46 | out float2 out_TexCoord : TEXCOORD0, |
---|

47 | out float4 out_Position : POSITION) |
---|

48 | { |
---|

49 | #if _XBOX |
---|

50 | float2 delta = float2(-0.5, -0.5) / in_TexSize; |
---|

51 | #else |
---|

52 | float2 delta = float2(0.0, 0.0); |
---|

53 | #endif |
---|

54 | out_Position = mul(proj_matrix, mul(view_matrix, mul(model_matrix, in_Position))); |
---|

55 | out_TexCoord = in_TexCoord + delta; |
---|

56 | } |
---|

57 | |
---|

58 | [frag.hlsl] |
---|

59 | |
---|

60 | void main(float2 in_TexCoord : TEXCOORD0, |
---|

61 | uniform sampler2D in_Texture, |
---|

62 | out float4 out_FragColor : COLOR) |
---|

63 | { |
---|

64 | float4 col = tex2D(in_Texture, in_TexCoord); |
---|

65 | out_FragColor = col; |
---|

66 | } |
---|

67 | |
---|