SFML community forums

Help => General => Topic started by: botics on June 07, 2014, 04:31:08 pm

Title: SFML-2.1 internal OpenGL call failed
Post by: botics on June 07, 2014, 04:31:08 pm
Hello,
I recently started a new project and I got a very frustrating error.
Everything is working until I move my mouse over a specific point on the window, then the program just stop running.
The error it gives is: "An internal OpenGL call failed in Texture.cpp (95) : GL_INVALID_OPERATION, the specified operation is not allowed in the current state."
I tried to google it but I didn't find anything. Somebody can please help me?
Title: Re: SFML-2.1 internal OpenGL call failed
Post by: Ixrec on June 07, 2014, 04:44:41 pm
Could you show us a complete program that causes this error, and exactly where the error happened?
Title: Re: SFML-2.1 internal OpenGL call failed
Post by: botics on June 07, 2014, 04:49:07 pm
The program is pretty big so I don't know how to show it and it happens when I move my mouse in the corner of the window.
Title: Re: SFML-2.1 internal OpenGL call failed
Post by: Ixrec on June 07, 2014, 05:02:26 pm
Since the error is really vague, we'll need an example program to do much about it.  Try cutting out large chunks of your code and see if the error still happens, until you have the smallest possible code that still causes the error.  If you can't do this, that's normally a sign the problem is not with SFML.

Also, I know global SFML objects tend to cause lots of weird errors, so if you have any of those see if getting rid of them helps.
Title: AW: SFML-2.1 internal OpenGL call failed
Post by: eXpl0it3r on June 07, 2014, 05:53:38 pm
OpenGL has nothing on common with mouse input, as such there has to be a programming error to begin with.

My guess is that you don't handle events properly, see the tutorial on that regard.

And yes in order to figure out what it is, you'll need to cut out everything that doesn't remove the issue.
Title: Re: SFML-2.1 internal OpenGL call failed
Post by: botics on June 07, 2014, 06:17:20 pm
I think, I fix it the problem was that instead of this:
if (ev.type == sf::Event::KeyPressed)
{
        if (ev.key.code == sf::Keyboard::Escape)
                window.close();
}

I used just this:
if (ev.key.code == sf::Keyboard::Escape)
                window.close();
 
Title: Re: SFML-2.1 internal OpenGL call failed
Post by: eXpl0it3r on June 07, 2014, 10:40:32 pm
My guess exactly. ;)

If you're watching Coding Made Easy tutorials, which is a well-known source of this exact mistake, then prepair yourself for more issue, because he has very little knowledge on SFML and even less on proper C++, thus a lot of his videos contain errors, are badly or not at all explained and will often confuse people more than if they had read a good C++ book (https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list), looked at official tutorials and documentations. ;)