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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - finlaybob

Pages: [1]
1
Graphics / Re: sf::Image and sf::Text
« on: February 09, 2013, 11:58:16 am »
I thought that. I've multiplied the width and height of the render target by 20% and it seems to do okay.

Thanks for your help!

2
Graphics / Re: sf::Image and sf::Text
« on: February 08, 2013, 11:37:55 pm »
Thanks very much to both, I hadn't thought of that!

However the text is being cut off at the bottom and right hand sides...



[attachment deleted by admin]

3
Graphics / sf::Image and sf::Text
« on: February 08, 2013, 09:40:04 pm »
Hi all.

I want to extract the rendered text from a sf::Text object into an sf::Image. Is that even possible? If so, please can someone let me know how?.

I'm new to SFML, but not to OpenGL and C++, so I hope I'm not doing anything wrong!

I've tried this:

sf::Font f;
f.loadFromFile("Resources/Fonts/Exo.otf");
sf::Text t;
t.setString("Hello There");
t.setFont(f);
t.setCharacterSize(24);
sf::Texture tx = f.getTexture(24);
sf::Image img = tx.copyToImage();
 
But that's no good to me, I've attached the GDEbugger run of the code to get a peek at what is in the texture and it's not what I want at all.

I need to use the sf::Image for getting the texture into OpenGL as I'm managing my own textures i.e.
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,img.getSize().x,img.getSize().y,0,GL_RGBA,GL_UNSIGNED_BYTE,img.getPixelsPtr());


Any ideas would be helpful,
Thanks.

[attachment deleted by admin]

Pages: [1]