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

Author Topic: VertexArray, setTextureRect and setRepeated  (Read 1878 times)

0 Members and 1 Guest are viewing this topic.

madcat

  • Newbie
  • *
  • Posts: 21
  • Creator of TacWars
    • View Profile
    • TacWars
VertexArray, setTextureRect and setRepeated
« 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


Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: VertexArray, setTextureRect and setRepeated
« Reply #1 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: VertexArray, setTextureRect and setRepeated
« Reply #2 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.

 

anything