Replaced deprecated texture2D() function by texture()

This commit is contained in:
raysan5
2016-01-16 12:53:48 +01:00
parent 183795b8aa
commit 03c82605a0
13 changed files with 57 additions and 57 deletions

View File

@ -18,23 +18,23 @@ void main()
{ {
for (int j = -3; j < 3; j++) for (int j = -3; j < 3; j++)
{ {
sum += texture2D(texture0, fragTexCoord + vec2(j, i)*0.004) * 0.25; sum += texture(texture0, fragTexCoord + vec2(j, i)*0.004) * 0.25;
} }
} }
if (texture2D(texture0, fragTexCoord).r < 0.3) if (texture(texture0, fragTexCoord).r < 0.3)
{ {
tc = sum*sum*0.012 + texture2D(texture0, fragTexCoord); tc = sum*sum*0.012 + texture(texture0, fragTexCoord);
} }
else else
{ {
if (texture2D(texture0, fragTexCoord).r < 0.5) if (texture(texture0, fragTexCoord).r < 0.5)
{ {
tc = sum*sum*0.009 + texture2D(texture0, fragTexCoord); tc = sum*sum*0.009 + texture(texture0, fragTexCoord);
} }
else else
{ {
tc = sum*sum*0.0075 + texture2D(texture0, fragTexCoord); tc = sum*sum*0.0075 + texture(texture0, fragTexCoord);
} }
} }

View File

@ -9,20 +9,20 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
const float renderWidth = 1280; const float renderWidth = 1280.0;
const float renderHeight = 720; const float renderHeight = 720.0;
float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); float offset[3] = float[](0.0, 1.3846153846, 3.2307692308);
float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703);
void main() void main()
{ {
vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight[0]; vec3 tc = texture(texture0, fragTexCoord).rgb*weight[0];
for (int i = 1; i < 3; i++) for (int i = 1; i < 3; i++)
{ {
tc += texture2D(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; tc += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i];
tc += texture2D(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; tc += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i];
} }
fragColor = vec4(tc, 1.0); fragColor = vec4(tc, 1.0);

View File

@ -9,16 +9,16 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
float hatchOffsetY = 5.0f; float hatchOffsetY = 5.0;
float lumThreshold01 = 0.9f; float lumThreshold01 = 0.9;
float lumThreshold02 = 0.7f; float lumThreshold02 = 0.7;
float lumThreshold03 = 0.5f; float lumThreshold03 = 0.5;
float lumThreshold04 = 0.3f; float lumThreshold04 = 0.3;
void main() void main()
{ {
vec3 tc = vec3(1.0, 1.0, 1.0); vec3 tc = vec3(1.0, 1.0, 1.0);
float lum = length(texture2D(texture0, fragTexCoord).rgb); float lum = length(texture(texture0, fragTexCoord).rgb);
if (lum < lumThreshold01) if (lum < lumThreshold01)
{ {

View File

@ -9,10 +9,10 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
const float renderWidth = 1280; const float renderWidth = 1280.0;
const float renderHeight = 720; const float renderHeight = 720.0;
float stitchingSize = 6.0f; float stitchingSize = 6.0;
uniform int invert = 0; uniform int invert = 0;
@ -35,11 +35,11 @@ vec4 PostFX(sampler2D tex, vec2 uv)
if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y)))))
{ {
if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0); if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0);
else c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; else c = texture(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4;
} }
else else
{ {
if (invert == 1) c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; if (invert == 1) c = texture(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4;
else c = vec4(0.0, 0.0, 0.0, 1.0); else c = vec4(0.0, 0.0, 0.0, 1.0);
} }

View File

@ -11,21 +11,21 @@ uniform vec4 fragTintColor;
void main() void main()
{ {
vec4 color = texture2D(texture0, fragTexCoord); vec4 color = texture(texture0, fragTexCoord);
color += texture2D(texture0, fragTexCoord + 0.001); color += texture(texture0, fragTexCoord + 0.001);
color += texture2D(texture0, fragTexCoord + 0.003); color += texture(texture0, fragTexCoord + 0.003);
color += texture2D(texture0, fragTexCoord + 0.005); color += texture(texture0, fragTexCoord + 0.005);
color += texture2D(texture0, fragTexCoord + 0.007); color += texture(texture0, fragTexCoord + 0.007);
color += texture2D(texture0, fragTexCoord + 0.009); color += texture(texture0, fragTexCoord + 0.009);
color += texture2D(texture0, fragTexCoord + 0.011); color += texture(texture0, fragTexCoord + 0.011);
color += texture2D(texture0, fragTexCoord - 0.001); color += texture(texture0, fragTexCoord - 0.001);
color += texture2D(texture0, fragTexCoord - 0.003); color += texture(texture0, fragTexCoord - 0.003);
color += texture2D(texture0, fragTexCoord - 0.005); color += texture(texture0, fragTexCoord - 0.005);
color += texture2D(texture0, fragTexCoord - 0.007); color += texture(texture0, fragTexCoord - 0.007);
color += texture2D(texture0, fragTexCoord - 0.009); color += texture(texture0, fragTexCoord - 0.009);
color += texture2D(texture0, fragTexCoord - 0.011); color += texture(texture0, fragTexCoord - 0.011);
color.rgb = vec3((color.r + color.g + color.b)/3.0); color.rgb = vec3((color.r + color.g + color.b)/3.0);
color = color/9.5; color = color/9.5;

View File

@ -13,7 +13,7 @@ const float PI = 3.1415926535;
void main() void main()
{ {
float aperture = 178.0f; float aperture = 178.0;
float apertureHalf = 0.5 * aperture * (PI / 180.0); float apertureHalf = 0.5 * aperture * (PI / 180.0);
float maxFactor = sin(apertureHalf); float maxFactor = sin(apertureHalf);
@ -36,5 +36,5 @@ void main()
uv = fragTexCoord.xy; uv = fragTexCoord.xy;
} }
fragColor = texture2D(texture0, uv); fragColor = texture(texture0, uv);
} }

View File

@ -11,7 +11,7 @@ uniform vec4 fragTintColor;
void main() void main()
{ {
vec4 base = texture2D(texture0, fragTexCoord)*fragTintColor; vec4 base = texture(texture0, fragTexCoord)*fragTintColor;
// Convert to grayscale using NTSC conversion weights // Convert to grayscale using NTSC conversion weights
float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114)); float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114));

