Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::RectangleShape Texture clamps/tile?  (Read 3372 times)

0 Members and 3 Guests are viewing this topic.

Haikarainen

  • Guest
sf::RectangleShape Texture clamps/tile?
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::RectangleShape Texture clamps/tile?
« Reply #1 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.
Laurent Gomila - SFML developer

Haikarainen

  • Guest
sf::RectangleShape Texture clamps/tile?
« Reply #2 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::RectangleShape Texture clamps/tile?
« Reply #3 on: January 12, 2012, 11:04:28 pm »
Quote
Will vertex shaders be available as well?

They are already available.
Laurent Gomila - SFML developer

 

anything