Uses of gpu_pop_state and gpu_push_state? How to use them?

Discussion in 'Programming' started by JasonTomLee, Apr 15, 2019.

  1. JasonTomLee

    JasonTomLee Member

    Joined:
    Jul 20, 2016
    Posts:
    99
  2. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    754
    Seems quite explanatory in the docs. You use gpu_push_state to place the current gpu drawing settings into a stack, so you can then change the blendmodes, alpha, culling, etc. to do other drawing with, and then you call gpu_pop_state to bring all the previously saved settings back from the stack.
    It seems that it allows you to do the switching back to the previous state easier than having to keep track of all the things that you have changed yourself. If you didn't use them, then you would need to make sure you stored the previous settings of everything you were going to change, and then made sure that you switched back to them again.
     
    Cpaz and JasonTomLee like this.
  3. JasonTomLee

    JasonTomLee Member

    Joined:
    Jul 20, 2016
    Posts:
    99
    ahhhhhh got it! Makes sense with your clarification.

    I thought you had to manually set up variables to save previous gpu states but that would be silly now when there are these functions :D
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice