Problem with vertex textures and linux

I’m trying to load a mat4 from a texture in a vertex shader and am having problems when I load 4 components at a time from an RGBA texture.

To help figure out what is going on I’ve been trying to access one float at a time rather than load all 16. I’m using the NVIDIA linux drivers (v71.74) with a GeForce 6600 GT.

I can get it to work properly if I use a luminance texture as follows:

Specify the texture:


and access it in the vertex shader using:

vec2 v = vec2(gl_Vertex.x / 4.0, gl_Vertex.z / 4.0);
vec4 patch = texture2D(PatchesTexture, v);
gl_Vertex.y = patch[0];

h is defined as: float h[4][4] and the x and z vertex coordinates go from 0 to 3.95. PatchesTexture is a sampler2D.

When I change to using an RGBA texture with the following code for the texture:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA_FLOAT32_ATI, 1, 4, 0, GL_RGBA, GL_FLOAT, h);

and this for the vertex shader:

vec2 v = vec2(0.0, gl_Vertex.z / 4.0);
vec4 patch = texture2D(PatchesTexture, v);
gl_Vertex.y = patch[int(floor(gl_Vertex.x))];

I get invalid results. The height doesn’t change with x as it should. If I hard code the patch index to be from 0 to 3, it retrieves the values that would expected for that value of x.

Any suggestions to what I could try next?

dave j

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.