I have a VBO with mesh data. I'm trying to displace the vertexes, based on a float texture with the vertex shader.
The displacement shader works in immediate mode, 100%. But somehow when I apply the shader on the VBO things go wrong. It looks like the shader can't read the texel values from the texture when using VBO.
dv0 = texture2D(hData, gl_MultiTexCoord0.st);
When displacing with dv0.x (height values are stored in "red"), it is like it reads the value 0, cuz no vertex changes position. If I just displace the vertex, with texture coordinates multiplied with a scaling factor(just to check that the displacement indeed works). I get a nice inclined plane, as expected.
The fragment shader however, reads the value of the texel just fine.
Format of the height texture.
glGenTextures(1, &m_HeightTex); glBindTexture(GL_TEXTURE_2D, m_HeightTex); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA_FLOAT32_ATI, 256,256,0,GL_RGBA,GL_FLOAT, tex);
I just wonder if it's anything special with VBO, some state or something I have ignored.











