SFML community forums

Help => General => Topic started by: sfmlProblem2000 on March 07, 2021, 09:11:19 pm

Title: An internal OpenGL call failed in Texture.cpp(98).
Post by: sfmlProblem2000 on March 07, 2021, 09:11:19 pm
Hi everyone

I have this code:

#include "SFML/Graphics.hpp"
#include <iostream>
using namespace std;
using namespace sf;


struct sfButton
{
    int ButtonSprite;
    Text ButtonText;
};


int main()
{
    int ScreenWide = 500;
    int ScreenHeight = 500;
    int FrameLimit = 60;
    RenderWindow window;
    srand(time(NULL));
    setlocale(LC_ALL, "");
    window.create(VideoMode(500,500,32),"Window");
    window.setActive(true);
    window.setPosition(Vector2i(90,0));
    window.setFramerateLimit(60);
    Font Calibri;
    Calibri.loadFromFile("Calibri Regular.ttf");

    sfButton A;
    A.ButtonText.setCharacterSize(15);
    A.ButtonText.setFillColor(Color(255,255,255));
    A.ButtonText.setPosition(Vector2f(0,0));
    A.ButtonText.setFont(Calibri);
    A.ButtonText.setString("x");


    Event event;
    while(window.isOpen())
    {
        while(window.pollEvent(event))
        {

        }
        if (event.type == Event::Closed || (Keyboard::isKeyPressed(Keyboard::Escape)))
            window.close();

        window.clear(Color(50,51,55));
        window.draw(A.ButtonText);
        window.display();
    }
}
 

and when i run it i have this message:

"An internal OpenGL call failed in Texture.cpp(98).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in Texture.cpp(98).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state."

But when I remove "int ButtonSprite;" form "sfButton" program compiles correct and I have no errors.
Can anybody tell me why is this happening and how to fix it?
Title: Re: An internal OpenGL call failed in Texture.cpp(98).
Post by: nfect on March 17, 2021, 02:53:47 am
That's an odd one. I tried your code and had no issues
Title: Re: An internal OpenGL call failed in Texture.cpp(98).
Post by: Stauricus on March 17, 2021, 12:23:02 pm
it also works for me.
aren't you having any name clashes? did you install some GUI library based on SFML?
you could try removing the "using namespace" directives (and adding all namespaces in the code)
Title: Re: An internal OpenGL call failed in Texture.cpp(98).
Post by: eXpl0it3r on March 20, 2021, 10:52:59 am
There were some issues with glFlush and RenderTextures as far as I remember, but I don't see any RT used here.
I'd suggest to update SFML to the latest master-branch version (there are also pre-build binaries (https://artifacts.sfml-dev.org/by-branch/master/)) and try again.
Title: Re: An internal OpenGL call failed in Texture.cpp(98).
Post by: kojack on March 20, 2021, 12:44:16 pm
Quote
But when I remove "int ButtonSprite;" form "sfButton" program compiles correct and I have no errors.

If removing an unused int from a struct is causing this problem, it sounds like it might be a mixing build types issue (using debug SFML with release program or vice versa), or something isn't being rebuilt (so an obj file isn't recompiled to match the source).