SFML community forums

Help => Graphics => Topic started by: Flaze07 on July 10, 2017, 06:09:58 am

Title: win.pushGLStates and win.popGLStates vs win.resetGLStates
Post by: Flaze07 on July 10, 2017, 06:09:58 am
hi so I checked these out because I want to draw with both sfgui and sfml
and with this code nothing is drawn
Code: [Select]
        win.pushGLStates();
        if (option == Option::rectangle)
        {
            win.draw(rect);
        }
        win.popGLStates();
       sfgui.Display(win)

but this one works
Code: [Select]
        win.resetGLStates();
        sfgui.Display(win);
        win.resetGLStates();
        if (option == Option::rectangle)
        {
            win.draw(rect);
        }

full code
https://gist.github.com/Flaze07/7b10a4762523180a0169f49848d648cb (https://gist.github.com/Flaze07/7b10a4762523180a0169f49848d648cb)
Title: Re: win.pushGLStates and win.popGLStates vs win.resetGLStates
Post by: Mario on July 11, 2017, 07:05:31 pm
The basic promise is simple: Keep the OpenGL state vs. starting fresh. If you're using `ressetGLSStates()`, you're always starting fresh, which is perfectly fine. It's just a different approach to the same problem.