Hello. I am trying to render text using sf::text and sf::font with SFML v 2.0.
Loading a font in a sf::font works well , creating a sf::text works fine too .. i get an error whenever i try sf::text::setString or create my variable with params ( sf::text t(text,font,15); );
Here's the error :
Internal OpenGL call failed : GL_INVALID_VALUE , numeric argument out of bound.
It is called by Texture.cpp Line 327
I tried :
sf::ContextSettings settings = window.getSettings();
std::cout << "OpenGL version:"<< settings.majorVersion << "." << settings.minorVersion << std::endl;
Outputs : OpenGL version: 2.1.
Here's a minimal code that produce the probleme everytime.
int main()
{
sf::RenderWindow window(sf::VideoMode(800,600), "SFML works!");
sf::Font font;
if(!font.loadFromFile("arial.ttf"))
return -1;
sf::Text text;
text.setFont(font);
text.setString("Hello world!"); // Here
/* Or like this */
/* sf::Text("Hello", font, 10); */
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.display();
}
return 0;
}
Thanks for your help.
Z