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

Author Topic: An internal OpenGL call failed in Texture.cpp(98).  (Read 3916 times)

0 Members and 1 Guest are viewing this topic.

sfmlProblem2000

  • Newbie
  • *
  • Posts: 1
    • View Profile
An internal OpenGL call failed in Texture.cpp(98).
« 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?

nfect

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: An internal OpenGL call failed in Texture.cpp(98).
« Reply #1 on: March 17, 2021, 02:53:47 am »
That's an odd one. I tried your code and had no issues

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: An internal OpenGL call failed in Texture.cpp(98).
« Reply #2 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)
Visit my game site (and hopefully help funding it? )
Website | IndieDB

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: An internal OpenGL call failed in Texture.cpp(98).
« Reply #3 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) and try again.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kojack

  • Sr. Member
  • ****
  • Posts: 343
  • C++/C# game dev teacher.
    • View Profile
Re: An internal OpenGL call failed in Texture.cpp(98).
« Reply #4 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).

 

anything