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

Author Topic: Stitching an image  (Read 1509 times)

0 Members and 1 Guest are viewing this topic.

zilcho

  • Newbie
  • *
  • Posts: 6
    • View Profile
Stitching an image
« on: July 21, 2012, 03:37:33 pm »
Is it possible to stitch together an image from several smaller ones? I haven't been able to figure it out how to do it yet. I got an array with tiles and instead of iterating trough this array each loop to grab every single tile I'd like to create just one large image or sprite and draw.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Stitching an image
« Reply #1 on: July 21, 2012, 03:45:54 pm »
You could do that with sf::RenderTexture (SFML 2). But note that your graphics card has a texture size limit, so maybe this isn't such a good idea. Also, you cannot only draw the tiles that are currently on the screen with this approach.

What's the problem of iterating through the tiles? Especially when your game gets more dynamic (for example with animated tiles), this way is much more flexible.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

zilcho

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Stitching an image
« Reply #2 on: July 21, 2012, 06:16:03 pm »
Using SFML 1.6 so I guess I'll have to upgrade and I wont be creating very large images so texture size limit wont be a problem.

I find it unnecessary to iterate trough all tiles when I don't have a need for it, any animation will be done on another level. The tiles are more of a way of generating data for the chunk which holds them.


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10998
    • View Profile
    • development blog
    • Email
Re: Stitching an image
« Reply #3 on: July 21, 2012, 09:02:04 pm »
Yes it's a good idea to upgrade to SFML 2.
If you want to draw something like a tilemap (as it seems like it) you can also use a Vertex Array in SFML 2. It's more flexible and you don't need to create larger textures but you can still draw it with a single draw call.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything