Change texture coordinates of geom::plane

hey there everyone,

I have something here that seems like it should be simple but I cannot work it out.

I have a geom::plane in a batch; it goes through a nothing-special shader that takes a texture as in many of the example projects.

it perfectly stretches the texture to fit the plane when drawn, but I want it to repeat the texture! I read in an earlier post that I need to give something somewhere in the program some texture coordinates outside the range of [0,1]. but, ciTexCoord0 is being supplied from the geometry, right? which keeps me from being able to change how the texture maps to the plane? have I confused myself?

I feel like I should be able to just change some property of the plane but I am, say, at a crossroads with too many paths… there are lots of examples in raw openGL out there but I feel like there is some neat elegant cinder way of going about this. thanks so much for any help thrown my way!

You could try something like:

auto mesh = geom::Plane() >> geom::AttribFn<vec2, vec2> ( geom::TEX_COORD_0, geom::TEX_COORD_0, [] ( const ci::vec2& uv )
{
    return uv * 2.0f;
});
4 Likes

yes! that is exactly what I was looking for. this implementation is so beautiful… that is why I love cinder. thanks so much.