SFML community forums

Help => Graphics => Topic started by: madcat on September 11, 2014, 09:10:11 am

Title: VertexArray, setTextureRect and setRepeated
Post by: madcat on September 11, 2014, 09:10:11 am
Hi,

I was wondering if there's a way to associate a repeated texture taken from a tilemap to a VertexArray.
I'm designing asteroids as non convex triangle based objects and I have a sort of texmap with different repeatable rock textures + some sticker-style graphics to overlay on my polygonal asteroids (extra craters, space base, smashed alien...)


I don't seem to find a straightforward way to do it....
is there a way to fix a textureRectangle when assigning the texture at the state level?

state.texture = ??

thx

Title: Re: VertexArray, setTextureRect and setRepeated
Post by: Hapax on September 12, 2014, 05:11:51 pm
Your question seems to be: "can you repeat texture rects instead of only being able to repeat the entire texture" and, after a quick scan of the docs, it doesn't look like that is possible.
Title: Re: VertexArray, setTextureRect and setRepeated
Post by: Tank on September 12, 2014, 05:39:30 pm
Btw. that's how OpenGL works. You can ignore, clamp or repeat texture coordinates if they are lower than 0.0 or higher than 1.0 (normalized). You might want to tailor yourself a little shader to repeat sub textures.