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]