Tech ENABLE_LEGACY_OPENGL_REMOVAL - A few refactorings and fixes

This commit is contained in:
enricoturri1966 2022-03-22 08:18:39 +01:00
parent a2a9281ec8
commit 9be3d926c5
7 changed files with 30 additions and 26 deletions

View file

@ -6,5 +6,5 @@ in vec2 tex_coord;
void main()
{
gl_FragColor = texture2D(uniform_texture, tex_coord);
gl_FragColor = texture(uniform_texture, tex_coord);
}

View file

@ -74,7 +74,7 @@ void main()
#ifdef ENABLE_ENVIRONMENT_MAP
if (use_environment_tex)
gl_FragColor = vec4(0.45 * texture2D(environment_tex, normalize(eye_normal).xy * 0.5 + 0.5).xyz + 0.8 * color * intensity.x, alpha);
gl_FragColor = vec4(0.45 * texture(environment_tex, normalize(eye_normal).xy * 0.5 + 0.5).xyz + 0.8 * color * intensity.x, alpha);
else
#endif
gl_FragColor = vec4(vec3(intensity.y) + color * intensity.x, alpha);

View file

@ -1,4 +1,4 @@
#version 110
#version 140
uniform sampler2D Texture;
@ -7,5 +7,5 @@ in vec4 Frag_Color;
void main()
{
gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);
gl_FragColor = Frag_Color * texture(Texture, Frag_UV.st);
}

View file

@ -12,7 +12,7 @@ in vec2 tex_coord;
vec4 svg_color()
{
// takes foreground from texture
vec4 fore_color = texture2D(texture, tex_coord);
vec4 fore_color = texture(texture, tex_coord);
// calculates radial gradient
vec3 back_color = vec3(mix(back_color_light, back_color_dark, smoothstep(0.0, 0.5, length(abs(tex_coord.xy) - vec2(0.5)))));
@ -24,7 +24,7 @@ vec4 svg_color()
vec4 non_svg_color()
{
// takes foreground from texture
vec4 color = texture2D(texture, tex_coord);
vec4 color = texture(texture, tex_coord);
return vec4(color.rgb, transparent_background ? color.a * 0.25 : color.a);
}

View file

@ -34,8 +34,8 @@ void main()
// Sample the Z texture. Texture coordinates are normalized to <0, 1>.
vec4 color = vec4(0.25, 0.25, 0.25, 1.0);
if (z_texture_row >= 0.0)
color = mix(texture2D(z_texture, vec2(z_texture_col, z_texture_row_to_normalized * (z_texture_row + 0.5 )), -10000.),
texture2D(z_texture, vec2(z_texture_col, z_texture_row_to_normalized * (z_texture_row * 2. + 1.)), 10000.), lod);
color = mix(texture(z_texture, vec2(z_texture_col, z_texture_row_to_normalized * (z_texture_row + 0.5 )), -10000.),
texture(z_texture, vec2(z_texture_col, z_texture_row_to_normalized * (z_texture_row * 2. + 1.)), 10000.), lod);
// Mix the final color.
gl_FragColor = vec4(vec3(intensity.y), 1.0) + intensity.x * mix(color, vec4(1.0, 1.0, 0.0, 1.0), z_blend);
}