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

Author Topic: Smaller images from a larger image  (Read 2317 times)

0 Members and 1 Guest are viewing this topic.

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Smaller images from a larger image
« on: February 13, 2011, 09:40:10 am »
Hi.
I am wondering how to load an image of ASCII characters and create many smaller images (one for each letter) from that large image.
Thank you in advance,
tntexplosivesltd.

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Smaller images from a larger image
« Reply #1 on: February 13, 2011, 09:50:12 am »

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Smaller images from a larger image
« Reply #2 on: February 13, 2011, 10:00:31 am »
I want to use the images to draw text in openGL. SetSubRect looks to be going the wrong way about it. Found a link myself anyway:
http://www.sfml-dev.org/forum/viewtopic.php?t=2790

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Smaller images from a larger image
« Reply #3 on: February 13, 2011, 10:14:52 am »
Hmm... this shows image --> C++ STL vector --> image.
Can I just do image --> image?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Smaller images from a larger image
« Reply #4 on: February 13, 2011, 10:34:42 am »
You can use Image::Copy.

But why do you want to break your big image into individual smaller images? Rendering them will be much more efficient if they are all in the same texture.
Laurent Gomila - SFML developer

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Smaller images from a larger image
« Reply #5 on: February 13, 2011, 10:36:37 am »
So how can I pass the letters to OpenGL individually?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Smaller images from a larger image
« Reply #6 on: February 13, 2011, 10:47:33 am »
With texture coordinates (Image::GetTexCoords).
Laurent Gomila - SFML developer

 

anything