I had a problem implementing texture fetching in vertex shader.
Actually I try to implement hardware skinning ,
using texture to store quaternion/translation.
The problem is vertex texture fetching only work when using 8 bit texture
format.
When I try 32bit format such as GL_RGBA_FLOAT32_ATI/GL_RGBA32F_ARB the program does’t crash
but the color/data value is alway zero/black.
My video card is ATI HD4670 with the lastest driver.
This is my vertex shader.
uniform sampler2D testTex;
varying vec4 debugColor;
void main(){
debugColor = texture2D(debugColor,vec2(0.5,0.5));
debugColor[3] = 1.0;//manually replace alpha
gl_Position = ftransform();
}
This is my fragment shader.
varying vec4 debugColor;
void main(){
gl_FragColor = debugColor
}
and this is my texture setup that doesnt work the debugColor alway return
as black.
float* data = new float[16*16*4];
for(int i=0;i<;i++){
data[i] = 0.5f;
}
glGenTextures(1,&this->finalRotTextureID);
glBindTexture(GL_TEXTURE_2D,this->finalRotTextureID);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA_FLOAT32_ATI,16,16,0,GL_RGBA_FLOAT32_ATI
,GL_FLOAT,data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST);
I also try replacing GL_RGBA_FLOAT32_ATI with GL_RGBA32F_ARB.
But if i change the code to
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,16,16,0,GL_RGBA
,GL_FLOAT,data);
the mesh are render in grey color as expect.
Can someone tell me why I cant do a 32bit vertex texture fetching ?