hi all, my first blood.
i’m using sampler objs to replace texture params, but found it not work specially with compare mode.
snippet is truncated from glIntercept log
glUseProgram(10)
glActiveTexture(GL_TEXTURE0)
glBindTexture(GL_TEXTURE_2D,5)
glBindSampler(0,11)
glActiveTexture(GL_TEXTURE1)
glBindTexture(GL_TEXTURE_2D,9)
glBindSampler(1,10)
... other uniforms
glDrawArrays(GL_POINTS,0,1) GLSL=10 Textures[ (0,5) (1,9) ]
uniform sampler2DShadow samp_Shadow;
...
//add offset along pixel to lit
const float offset=0.2f;
vec3 newPos=pos+toLight*offset;
vec4 proj=uni_ViewToLightProj*vec4(newPos,1.f);
proj+=vec4(proj.w);
gl_FragData[0].x=textureProj(samp_Shadow,proj).x;
using this to draw a sphere, fbo outputs a image with depth value, rather than cmp result.
works fine if i replace the glSamplerParam* calls with glTexParam*.
wrong form: check fbo_output, the rectangle is view frustum far plane, and light is casting on the upper sphere.
correct form: check what_i_want.
PS: i was facing this prob using ati hd5650 and catalyst 12.1, prob hold after 12.3 is installed.
any idea & reply would be appreciated.
edit:
i think i’m not depicting the question properly,
the problem i’m facing is that,
feeding textureProj with sampler2DShadow ,
texture of format GL_DEPTH_COMPONENT32F,
setting sampler params like this:
glSamplerParameteri(handle,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER);
glSamplerParameteri(handle,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER);
glSamplerParameterfv(handle,GL_TEXTURE_BORDER_COLOR,&Color::RGBA(0)[0]);
glSamplerParameteri(handle,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glSamplerParameteri(handle,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glSamplerParameteri(handle,GL_TEXTURE_COMPARE_MODE,GL_COMPARE_REF_TO_TEXTURE);
glSamplerParameteri(handle,GL_TEXTURE_COMPARE_FUNC,GL_LESS);
textureProj should return compared result (1.f or 0), but it obviously not, that it return raw depth value