texture2D is deprecated, use texture instead

This commit is contained in:
Vincent Lejeune 2014-01-19 18:53:35 +01:00
parent 496146b617
commit fb6649eaad
59 changed files with 171 additions and 171 deletions

View File

@ -7,7 +7,7 @@ in vec2 uv;
void main()
{
vec3 weights = vec3(0.2126, 0.7152, 0.0722); // ITU-R BT. 709
vec3 col = texture2D(tex, uv).xyz;
vec3 col = texture(tex, uv).xyz;
float luma = dot(weights, col);
col *= smoothstep(low, 0.9, luma);

View File

@ -5,7 +5,7 @@ in vec2 uv;
void main()
{
vec4 col = texture2D(tex, uv);
vec4 col = texture(tex, uv);
col.xyz *= 10.0 * col.a;

View File

@ -4,7 +4,7 @@ uniform sampler2D tex;
void main()
{
vec4 col = texture2D(tex, gl_TexCoord[0].xy);
vec4 col = texture(tex, gl_TexCoord[0].xy);
if (col.a < 0.5)
discard;

View File

@ -21,6 +21,6 @@ in vec2 uv;
void main()
{
gl_FragColor = texture2D(tex, uv);
gl_FragColor = texture(tex, uv);
gl_FragColor.a *= transparency;
}

View File

@ -8,9 +8,9 @@ void main()
{
vec2 tc = gl_TexCoord[0].xy;
vec3 col = texture2D(tex, tc).xyz;
float caustic = texture2D(caustictex, tc + dir).x;
float caustic2 = texture2D(caustictex, (tc.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
vec3 col = texture(tex, tc).xyz;
float caustic = texture(caustictex, tc + dir).x;
float caustic2 = texture(caustictex, (tc.yx + dir2 * vec2(-0.6, 0.3)) * vec2(0.6)).x;
col += caustic * caustic2 * 10.0;

View File

@ -14,13 +14,13 @@ void main()
for (int i = 0; i < size; i++)
{
float col = texture2D(tex, tc).x;
float col = texture(tex, tc).x;
res = max(col, res);
tc += pixel;
}
float old = texture2D(oldtex, gl_TexCoord[0].xy).x;
float old = texture(oldtex, gl_TexCoord[0].xy).x;
gl_FragColor = vec4(mix(old, res, 0.7));
}

View File

@ -11,7 +11,7 @@ void main()
//texc.y = 1.0 - texc.y;
vec4 col = texture2D(tex, texc);
vec4 col = texture(tex, texc);
//col = col / (1 - col);

View File

@ -4,7 +4,7 @@ uniform sampler2D tex;
void main()
{
float alpha = texture2D(tex, gl_TexCoord[0].xy).a;
float alpha = texture(tex, gl_TexCoord[0].xy).a;
if (alpha < 0.5)
discard;

View File

@ -1,11 +1,11 @@
#version 130
uniform sampler2D texture;
uniform sampler2D tex;
in vec2 uv;
in vec4 col;
void main()
{
vec4 res = texture2D(texture, uv);
vec4 res = texture(tex, uv);
gl_FragColor = vec4(res.xyz * col.xyz, res.a);
}

View File

@ -15,8 +15,8 @@ void main()
vec4 col = vec4(0.0);
const float maxlen = 0.02;
float horiz = texture2D(tex, tc + dir).x;
float vert = texture2D(tex, (tc.yx + dir2) * vec2(0.9)).x;
float horiz = texture(tex, tc + dir).x;
float vert = texture(tex, (tc.yx + dir2) * vec2(0.9)).x;
vec2 offset = vec2(horiz, vert);
offset *= 2.0;

View File

@ -14,7 +14,7 @@ in vec2 uv;
void main()
{
float z = texture2D(tex, uv).a;
float z = texture(tex, uv).a;
vec3 tmp = vec3(gl_TexCoord[0].xy, z);
tmp = tmp * 2.0 - 1.0;

View File

@ -12,11 +12,11 @@ void main()
float X = uv.x;
float Y = uv.y;
sum += texture2D(tex, vec2(X - 3.0 * pixel.x, Y)) * 0.03125;
sum += texture2D(tex, vec2(X - 1.3333 * pixel.x, Y)) * 0.328125;
sum += texture2D(tex, vec2(X, Y)) * 0.273438;
sum += texture2D(tex, vec2(X + 1.3333 * pixel.x, Y)) * 0.328125;
sum += texture2D(tex, vec2(X + 3.0 * pixel.x, Y)) * 0.03125;
sum += texture(tex, vec2(X - 3.0 * pixel.x, Y)) * 0.03125;
sum += texture(tex, vec2(X - 1.3333 * pixel.x, Y)) * 0.328125;
sum += texture(tex, vec2(X, Y)) * 0.273438;
sum += texture(tex, vec2(X + 1.3333 * pixel.x, Y)) * 0.328125;
sum += texture(tex, vec2(X + 3.0 * pixel.x, Y)) * 0.03125;
gl_FragColor = sum;
}

View File

@ -12,11 +12,11 @@ void main()
float X = uv.x;
float Y = uv.y;
sum += texture2D(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125;
sum += texture2D(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125;
sum += texture2D(tex, vec2(X, Y)) * 0.273438;
sum += texture2D(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125;
sum += texture2D(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125;
sum += texture(tex, vec2(X, Y - 3.0 * pixel.y)) * 0.03125;
sum += texture(tex, vec2(X, Y - 1.3333 * pixel.y)) * 0.328125;
sum += texture(tex, vec2(X, Y)) * 0.273438;
sum += texture(tex, vec2(X, Y + 1.3333 * pixel.y)) * 0.328125;
sum += texture(tex, vec2(X, Y + 3.0 * pixel.y)) * 0.03125;
gl_FragColor = sum;
}

View File

@ -12,13 +12,13 @@ void main()
float X = uv.x;
float Y = uv.y;
sum += texture2D(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869;
sum += texture2D(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture2D(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481;
sum += texture2D(tex, vec2(X, Y)) * 0.209473;
sum += texture2D(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481;
sum += texture2D(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture2D(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869;
sum += texture(tex, vec2(X - 5.13333 * pixel.x, Y)) * 0.00640869;
sum += texture(tex, vec2(X - 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture(tex, vec2(X - 1.4 * pixel.x, Y)) * 0.305481;
sum += texture(tex, vec2(X, Y)) * 0.209473;
sum += texture(tex, vec2(X + 1.4 * pixel.x, Y)) * 0.305481;
sum += texture(tex, vec2(X + 3.26667 * pixel.x, Y)) * 0.083313;
sum += texture(tex, vec2(X + 5.13333 * pixel.x, Y)) * 0.00640869;
gl_FragColor = sum;
}

View File

@ -12,13 +12,13 @@ void main()
float X = uv.x;
float Y = uv.y;
sum += texture2D(tex, vec2(X, Y - 5.13333 * pixel.y)) * 0.00640869;
sum += texture2D(tex, vec2(X, Y - 3.26667 * pixel.y)) * 0.083313;
sum += texture2D(tex, vec2(X, Y - 1.4 * pixel.y)) * 0.305481;
sum += texture2D(tex, vec2(X, Y)) * 0.209473;
sum += texture2D(tex, vec2(X, Y + 1.4 * pixel.y)) * 0.305481;
sum += texture2D(tex, vec2(X, Y + 3.26667 * pixel.y)) * 0.083313;
sum += texture2D(tex, vec2(X, Y + 5.13333 * pixel.y)) * 0.00640869;
sum += texture(tex, vec2(X, Y - 5.13333 * pixel.y)) * 0.00640869;
sum += texture(tex, vec2(X, Y - 3.26667 * pixel.y)) * 0.083313;
sum += texture(tex, vec2(X, Y - 1.4 * pixel.y)) * 0.305481;
sum += texture(tex, vec2(X, Y)) * 0.209473;
sum += texture(tex, vec2(X, Y + 1.4 * pixel.y)) * 0.305481;
sum += texture(tex, vec2(X, Y + 3.26667 * pixel.y)) * 0.083313;
sum += texture(tex, vec2(X, Y + 5.13333 * pixel.y)) * 0.00640869;
gl_FragColor = sum;
}

View File

@ -7,7 +7,7 @@ void main()
{
vec2 coords = uv;
vec4 col = texture2D(tex, coords);
vec4 col = texture(tex, coords);
float alpha = col.a;
if (alpha < 0.04 || length(col.xyz) < 0.2) discard;

View File

@ -4,7 +4,7 @@ uniform vec3 col;
void main()
{
vec4 res = texture2D(tex, gl_TexCoord[0].xy);
vec4 res = texture(tex, gl_TexCoord[0].xy);
// Keep the sun fully bright, but fade the sky
float mul = distance(res.xyz, col);

View File

@ -15,12 +15,12 @@ void main()
vec2 dist = tosun * 1.0/(float(SAMPLES) * 1.12);
vec3 col = texture2D(tex, texc).xyz;
vec3 col = texture(tex, texc).xyz;
float decay = 1.0;
for (int i = 0; i < SAMPLES; i++) {
texc += dist;
vec3 here = texture2D(tex, texc).xyz;
vec3 here = texture(tex, texc).xyz;
here *= decay;
col += here;
decay *= decaystep;

View File

@ -8,7 +8,7 @@ in vec2 uv;
void main()
{
gl_FragData[0] = texture2D(tex, uv);
gl_FragData[0] = texture(tex, uv);
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
gl_FragData[2] = vec4(0.);
}

View File

@ -30,7 +30,7 @@ noperspective in vec3 normal;
void main()
{
float inter = dot(normal, eyeVec);
float m = texture2D(tex, vec2(0.5, uv.y)).r;
float m = texture(tex, vec2(0.5, uv.y)).r;
inter = 1.0 - inter;
float alpha = inter + 1.0;// * m;

View File

@ -32,7 +32,7 @@ noperspective in vec3 normal;
void main()
{
float inter = dot(normal, eyeVec);
float m = texture2D(tex, vec2(0.5, uv.y)).r;
float m = texture(tex, vec2(0.5, uv.y)).r;
float alpha = inter * inter * inter * inter * m;
gl_FragColor = vec4(1.0, 1.0, 0.8, alpha);

View File

@ -11,10 +11,10 @@ void main()
{
vec2 texc = uv;
vec3 diffuse = texture2D(diffuse, texc).xyz;
vec3 spec = texture2D(specular, texc).xyz;
float specmap = texture2D(specular_map, texc).x;
float ao = texture2D(ambient_occlusion, texc).x;
vec3 diffuse = texture(diffuse, texc).xyz;
vec3 spec = texture(specular, texc).xyz;
float specmap = texture(specular_map, texc).x;
float ao = texture(ambient_occlusion, texc).x;
gl_FragColor = vec4(diffuse + spec * specmap + ao * ambient, 1.0);
}

View File

@ -44,7 +44,7 @@ void main() {
float mixer = fract(mip);
vec4 mixcol = mix(levels[lowmip], levels[highmip], mixer);
vec4 tcol = texture2D(tex, gl_TexCoord[0].xy);
vec4 tcol = texture(tex, gl_TexCoord[0].xy);
vec3 col = mix(tcol.xyz, mixcol.xyz, mixcol.a);

View File

@ -77,7 +77,7 @@ vec2 Area(vec2 distance, float e1, float e2) {
void main() {
vec4 areas = vec4(0.0);
vec2 e = texture2D(edgesMap, gl_TexCoord[0].xy).rg;
vec2 e = texture(edgesMap, gl_TexCoord[0].xy).rg;
if (e.g != 0.0) { // Edge at north

View File

@ -11,11 +11,11 @@ void main() {
/**
* Luma calculation requires gamma-corrected colors:
*/
float L = dot(texture2D(colorMapG, uv).rgb, weights);
float Lleft = dot(texture2D(colorMapG, offset[0].xy).rgb, weights);
float Ltop = dot(texture2D(colorMapG, offset[0].zw).rgb, weights);
float Lright = dot(texture2D(colorMapG, offset[1].xy).rgb, weights);
float Lbottom = dot(texture2D(colorMapG, offset[1].zw).rgb, weights);
float L = dot(texture(colorMapG, uv).rgb, weights);
float Lleft = dot(texture(colorMapG, offset[0].xy).rgb, weights);
float Ltop = dot(texture(colorMapG, offset[0].zw).rgb, weights);
float Lright = dot(texture(colorMapG, offset[1].xy).rgb, weights);
float Lbottom = dot(texture(colorMapG, offset[1].zw).rgb, weights);
vec4 delta = abs(vec4(L) - vec4(Lleft, Ltop, Lright, Lbottom));
vec4 edges = step(vec4(threshold), delta);

View File

@ -7,9 +7,9 @@ uniform sampler2D colorMap;
void main() {
// Fetch the blending weights for current pixel:
vec4 topLeft = texture2D(blendMap, uv);
float bottom = texture2D(blendMap, offset[1].zw).g;
float right = texture2D(blendMap, offset[1].xy).a;
vec4 topLeft = texture(blendMap, uv);
float bottom = texture(blendMap, offset[1].zw).g;
float right = texture(blendMap, offset[1].xy).a;
vec4 a = vec4(topLeft.r, bottom, topLeft.b, right);
// Up to 4 lines can be crossing a pixel (one in each edge). So, we perform
@ -25,11 +25,11 @@ void main() {
vec4 color = vec4(0.0);
// Add the contributions of the possible 4 lines that can cross this pixel:
vec4 C = texture2D(colorMap, uv);
vec4 Cleft = texture2D(colorMap, offset[0].xy);
vec4 Ctop = texture2D(colorMap, offset[0].zw);
vec4 Cright = texture2D(colorMap, offset[1].xy);
vec4 Cbottom = texture2D(colorMap, offset[1].zw);
vec4 C = texture(colorMap, uv);
vec4 Cleft = texture(colorMap, offset[0].xy);
vec4 Ctop = texture(colorMap, offset[0].zw);
vec4 Cright = texture(colorMap, offset[1].xy);
vec4 Cbottom = texture(colorMap, offset[1].zw);
color = mix(C, Ctop, a.r) * w.r + color;
color = mix(C, Cbottom, a.g) * w.g + color;
color = mix(C, Cleft, a.b) * w.b + color;

View File

@ -49,7 +49,7 @@ void main()
vec2 texcoords = gl_TexCoord[0].st;
// Sample the color buffer
vec3 color = texture2D(color_buffer, texcoords).rgb;
vec3 color = texture(color_buffer, texcoords).rgb;
// Compute the blur direction.
// IMPORTANT: we don't normalize it so that it avoids a glitch around 'center',
@ -74,7 +74,7 @@ void main()
vec2 blur_texcoords = texcoords + inc_vec;
for(int i=1 ; i < NB_SAMPLES ; i++)
{
color += texture2D(color_buffer, blur_texcoords).rgb;
color += texture(color_buffer, blur_texcoords).rgb;
blur_texcoords += inc_vec;
}
color /= vec3(NB_SAMPLES);

View File

@ -4,8 +4,8 @@ uniform sampler2D tex2;
void main()
{
vec4 col1 = texture2D(tex1, gl_TexCoord[0].xy);
vec4 col2 = vec4(vec3(texture2D(tex2, gl_TexCoord[0].xy).x), 1.0);
vec4 col1 = texture(tex1, gl_TexCoord[0].xy);
vec4 col2 = vec4(vec3(texture(tex2, gl_TexCoord[0].xy).x), 1.0);
gl_FragColor = col1 * col2;
}

View File

@ -8,7 +8,7 @@ in vec2 uv;
void main()
{
// normal in Tangent Space
vec3 TS_normal = 2.0 * texture2D (normalMap, uv).rgb - 1.0;
vec3 TS_normal = 2.0 * texture (normalMap, uv).rgb - 1.0;
// Because of interpolation, we need to renormalize
vec3 Frag_tangent = normalize(tangent);
vec3 Frag_normal = normalize(cross(Frag_tangent, bitangent));

View File

@ -10,10 +10,10 @@ in vec2 uv;
void main(void)
{
vec2 tc = gl_FragCoord.xy / screen;
vec4 color = texture2D(Albedo, uv);
vec3 DiffuseComponent = texture2D(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture2D(SpecularMap, tc).xyz;
float ao = texture2D(SSAO, tc).x;
vec4 color = texture(Albedo, uv);
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
gl_FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -14,11 +14,11 @@ void main() {
vec4 col;
if (haslightmap != 0) {
light = texture2D(lighttex, uv1);
light = texture(lighttex, uv1);
}
if (hastex != 0)
col = texture2D(tex, uv0) * light;
col = texture(tex, uv0) * light;
else
col = color;

View File

@ -10,7 +10,7 @@ in vec2 uv1;
void main() {
//if (hastex != 0) {
vec4 col = texture2D(tex, uv0);
vec4 col = texture(tex, uv0);
if (col.a < 0.5)
discard;

View File

@ -13,7 +13,7 @@ void main() {
vec4 color;
if (hastex != 0) {
vec4 col = texture2D(tex, gl_TexCoord[0].xy);
vec4 col = texture(tex, gl_TexCoord[0].xy);
if (col.a < 0.1)
discard;

View File

@ -15,7 +15,7 @@ void main() {
vec3 normal_y = normalize(vec3(0.0, nor.y, nor.z));
float sin_theta_y = length(cross( forward, normal_y )) * nor.y / abs(nor.y);
vec4 detail0 = texture2D(tex, 0.5 * vec2(sin_theta_x, sin_theta_y) + 0.5);
vec4 detail0 = texture(tex, 0.5 * vec2(sin_theta_x, sin_theta_y) + 0.5);
gl_FragColor = vec4(detail0.xyz, 1.);
}

View File

@ -5,7 +5,7 @@ noperspective in vec3 nor;
in vec2 uv;
void main() {
vec4 col = texture2D(tex, uv);
vec4 col = texture(tex, uv);
if (col.a < 0.5)
discard;
gl_FragColor = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);

View File

@ -9,12 +9,12 @@ in vec2 uv;
void main(void)
{
vec4 color = texture2D(Albedo, uv);
vec4 color = texture(Albedo, uv);
if (color.a < 0.5) discard;
vec2 tc = gl_FragCoord.xy / screen;
vec3 DiffuseComponent = texture2D(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture2D(SpecularMap, tc).xyz;
float ao = texture2D(SSAO, tc).x;
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent;
gl_FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -1,5 +1,5 @@
#version 130
uniform sampler2D texture;
uniform sampler2D tex;
uniform sampler2D normals_and_depth;
uniform mat4 invproj;
uniform vec2 screen;
@ -13,13 +13,13 @@ void main(void)
{
vec2 xy = gl_FragCoord.xy / screen;
float FragZ = gl_FragCoord.z;
float EnvZ = texture2D(normals_and_depth, xy).a;
float EnvZ = texture(normals_and_depth, xy).a;
vec4 FragmentPos = invproj * (2. * vec4(xy, FragZ, 1.0) - 1.);
FragmentPos /= FragmentPos.w;
vec4 EnvPos = invproj * (2. * vec4(xy, EnvZ, 1.0) - 1.);
EnvPos /= EnvPos.w;
float len = dot(vec3(1.0), abs(texture2D(normals_and_depth, xy).xyz));
float len = dot(vec3(1.0), abs(texture(normals_and_depth, xy).xyz));
float alpha = (len < 0.2) ? 1. : clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.);
color = texture2D(texture, tc);
color = texture(tex, tc);
color.a *= alpha * smoothstep(1., 0.8, lf);
}

View File

@ -3,5 +3,5 @@ uniform sampler2D tex;
void main()
{
gl_FragColor = texture2D(tex, gl_TexCoord[0].xy);
gl_FragColor = texture(tex, gl_TexCoord[0].xy);
}

View File

@ -13,37 +13,37 @@ void main()
float width = 0.0;
float zsum = 0.00001;
tmp = texture2D(tex, vec2(X - 5.13333 * pixel.x, Y));
tmp = texture(tex, vec2(X - 5.13333 * pixel.x, Y));
sum += tmp.x * 0.00640869;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X - 3.26667 * pixel.x, Y));
tmp = texture(tex, vec2(X - 3.26667 * pixel.x, Y));
sum += tmp.x * 0.083313;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X - 1.4 * pixel.x, Y));
tmp = texture(tex, vec2(X - 1.4 * pixel.x, Y));
sum += tmp.x * 0.305481;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y));
tmp = texture(tex, vec2(X, Y));
sum += tmp.x * 0.209473;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X + 1.4 * pixel.x, Y));
tmp = texture(tex, vec2(X + 1.4 * pixel.x, Y));
sum += tmp.x * 0.305481;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X + 3.26667 * pixel.x, Y));
tmp = texture(tex, vec2(X + 3.26667 * pixel.x, Y));
sum += tmp.x * 0.083313;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X + 5.13333 * pixel.x, Y));
tmp = texture(tex, vec2(X + 5.13333 * pixel.x, Y));
sum += tmp.x * 0.00640869;
zsum += tmp.z;
width += tmp.y;

View File

@ -13,37 +13,37 @@ void main()
float width = 0.0;
float zsum = 0.00001;
tmp = texture2D(tex, vec2(X, Y - 5.13333 * pixel.y));
tmp = texture(tex, vec2(X, Y - 5.13333 * pixel.y));
sum += tmp.x * 0.00640869;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y - 3.26667 * pixel.y));
tmp = texture(tex, vec2(X, Y - 3.26667 * pixel.y));
sum += tmp.x * 0.083313;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y - 1.4 * pixel.y));
tmp = texture(tex, vec2(X, Y - 1.4 * pixel.y));
sum += tmp.x * 0.305481;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y));
tmp = texture(tex, vec2(X, Y));
sum += tmp.x * 0.209473;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 1.4 * pixel.y));
tmp = texture(tex, vec2(X, Y + 1.4 * pixel.y));
sum += tmp.x * 0.305481;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 3.26667 * pixel.y));
tmp = texture(tex, vec2(X, Y + 3.26667 * pixel.y));
sum += tmp.x * 0.083313;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 5.13333 * pixel.y));
tmp = texture(tex, vec2(X, Y + 5.13333 * pixel.y));
sum += tmp.x * 0.00640869;
zsum += tmp.z;
width += tmp.y;

View File

@ -12,7 +12,7 @@ in vec2 uv;
void main() {
vec2 texc = uv;
float z = texture2D(ntex, texc).a;
float z = texture(ntex, texc).a;
vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0f;
xpos = invproj * xpos;
@ -29,7 +29,7 @@ void main() {
float att = energy[i] * 200. / (4. * 3.14 * d * d);
float spec_att = (energy[i] + 10.) * 200. / (4. * 3.14 * d * d);
vec3 norm = texture2D(ntex, texc).xyz;
vec3 norm = texture(ntex, texc).xyz;
norm = (norm - 0.5) * 2.0;
// Light Direction

View File

@ -10,14 +10,14 @@ void main()
{
vec2 tc = uv;
vec4 shiftval = texture2D(dtex, tc) / vec4(50.0);
vec4 shiftval = texture(dtex, tc) / vec4(50.0);
vec2 shift;
shift.x = -shiftval.x + shiftval.y;
shift.y = -shiftval.z + shiftval.w;
tc += shift;
vec4 newcol = texture2D(tex, tc);
vec4 newcol = texture(tex, tc);
if (viz < 1)
{

View File

@ -8,13 +8,13 @@ void main()
{
vec2 xy = gl_FragCoord.xy / screen;
float FragZ = gl_FragCoord.z;
float EnvZ = texture2D(normals_and_depth, xy).a;
float EnvZ = texture(normals_and_depth, xy).a;
vec4 FragmentPos = invproj * (2. * vec4(xy, FragZ, 1.0) - 1.);
FragmentPos /= FragmentPos.w;
vec4 EnvPos = invproj * (2. * vec4(xy, EnvZ, 1.0) - 1.);
EnvPos /= EnvPos.w;
float len = dot(vec3(1.0), abs(texture2D(normals_and_depth, xy).xyz));
float len = dot(vec3(1.0), abs(texture(normals_and_depth, xy).xyz));
float alpha = (len < 0.2) ? 1. : clamp((EnvPos.z - FragmentPos.z) * 0.3, 0., 1.);
gl_FragColor = texture2D(tex, gl_PointCoord.xy);
gl_FragColor = texture(tex, gl_PointCoord.xy);
gl_FragColor.a *= alpha;
}

View File

@ -6,9 +6,9 @@ uniform sampler2D eighth;
void main()
{
vec3 val[3];
val[0] = texture2D(halft, gl_TexCoord[0].xy).xyz;
val[1] = texture2D(quarter, gl_TexCoord[0].xy).xyz;
val[2] = texture2D(eighth, gl_TexCoord[0].xy).xyz;
val[0] = texture(halft, gl_TexCoord[0].xy).xyz;
val[1] = texture(quarter, gl_TexCoord[0].xy).xyz;
val[2] = texture(eighth, gl_TexCoord[0].xy).xyz;
// Find the first level with a penumbra value
int i;

View File

@ -13,7 +13,7 @@ float luminanceImp()
if (low > 0) return 1.0;
const vec3 weights = vec3(0.2126, 0.7152, 0.0722); // ITU-R BT. 709
vec3 col = texture2D(ctex, texc).xyz;
vec3 col = texture(ctex, texc).xyz;
float luma = dot(weights, col);
@ -51,7 +51,7 @@ float depthImp(float linearz)
void main()
{
vec4 ntmp = texture2D(ntex, texc);
vec4 ntmp = texture(ntex, texc);
vec3 normal = ntmp.xyz * 2.0 - 1.0;
float linearz = ntmp.a;

View File

@ -13,7 +13,7 @@ float decdepth(vec4 rgba) {
void main()
{
texc = gl_Vertex.xy / vec2(32767.0);
float z = decdepth(vec4(texture2D(dtex, texc).xyz, 0.0));
float z = decdepth(vec4(texture(dtex, texc).xyz, 0.0));
vec3 tmp = vec3(texc, z);
tmp = tmp * 2.0 - 1.0;

View File

@ -17,7 +17,7 @@ vec4 encdepth(float v) {
void main() {
if (hastex != 0) {
float alpha = texture2D(tex, uv).a;
float alpha = texture(tex, uv).a;
if (alpha < 0.5)
discard;
@ -31,7 +31,7 @@ void main() {
if (wireframe > 0)
gl_FragColor = vec4(1.0);
else
gl_FragColor = texture2D(tex, uv);
gl_FragColor = texture(tex, uv);
}
}

View File

@ -15,8 +15,8 @@ void main()
vec2 tc = pos.xy * vec2(0.5) + vec2(0.5);
float movex = decdepth(texture2D(warpx, tc));
float movey = decdepth(texture2D(warpy, tc));
float movex = decdepth(texture(warpx, tc));
float movey = decdepth(texture(warpy, tc));
float dx = movex * 2.0 - 1.0;
float dy = movey * 2.0 - 1.0;

View File

@ -22,7 +22,7 @@ void main()
for (int i = 0; i < size; i++)
{
float col = texture2D(tex, tc).x;
float col = texture(tex, tc).x;
lower += col * step(tc.x, origtc.x);
total += col;

View File

@ -22,7 +22,7 @@ void main()
for (int i = 0; i < size; i++)
{
float col = texture2D(tex, tc).x;
float col = texture(tex, tc).x;
lower += col * step(tc.y, origtc.y);
total += col;

View File

@ -32,26 +32,26 @@ void main()
vec3 V = normalize(vertex);
vec3 L = normalize(vec3(sun_pos));
vec3 col = texture2D(tex, vec2((L.y + 1.0) / 2.0, V.y)).xyz;
vec3 col = texture(tex, vec2((L.y + 1.0) / 2.0, V.y)).xyz;
float vl = clamp(dot(V, L), 0., 1.);
float paint = texture2D(tex, uv_temp * 3).a;
float paint = texture(tex, uv_temp * 3).a;
uv_temp += 20;
//float paint2 = texture2D(tex, uv_temp * 5).a;
//float paint2 = texture(tex, uv_temp * 5).a;
float paint2 = texture2D(tex, uv * 5.).a;
float paint2 = texture(tex, uv * 5.).a;
// Get the general cloud mask
float hello = texture2D(glow_tex, (uv_cl + paint2 * 0.07) *2.).g;
float hello = texture(glow_tex, (uv_cl + paint2 * 0.07) *2.).g;
float cld_mask = texture2D(glow_tex, (uv_anim + hello * 0.007 )).r;
float cld_mask = texture(glow_tex, (uv_anim + hello * 0.007 )).r;
vec2 fast = vec2(-uv_fast.x, uv_fast.y);// + (hello * 0.007);
float cld_fast = texture2D(glow_tex, fast ).r;
float cld_fast = texture(glow_tex, fast ).r;

View File

@ -15,11 +15,11 @@ in vec2 uv_bis;
void main() {
// Splatting part
vec4 splatting = texture2D(tex_layout, uv_bis);
vec4 detail0 = texture2D(tex_detail0, uv);
vec4 detail1 = texture2D(tex_detail1, uv);
vec4 detail2 = texture2D(tex_detail2, uv);
vec4 detail3 = texture2D(tex_detail3, uv);
vec4 splatting = texture(tex_layout, uv_bis);
vec4 detail0 = texture(tex_detail0, uv);
vec4 detail1 = texture(tex_detail1, uv);
vec4 detail2 = texture(tex_detail2, uv);
vec4 detail3 = texture(tex_detail3, uv);
vec4 detail4 = vec4(0.0);
vec4 splatted = splatting.r * detail0 +
@ -28,9 +28,9 @@ void main() {
(1.0 - splatting.r - splatting.g - splatting.b) * detail3;
vec2 tc = gl_FragCoord.xy / screen;
vec3 DiffuseComponent = texture2D(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture2D(SpecularMap, tc).xyz;
float ao = texture2D(SSAO, tc).x;
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent;
gl_FragColor = vec4(splatted.xyz * LightFactor, 1.);

View File

@ -21,8 +21,8 @@ float rand(vec2 co)
void main(void)
{
vec4 cur = texture2D(normals_and_depth, uv);
float curdepth = texture2D(normals_and_depth, uv).a;
vec4 cur = texture(normals_and_depth, uv);
float curdepth = texture(normals_and_depth, uv).a;
vec4 FragPos = invprojm * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f);
FragPos /= FragPos.w;
@ -50,7 +50,7 @@ void main(void)
bool isInsideTexture = (sampleProj.x > -1.) && (sampleProj.x < 1.) && (sampleProj.y > -1.) && (sampleProj.y < 1.);
// get the depth of the occluder fragment
float occluderFragmentDepth = texture2D(normals_and_depth, (sampleProj.xy * 0.5) + 0.5).a;
float occluderFragmentDepth = texture(normals_and_depth, (sampleProj.xy * 0.5) + 0.5).a;
// Position of the occluder fragment in worldSpace
vec4 occluderPos = invprojm * vec4(sampleProj.xy, 2.0 * occluderFragmentDepth - 1.0, 1.0f);
occluderPos /= occluderPos.w;

View File

@ -12,7 +12,7 @@ uniform vec2 wind;
void main() {
vec2 texc = gl_FragCoord.xy / screen;
float z = texture2D(ntex, texc).a;
float z = texture(ntex, texc).a;
vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0;
xpos = invproj * xpos;
xpos.xyz /= xpos.w;
@ -25,7 +25,7 @@ void main() {
return;
}
vec3 norm = texture2D(ntex, texc).xyz;
vec3 norm = texture(ntex, texc).xyz;
norm = (norm - 0.5) * 2.0;
// Normalized on the cpu
@ -41,7 +41,7 @@ void main() {
if (hasclouds == 1)
{
vec2 cloudcoord = (xpos.xz * 0.00833333) + wind;
float cloud = texture2D(cloudtex, cloudcoord).x;
float cloud = texture(cloudtex, cloudcoord).x;
//float cloud = step(0.5, cloudcoord.x) * step(0.5, cloudcoord.y);
outcol *= cloud;

View File

@ -22,7 +22,7 @@ float decdepth(vec4 rgba) {
void main() {
vec2 texc = gl_FragCoord.xy / screen;
vec4 depthread = texture2D(dtex, texc);
vec4 depthread = texture(dtex, texc);
float z = decdepth(vec4(depthread.xyz, 0.0));
if (z < 0.03)
@ -33,7 +33,7 @@ void main() {
return;
}
vec3 norm = texture2D(ntex, texc).xyz;
vec3 norm = texture(ntex, texc).xyz;
norm = (norm - 0.5) * 2.0;
// Normalized on the cpu
@ -55,7 +55,7 @@ void main() {
if (hasclouds == 1)
{
vec2 cloudcoord = (xpos.xz * 0.00833333) + wind;
float cloud = texture2D(cloudtex, cloudcoord).x;
float cloud = texture(cloudtex, cloudcoord).x;
//float cloud = step(0.5, cloudcoord.x) * step(0.5, cloudcoord.y);
outcol *= cloud;
@ -65,13 +65,13 @@ void main() {
vec3 shadowcoord = (shadowmat * vec4(xpos.xyz, 1.0)).xyz;
shadowcoord = (shadowcoord * 0.5) + vec3(0.5);
float movex = decdepth(texture2D(warpx, shadowcoord.xy));
float movey = decdepth(texture2D(warpy, shadowcoord.xy));
float movex = decdepth(texture(warpx, shadowcoord.xy));
float movey = decdepth(texture(warpy, shadowcoord.xy));
float dx = movex * 2.0 - 1.0;
float dy = movey * 2.0 - 1.0;
shadowcoord.xy += vec2(dx, dy);
vec4 shadowread = texture2D(shadowtex, shadowcoord.xy);
vec4 shadowread = texture(shadowtex, shadowcoord.xy);
float shadowmapz = decdepth(vec4(shadowread.xyz, 0.0));
float moved = (abs(dx) + abs(dy)) * 0.5;
@ -94,10 +94,10 @@ void main() {
bias = clamp(bias, 0.001, abi);
// This ID, and four IDs around this must match for a shadow pixel
float right = texture2D(shadowtex, shadowcoord.xy + vec2(shadowoffset, 0.0)).a;
float left = texture2D(shadowtex, shadowcoord.xy + vec2(-shadowoffset, 0.0)).a;
float up = texture2D(shadowtex, shadowcoord.xy + vec2(0.0, shadowoffset)).a;
float down = texture2D(shadowtex, shadowcoord.xy + vec2(0.0, -shadowoffset)).a;
float right = texture(shadowtex, shadowcoord.xy + vec2(shadowoffset, 0.0)).a;
float left = texture(shadowtex, shadowcoord.xy + vec2(-shadowoffset, 0.0)).a;
float up = texture(shadowtex, shadowcoord.xy + vec2(0.0, shadowoffset)).a;
float down = texture(shadowtex, shadowcoord.xy + vec2(0.0, -shadowoffset)).a;
float matching = ((right + left + up + down) * 0.25) - shadowread.a;
matching = abs(matching) * 400.0;

View File

@ -1,9 +1,9 @@
#version 130
uniform sampler2D texture;
uniform sampler2D tex;
in vec2 uv;
void main()
{
gl_FragColor = texture2D(texture, uv);
gl_FragColor = texture(tex, uv);
}

View File

@ -16,8 +16,8 @@ in vec2 uv;
void main()
{
// lookup normal from normal map, move from [0,1] to [-1, 1] range, normalize
vec3 normal = 2.0 * texture2D (BumpTex1, uv + delta1).rgb - 1.0;
vec3 normal2 = 2.0 * texture2D (BumpTex2, uv + delta2).rgb - 1.0;
vec3 normal = 2.0 * texture (BumpTex1, uv + delta1).rgb - 1.0;
vec3 normal2 = 2.0 * texture (BumpTex2, uv + delta2).rgb - 1.0;
// scale normals
normal.y = 4.0*normal.y;
@ -30,7 +30,7 @@ void main()
vec4 diffuseMaterial;
vec4 diffuseLight;
diffuseMaterial = texture2D (DecalTex, uv + vec2(delta1.x, 0.0));
diffuseMaterial = texture (DecalTex, uv + vec2(delta1.x, 0.0));
diffuseLight = vec4(1.0, 1.0, 1.0, 1.0);
vec3 col = diffuseMaterial.xyz * (0.3 + lamberFactor*0.7);

View File

@ -299,7 +299,7 @@ void bindUniformToTextureUnit(GLuint location, GLuint texid, unsigned textureUni
static GLuint TexturedQuadShader;
static GLuint TexturedQuadAttribPosition;
static GLuint TexturedQuadAttribTexCoord;
static GLuint TexturedQuadUniformTexture;
static GLuint TexturedQuadUniformTex;
static GLuint TexturedQuadUniformCenter;
static GLuint TexturedQuadUniformSize;
static GLuint TexturedQuadUniformTexcenter;
@ -311,7 +311,7 @@ static GLuint ColorTexturedQuadShader;
static GLuint ColorTexturedQuadAttribPosition;
static GLuint ColorTexturedQuadAttribTexCoord;
static GLuint ColorTexturedQuadAttribColor;
static GLuint ColorTexturedQuadUniformTexture;
static GLuint ColorTexturedQuadUniformTex;
static GLuint ColorTexturedQuadUniformCenter;
static GLuint ColorTexturedQuadUniformSize;
static GLuint ColorTexturedQuadUniformTexcenter;
@ -336,7 +336,7 @@ static void drawTexColoredQuad(const video::ITexture *texture, const video::SCol
ColorTexturedQuadAttribPosition = glGetAttribLocation(ColorTexturedQuadShader, "position");
ColorTexturedQuadAttribTexCoord = glGetAttribLocation(ColorTexturedQuadShader, "texcoord");
ColorTexturedQuadAttribColor = glGetAttribLocation(ColorTexturedQuadShader, "color");
ColorTexturedQuadUniformTexture = glGetUniformLocation(ColorTexturedQuadShader, "texture");
ColorTexturedQuadUniformTex = glGetUniformLocation(ColorTexturedQuadShader, "tex");
ColorTexturedQuadUniformCenter = glGetUniformLocation(ColorTexturedQuadShader, "center");
ColorTexturedQuadUniformSize = glGetUniformLocation(ColorTexturedQuadShader, "size");
ColorTexturedQuadUniformTexcenter = glGetUniformLocation(ColorTexturedQuadShader, "texcenter");
@ -359,7 +359,7 @@ static void drawTexColoredQuad(const video::ITexture *texture, const video::SCol
glBindVertexArray(CTQvao);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, static_cast<const irr::video::COpenGLTexture*>(texture)->getOpenGLTextureName());
glUniform1i(ColorTexturedQuadUniformTexture, 0);
glUniform1i(ColorTexturedQuadUniformTex, 0);
glUniform2f(ColorTexturedQuadUniformCenter, center_pos_x, center_pos_y);
glUniform2f(ColorTexturedQuadUniformSize, width, height);
glUniform2f(ColorTexturedQuadUniformTexcenter, tex_center_pos_x, tex_center_pos_y);
@ -378,7 +378,7 @@ void drawTexQuad(const video::ITexture *texture, float width, float height,
TexturedQuadAttribPosition = glGetAttribLocation(TexturedQuadShader, "position");
TexturedQuadAttribTexCoord = glGetAttribLocation(TexturedQuadShader, "texcoord");
TexturedQuadUniformTexture = glGetUniformLocation(TexturedQuadShader, "texture");
TexturedQuadUniformTex = glGetUniformLocation(TexturedQuadShader, "tex");
TexturedQuadUniformCenter = glGetUniformLocation(TexturedQuadShader, "center");
TexturedQuadUniformSize = glGetUniformLocation(TexturedQuadShader, "size");
TexturedQuadUniformTexcenter = glGetUniformLocation(TexturedQuadShader, "texcenter");
@ -396,7 +396,7 @@ void drawTexQuad(const video::ITexture *texture, float width, float height,
glBindVertexArray(TQvao);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, static_cast<const irr::video::COpenGLTexture*>(texture)->getOpenGLTextureName());
glUniform1i(TexturedQuadUniformTexture, 0);
glUniform1i(TexturedQuadUniformTex, 0);
glUniform2f(TexturedQuadUniformCenter, center_pos_x, center_pos_y);
glUniform2f(TexturedQuadUniformSize, width, height);
glUniform2f(TexturedQuadUniformTexcenter, tex_center_pos_x, tex_center_pos_y);

View File

@ -90,7 +90,7 @@ namespace SimpleParticleRender
{
GLuint Program;
GLuint attrib_pos, attrib_lf, attrib_quadcorner, attrib_texcoord, attrib_sz;
GLuint uniform_matrix, uniform_viewmatrix, uniform_texture, uniform_normal_and_depths, uniform_screen, uniform_invproj;
GLuint uniform_matrix, uniform_viewmatrix, uniform_tex, uniform_normal_and_depths, uniform_screen, uniform_invproj;
void init()
{
@ -105,7 +105,7 @@ namespace SimpleParticleRender
uniform_matrix = glGetUniformLocation(Program, "ProjectionMatrix");
uniform_viewmatrix = glGetUniformLocation(Program, "ViewMatrix");
uniform_texture = glGetUniformLocation(Program, "texture");
uniform_tex = glGetUniformLocation(Program, "tex");
uniform_invproj = glGetUniformLocation(Program, "invproj");
uniform_screen = glGetUniformLocation(Program, "screen");
uniform_normal_and_depths = glGetUniformLocation(Program, "normals_and_depth");
@ -116,7 +116,7 @@ namespace FlipParticleRender
{
GLuint Program;
GLuint attrib_pos, attrib_lf, attrib_quadcorner, attrib_texcoord, attrib_sz, attrib_rotationvec, attrib_anglespeed;
GLuint uniform_matrix, uniform_viewmatrix, uniform_texture, uniform_normal_and_depths, uniform_screen, uniform_invproj;
GLuint uniform_matrix, uniform_viewmatrix, uniform_tex, uniform_normal_and_depths, uniform_screen, uniform_invproj;
void init()
{
@ -132,7 +132,7 @@ namespace FlipParticleRender
uniform_matrix = glGetUniformLocation(Program, "ProjectionMatrix");
uniform_viewmatrix = glGetUniformLocation(Program, "ViewMatrix");
uniform_texture = glGetUniformLocation(Program, "texture");
uniform_tex = glGetUniformLocation(Program, "tex");
uniform_invproj = glGetUniformLocation(Program, "invproj");
uniform_screen = glGetUniformLocation(Program, "screen");
uniform_normal_and_depths = glGetUniformLocation(Program, "normals_and_depth");
@ -592,7 +592,7 @@ void ParticleSystemProxy::drawFlip()
(float)UserConfigParams::m_height
};
bindUniformToTextureUnit(FlipParticleRender::uniform_texture, texture, 0);
bindUniformToTextureUnit(FlipParticleRender::uniform_tex, texture, 0);
bindUniformToTextureUnit(FlipParticleRender::uniform_normal_and_depths, normal_and_depth, 1);
glUniformMatrix4fv(FlipParticleRender::uniform_invproj, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
@ -661,7 +661,7 @@ void ParticleSystemProxy::drawNotFlip()
(float)UserConfigParams::m_height
};
bindUniformToTextureUnit(SimpleParticleRender::uniform_texture, texture, 0);
bindUniformToTextureUnit(SimpleParticleRender::uniform_tex, texture, 0);
bindUniformToTextureUnit(SimpleParticleRender::uniform_normal_and_depths, normal_and_depth, 1);
glUniformMatrix4fv(SimpleParticleRender::uniform_invproj, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());