SFML community forums

Help => Graphics => Topic started by: tntexplosivesltd on February 13, 2011, 09:40:10 am

Title: Smaller images from a larger image
Post by: tntexplosivesltd 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.
Title: Smaller images from a larger image
Post by: devlin on February 13, 2011, 09:50:12 am
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.htm

http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.htm (in particular SetSubRect)

It's all in the documentation ;)
Title: Smaller images from a larger image
Post by: tntexplosivesltd 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
Title: Smaller images from a larger image
Post by: tntexplosivesltd on February 13, 2011, 10:14:52 am
Hmm... this shows image --> C++ STL vector --> image.
Can I just do image --> image?
Title: Smaller images from a larger image
Post by: Laurent 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.
Title: Smaller images from a larger image
Post by: tntexplosivesltd on February 13, 2011, 10:36:37 am
So how can I pass the letters to OpenGL individually?
Title: Smaller images from a larger image
Post by: Laurent on February 13, 2011, 10:47:33 am
With texture coordinates (Image::GetTexCoords).