OT: a way to save opengl default states and restore them

Discussion in 'Rendering Technology and APIs' started by tb, Oct 5, 2005.

  1. tb

    tb
    Newcomer

    Joined:
    Feb 7, 2002
    Messages:
    241
    Likes Received:
    0
    Location:
    Germany / Thuringia
    hi,
    this could be a little bit off-topic, but does anyone know a way how I cn save and restore mos of opengl's states? I know the glpushattrib/glpopattrib stuff, but here is the problem, I want to do the following:

    save default
    do something
    save new states
    restore default states
    do something
    restore new states

    best regards,
    thomas
     
  2. ERP

    ERP Moderator
    Moderator Veteran

    Joined:
    Feb 11, 2002
    Messages:
    3,669
    Likes Received:
    49
    Location:
    Redmond, WA

    Without writing a wrapper for state setting that maintains a list of states, no way I know of.

    Having said that you probably only think you want this, I've seen many attempts in API's to abstract the state problem, and without exception every one of them ends up making it more difficult to manage state accross the application as a whole than just accepting the fact that the graphics hardware is a statemachine.

    Having said that we commonly do build a wrapper around state changes, to cache current state and remove redundant state changes. On PC the driver is likely doing this anyway.
     
  3. Rolf N

    Rolf N Recurring Membmare
    Veteran

    Joined:
    Aug 18, 2003
    Messages:
    2,494
    Likes Received:
    55
    Location:
    yes
    You can't save the current state in this way.
    However, you can compile settings for all states (that interest you ...) into a display list.
     
  4. Humus

    Humus Crazy coder
    Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,217
    Likes Received:
    77
    Location:
    Stockholm, Sweden
    I'm doing something fairly close to that in my framework. It's all manual though, there's no magical API call you can use. The closest would indeed be glPush/PopAttrib. Writing your own wrapper to manage states is probably your best bet. I've found that it improves my productivity quite a lot.
     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...