Example: Scalable login screen - Error

Started by che2a, 18 May 2020, 16:59:04

che2a

Hello im  newbie, when i try the code from Scalable login screen for 0.8 version

i get this error (in loop) :

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


texus

Did you make any modifications to the example? Did you download or build SFML and TGUI?
This warning seems to occur when creating a texture before the RenderWindow is created, but the scalable login example shouldn't be doing that.

That particular line has been removed from SFML in the version on github (https://github.com/SFML/SFML/commit/f2b8e6397b3420f01b463d549ccc145ddf152dea), so maybe building the latest SFML version (and rebuilding TGUI with that version) might solve it.

che2a

I have latest version of sfml 2.5.1
Sfml works fine

I didn t modified the code

When i try the first step of the tutorial code i get same errors...

I m on codeblocks i donwloaded precompiled version

texus

So you get there errors even if you don't add any widgets?
Do they still occur if you remove gui.draw()?

I'm not sure where that code is even executed. There shouldn't be a single place in TGUI where a texture is copied every frame.

che2a

If i do not add and draw i have no errors, if i create but no add and i draw i have error.
But i have to confirm you tomorrow when i go back to my computer
I will take some screenshots and post here

Kvaz1r

I guess it's somewhere in Picture widget.
Could you run the tests and see which widget throw the exception to confirm? Or remove them one by one from your MCVE.

I have been getting this exception earlier (on older version of VS19) in tests but not always.

Maybe it have similar root to this one - Exception when creating ProgressBar

texus

@Kvaz1r
The exception that you had in ProgressBar has nothing to do with this. That issue was already fixed.
You were also getting the GL_INVALID_OPERATION error, but there are two possibilities:
- Either it disappeared together with the exception which would mean that it is unrelated to this issue report (which is a possibility since the error could be caused by multiple things).
- Or it had nothing to do with the exception that you were getting and the GL_INVALID_OPERATION error was thus never fixed (I only fixed the exception issue).

You did make me realize one thing though: fonts also use textures. So I shouldn't just be looking at my texture management but also at the font management. Although I still don't see where it would try to copy something.

@che2a
When you get back to your computer, the following are what I would need to know (you can e.g. add some output in the program so that you can see when the error happens):
- Does it occur before the main loop starts? If so, when? (E.g. when creating the gui, when creating the first widget or every time a widget is created)
- Does it go away if gui.draw() is removed?
- What if you do draw but no widgets were created? What if some were created but never added to the gui (no gui.add(widget))?
- Does it occur every frame? Only once per frame, or e.g. once per widget, or multiple times per widget?

Kvaz1r

Quote from: texus on 18 May 2020, 22:27:58
The exception that you had in ProgressBar has nothing to do with this. That issue was already fixed.
You were also getting the GL_INVALID_OPERATION error, but there are two possibilities:
- Or it had nothing to do with the exception that you were getting and the GL_INVALID_OPERATION error was thus never fixed (I only fixed the exception issue).

I understand that that issue was fixed :)
And yes I was indeed wrong I remembered your comment about OpenGL error in Picture.cpp but not details so thought it was related.

che2a

#8
I took  a screenshot of console

Yesterday i didn t see the error message that  SFML require support opengl 1.1

i tried this code :

#include <TGUI/TGUI.hpp>


int main()
{

    sf::RenderWindow window{{800, 600}, "Window"};
    tgui::Gui gui{window}; // Create the gui and attach it to the window

    tgui::Button::Ptr button = tgui::Button::create();
    tgui::EditBox::Ptr editBox = tgui::EditBox::create();

    //gui.add(button);
    //gui.add(editBox, "MyWidgetName");

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

            gui.handleEvent(event); // Pass the event to the widgets
        }

        window.clear();
        //gui.draw(); // Draw all widgets
        window.display();
    }
}


see attachment

texus

In that case it might just some driver issue. Make sure your graphics driver is up to date.

che2a

#10
I updated my drivers, problem is same

But i never used opengl with SFML, when i compile a test i get in console :

Warning : The created OpenGL context does not fully meet the settings that were requested
Requested : version = 3.0 ; depth bits = 32 : stencil bits = 8 ; AA level = 4 ; core = false ; debug = false ; sRGB = false;
Created: version = 4.6 ; depth bits = 24 : stencil bits = 8 ; AA level = 4 ; core = false ; debug = false ; sRGB = false;

che2a

Ok, i created new project on CodeBlocks, now it work, i don t know why it not work on my actual sfml project, i put the same build options but i get errors on my actual sfml project...

I will try to migrate my project

Hope i can and no have to rewrite all

Thank you a lot