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

Author Topic: win.pushGLStates and win.popGLStates vs win.resetGLStates  (Read 1624 times)

0 Members and 1 Guest are viewing this topic.

Flaze07

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
win.pushGLStates and win.popGLStates vs win.resetGLStates
« 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
« Last Edit: July 10, 2017, 06:27:34 am by Flaze07 »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: win.pushGLStates and win.popGLStates vs win.resetGLStates
« Reply #1 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.