SFML community forums

Help => Graphics => Topic started by: Haikarainen on January 12, 2012, 08:14:28 pm

Title: sf::RectangleShape Texture clamps/tile?
Post by: Haikarainen on January 12, 2012, 08:14:28 pm
Is there anyway to set behaviour methods on a rectangleshape defining how the texture will be drawn? Perhaps setting your own texturecoords?

What I want to achieve is drawing a tiled texture on a single shape, something like setting texture coords to 0.25 instead of 1.

If this hasn't been implemented yet, it REALLY should. Why? it will allow me to draw thousands of tiles on a single shape, instead of thousands of tiles on, thousands of sprites/shapes. this would speed up my mapeditor SIGNIFICANTLY, as well as the game itself.
Title: sf::RectangleShape Texture clamps/tile?
Post by: Laurent on January 12, 2012, 08:34:00 pm
So I guess you mean "setting texture coordinates to 4 instead of 1"?

SFML supports that: enable texture repeat (texture.setRepeated(true)) and use a texture rect which is bigger than the texture.

And don't forget that you can use vertices directly, if sf::RectangleShape is too limited or if you prefer a lower level API.
Title: sf::RectangleShape Texture clamps/tile?
Post by: Haikarainen on January 12, 2012, 10:30:00 pm
Quote from: "Laurent"
So I guess you mean "setting texture coordinates to 4 instead of 1"?

SFML supports that: enable texture repeat (texture.setRepeated(true)) and use a texture rect which is bigger than the texture.

And don't forget that you can use vertices directly, if sf::RectangleShape is too limited or if you prefer a lower level API.


Lol yes :D

Thank you! Really like the new API :) Will vertex shaders be available as well? I think I can remember someone stated something about that in the forums
Title: sf::RectangleShape Texture clamps/tile?
Post by: Laurent on January 12, 2012, 11:04:28 pm
Quote
Will vertex shaders be available as well?

They are already available.