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

Author Topic: [SFML2.0][sf::text] OpenGL internal call fail  (Read 4751 times)

0 Members and 1 Guest are viewing this topic.

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
[SFML2.0][sf::text] OpenGL internal call fail
« 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
« Last Edit: April 17, 2016, 09:04:55 pm by zérotisme »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:


Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #3 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.
SFML / OS X developer

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #4 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.

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #5 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;
}
 

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #6 on: April 19, 2016, 01:16:38 am »
Still didn't find a fix for my issue.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #7 on: April 19, 2016, 07:43:54 am »
What's your GPU? What driver version have you installed?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: AW: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #8 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #9 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #10 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 ..
« Last Edit: April 19, 2016, 10:10:54 pm by zérotisme »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #11 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?"

zérotisme

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: [SFML2.0][sf::text] OpenGL internal call fail
« Reply #12 on: April 20, 2016, 12:26:49 am »
I can run any code that doesnt draw a sf::text class ... and never tried 3d.
« Last Edit: April 20, 2016, 02:10:19 am by zérotisme »

 

anything