View File

@ -9,11 +9,11 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
const float renderWidth = 1280; const float renderWidth = 1280.0;
const float renderHeight = 720; const float renderHeight = 720.0;
uniform float pixelWidth = 5.0f; uniform float pixelWidth = 5.0;
uniform float pixelHeight = 5.0f; uniform float pixelHeight = 5.0;
void main() void main()
{ {
@ -22,7 +22,7 @@ void main()
vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy)); vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy));
vec3 tc = texture2D(texture0, coord).rgb; vec3 tc = texture(texture0, coord).rgb;
fragColor = vec4(tc, 1.0); fragColor = vec4(tc, 1.0);
} }

View File

@ -9,12 +9,12 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
float gamma = 0.6f; float gamma = 0.6;
float numColors = 8.0f; float numColors = 8.0;
void main() void main()
{ {
vec3 color = texture2D(texture0, fragTexCoord.xy).rgb; vec3 color = texture(texture0, fragTexCoord.xy).rgb;
color = pow(color, vec3(gamma, gamma, gamma)); color = pow(color, vec3(gamma, gamma, gamma));
color = color*numColors; color = color*numColors;

View File

@ -11,7 +11,7 @@ uniform vec4 fragTintColor;
void main() void main()
{ {
vec3 color = texture2D(texture0, fragTexCoord).rgb; vec3 color = texture(texture0, fragTexCoord).rgb;
vec3 colors[3]; vec3 colors[3];
colors[0] = vec3(0.0, 0.0, 1.0); colors[0] = vec3(0.0, 0.0, 1.0);
colors[1] = vec3(1.0, 1.0, 0.0); colors[1] = vec3(1.0, 1.0, 0.0);

View File

@ -9,8 +9,8 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
float offset = 0; float offset = 0.0;
float frequency = 720/3.0; float frequency = 720.0/3.0;
uniform float time; uniform float time;
@ -21,7 +21,7 @@ void main (void)
float tval = 0; //time float tval = 0; //time
vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval)); vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval));
vec4 color = texture2D(texture0, fragTexCoord); vec4 color = texture(texture0, fragTexCoord);
color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0); color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0);
color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y); color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y);
@ -35,7 +35,7 @@ void main (void)
float globalPos = (fragTexCoord.y + offset) * frequency; float globalPos = (fragTexCoord.y + offset) * frequency;
float wavePos = cos((fract(globalPos) - 0.5)*3.14); float wavePos = cos((fract(globalPos) - 0.5)*3.14);
vec4 color = texture2D(texture0, fragTexCoord); vec4 color = texture(texture0, fragTexCoord);
fragColor = mix(vec4(0, 0.3, 0, 0), color, wavePos); fragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos);
} }

View File

@ -9,13 +9,13 @@ uniform vec4 fragTintColor;
// NOTE: Add here your custom variables // NOTE: Add here your custom variables
const float renderWidth = 1280; const float renderWidth = 1280.0;
const float renderHeight = 720; const float renderHeight = 720.0;
float radius = 250.0; float radius = 250.0;
float angle = 0.8; float angle = 0.8;
uniform vec2 center = vec2(200, 200); uniform vec2 center = vec2(200.0, 200.0);
void main (void) void main (void)
{ {
@ -35,7 +35,7 @@ void main (void)
} }
tc += center; tc += center;
vec3 color = texture2D(texture0, tc/texSize).rgb; vec3 color = texture(texture0, tc/texSize).rgb;
fragColor = vec4(color, 1.0);; fragColor = vec4(color, 1.0);;
} }

View File

@ -11,7 +11,7 @@ uniform vec4 fragTintColor;
void main() void main()
{ {
vec4 texelColor = texture2D(texture0, fragTexCoord); vec4 texelColor = texture(texture0, fragTexCoord);
// NOTE: Implement here your fragment shader code // NOTE: Implement here your fragment shader code