SFML community forums

Help => Graphics => Topic started by: zérotisme on April 17, 2016, 08:56:17 pm

Title: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 17, 2016, 08:56:17 pm
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
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: Nexus on April 17, 2016, 09:01:01 pm
Please read this: http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 17, 2016, 09:19:39 pm
Please read this: http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368

Thank you , I edited.
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: Hiura on April 17, 2016, 09:57:33 pm
The likelihood that this was at some point fixed being high, you should probably try a more recent version of SFML -- at least 2.3.2, if not the master version from git.
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 17, 2016, 10:03:41 pm
I am using 2.0 because i can't compile 2.3.2 myself. If i try the binary realease , i can't find the right version of code::block/mingw and the right version of sfml. It gives me a "gxx_personality_v0" pop-up error during run-time.
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 17, 2016, 10:31:30 pm
I am now using 2.3.2. I have the same error but this time it's when i call window.draw(text); method.

#include <SFML\Graphics.hpp>
#include <iostream>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800,600), "SFML works");
   
    sf::Font font;
    if(!font.loadFromFile("arial.ttf"))
        return -10;

    sf::Text text;
    text.setFont(font);
    text.setString("Hello world!");
    text.setColor(sf::Color::White);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(text); // here : internal call from Texture.cpp L.396
        window.display();
    }

    return 0;
}
 
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 19, 2016, 01:16:38 am
Still didn't find a fix for my issue.
Title: AW: [SFML2.0][sf::text] OpenGL internal call fail
Post by: eXpl0it3r on April 19, 2016, 07:43:54 am
What's your GPU? What driver version have you installed?
Title: Re: AW: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 19, 2016, 03:05:17 pm
What's your GPU? What driver version have you installed?

GPU : Mobile Intel(R) 4 Series Express Chipset Family
Driver : Mobile 4 Series Chipset Integrated Graphics Controller
OpenGL : version 2.1

I can't find no other driver suitable for my chipset.
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: eXpl0it3r on April 19, 2016, 06:51:25 pm
That seems to be quite an old machine you have there. It may well be that the driver is just buggy.

Can you run the example binaries that come with the SFML SDK on your machine?
What happens if you use a different font?
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 19, 2016, 10:08:08 pm
Yeah that's quite old but i thought that opengl 2.1 would be enough for sfml ... i am using sfml for +- 2 years here and there and never had a problem , however that's the first time i try to render text ... I tried 5-6 different font and i still get the error at the window.draw(text); Thats weird because now i can use text::setString() without any bug but can't draw it.

I guess i could just get a spritesheet with a-z 0-9 and implement a basic font class with textures and sprites ..
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: Jesper Juhl on April 19, 2016, 11:32:04 pm
How about you answer eXpl0it3r's question?

"Can you run the example binaries that come with the SFML SDK on your machine?"
Title: Re: [SFML2.0][sf::text] OpenGL internal call fail
Post by: zérotisme on April 20, 2016, 12:26:49 am
I can run any code that doesnt draw a sf::text class ... and never tried 3d.