kewuwsi
01-11-2008, 10:20 AM
Hi,All
I noticed that people use the following code to access the neighboring fragment in fragment shader:
"
.....
float step_w = 1.0/ width; // width is the texture width
float step_h = 1.0/ height;
vec2 offset = vec2(-step_w, -step_h);
vec4 tmp = texture2D(myTexture, gl_TexCoord[0].st + offset);
.....
"
my question is, what is going to happen when (gl_TexCoord[0].st + offset).x < 0.0 ?. Does opengl automatically set it as 0.0? or we have to manually handle the "boundary" case?
tks
I noticed that people use the following code to access the neighboring fragment in fragment shader:
"
.....
float step_w = 1.0/ width; // width is the texture width
float step_h = 1.0/ height;
vec2 offset = vec2(-step_w, -step_h);
vec4 tmp = texture2D(myTexture, gl_TexCoord[0].st + offset);
.....
"
my question is, what is going to happen when (gl_TexCoord[0].st + offset).x < 0.0 ?. Does opengl automatically set it as 0.0? or we have to manually handle the "boundary" case?
tks