Texture indexing in Cg

I’m not certain that anybody here can help, but here it goes…

Does anybody have experience using Cg to modify textures?

I’m doing some simple test cases to learn how Cg works. I’ve written a very simple application that creates two arrays and binds them to textures, clears them, runs the Cg app, and repopulates the arrays from the resulting texture.

The Cg application is also very simple. Each texel of the output texture is populated with the value of the input texture at (TextureCoordinates.x-1, TextureCoordinates.y).

Unfortunately, the resulting output doesn’t make sense to me. If I subtract from the x coordinate, the output looks like I subtracted from the y coordinate and vice versa.

If anybody thinks they can help, I will gladly post an example project showing what I mean.

Thanks!