Shader mapTexCoordsFromTexture on a 3d object

Hello Everyone,

I’m working on the shader tutorials more precisely the displacement map one.

Firstofall the example works great, and the doc is quite clear so kudos !

I’ve managed to import an image of mine instead of the generated texture, and I’ve controlled the displacement with the combination of a noise and the grayscale value of each pixel.

Now instead of moving the y coordinate I want to move the z one, of course with a plane it doesn’t do anything.
So I wanted to use a mesh instead but I cannot use the ‘mapTexCoordsFromTexture’ function with an ofMesh.
After a quick look at the doc I see that the of3dPrimitive has a ‘mapTexCoordsFromTexture’ method, so I tried to create a of3dPrimitive object called ‘mesh’, and set it as plane, then map the texCoord.

ofMesh m = mesh.getMesh();
m.plane(800,600,w/10,h/10);
mesh.mapTexCoordsFromTexture(img.getTextureReference());

no errors but nothing showed up :confused: I’m probably doing all sorts of wrong stuff, but I don’t get how to map my texCoord to a 3d object like a simple mesh, can someone point me in the good direction ?

as a matter of fact, it works as expected it was just me that was bugging …

but still how would I go if I wanted to map texture coordinates to an ofMesh willing to mess with vertices and fragments in a shader ?