I want to draw my mesh by using texture of SFML without using from (sf::window ,sf::Renderwindow....)
sf::RenderTexture renderTexture;
renderTexture.create(800,600);
renderTexture.clear(sf::Color::Blue);
sf::Text text;
// select the font
sf::Font font;
if (!font.loadFromFile("BNazanin.ttf"))
{
// error...
}
text.setFont(font); // font is a sf::Font
// set the string to display
text.setString("hello");
// set the character size
text.setCharacterSize(40); // in pixels, not points!
// set the color
text.setColor(sf::Color::Red);
// set the text style
text.setStyle(sf::Text::Bold | sf::Text::Underlined);
renderTexture.draw(text); // or any other drawable
renderTexture.display();
//renderTexture.getTexture().copyToImage().saveToFile("test.png");
const sf::Texture& texture = renderTexture.getTexture()
sf::Texture::bind(&texture);
_shaderProgram->bind();
_shaderProgram->setUniformValue("modelInWorldMatrix", _model2WorldMatrix);
glFlush();
QOpenGLContext::currentContext()->functions()->glDrawArrays(_mode, startVertex, std::min(vertexCount, verticesCount()));;
it save texture correctly, but when i use binded texture for drawing my mesh in Qt Scene, it Doesn't work!