SFML community forums
Help => Graphics => Topic started 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.
-
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 ;)
-
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
-
Hmm... this shows image --> C++ STL vector --> image.
Can I just do image --> image?
-
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.
-
So how can I pass the letters to OpenGL individually?
-
With texture coordinates (Image::GetTexCoords).