OpenGL: Fix textureXd deprecated calls.

This commit is contained in:
Clément Foucault 2017-04-10 16:58:08 +02:00
parent 01bd6da68f
commit 5f70116030
6 changed files with 10 additions and 4 deletions

View File

@ -9,7 +9,7 @@
void ssao_factors(in float depth, in vec3 normal, in vec3 position, in vec2 screenco, out float cavities, out float edges)
{
/* take the normalized ray direction here */
vec2 rotX = texture2D(ssao_jitter, screenco.xy * jitter_tilling).rg;
vec2 rotX = texture(ssao_jitter, screenco.xy * jitter_tilling).rg;
vec2 rotY = vec2(-rotX.y, rotX.x);
/* find the offset in screen space by multiplying a point
@ -27,7 +27,7 @@ void ssao_factors(in float depth, in vec3 normal, in vec3 position, in vec2 scre
for (x = 0; x < num_samples; x++) {
/* TODO : optimisation replace by constant */
vec2 dir_sample = texture1D(ssao_samples, (float(x) + 0.5) / ssao_samples_num).rg;
vec2 dir_sample = texture(ssao_samples, (float(x) + 0.5) / ssao_samples_num).rg;
/* rotate with random direction to get jittered result */
vec2 dir_jittered = vec2(dot(dir_sample, rotX), dot(dir_sample, rotY));
@ -37,7 +37,7 @@ void ssao_factors(in float depth, in vec3 normal, in vec3 position, in vec2 scre
if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0)
continue;
float depth_new = texture2D(depthtex, uvcoords).r;
float depth_new = texture(depthtex, uvcoords).r;
/* Handle Background case */
bool is_background = (depth_new == 1.0);

View File

@ -32,7 +32,7 @@ float get_max_horizon(in vec2 co, in vec3 x, in vec3 omega_o, in float h)
if (co.x > 1.0 || co.x < 0.0 || co.y > 1.0 || co.y < 0.0)
return h;
float depth = texture2D(depthtex, co).r;
float depth = texture(depthtex, co).r;
/* Background case */
if (depth == 1.0)

View File

@ -4,6 +4,7 @@ uniform sampler2D depthbuffer;
varying vec4 uvcoordsvar;
#else
in vec4 uvcoordsvar;
#define texture2D texture
#endif
void main(void)

View File

@ -44,6 +44,7 @@ uniform vec4 viewvecs[3];
in vec2 depth_uv4;
out vec4 FragColor;
#define texture2D texture
#endif

View File

@ -54,6 +54,8 @@ uniform vec4 viewvecs[3];
layout(location = 0) out vec4 fragData0;
layout(location = 1) out vec4 fragData1;
layout(location = 2) out vec4 fragData2;
#define texture2D texture
#endif

View File

@ -18,6 +18,8 @@ uniform sampler2D depthbuffer;
#else
in vec4 uvcoordsvar;
out vec4 FragColor;
#define texture1D texture
#define texture2D texture
#endif
/* ssao_params.x : pixel scale for the ssao radious */