3.2 core & PushAttrib

So, PushAttrib is gone. Before I go do things the hard way I just wanted to make sure there isn’t already a Better Way.

Rather than using glPushAttrib() with various flags, if I want to save and restore the settings I’ll be changing, should I go about executing a bunch of glGet*, saving the results out, then restoring them afterward? Or is there a different way?

It is better to not call glGet* functions because of performance reasons. It is better to cache all state you set in client side (in your program), and then use this state to change only that GL state that needs to be actually changed.

That’s fine if I have total control over the program, but what of cases where I’m writing a plugin and my function is called during a draw loop? It’s very convenient to PushAttrib() for the settings I will be changing, then pop it when I’m done. Should I then trust that the app my plugin is for will reset its state?

Should I then trust that the app my plugin is for will reset its state?

You should talk to the people who own the application; they will tell you what they expect from their plugins.

However, glPush/PopAttrib is only “gone” if the application initializing OpenGL asks for a core OpenGL profile of a GL version 3.2 or greater. Otherwise, ARB_compatibility will be available and glPush/PopAttrib will be available.

I don’t know of any program with a plugin architecture that has been written against 3.2 core. Max, Maya, etc all rely on compatibility profiles.

Thanks Alfonse.

In my case it is for Maya and MotionBuilder (particularly the latter) which at present are using 2.1 so it’s not an issue as such… yet. I just want to be prepared. :slight_smile:

There’s nothing to be prepared for. Maya and MotionBuilder are not going to be rewritten to use only 3.2 core. And if they are, the people behind it will tell you beforehand, as it is a backwards-incompatible change.

Hah yeah you’re probably right. At least with Maya anyway. I wouldn’t be so sure about MotionBuilder, that team is vicious with their API and I wouldn’t put it past them to gut and redo the whole thing for 2012. :wink:

Sorry, a bit out of topic, but:

Maya and MotionBuilder are not going to be rewritten to use only 3.2 core.

Autodesk annunced Maya 2011 at GDC and guess what?
New viewport. :smiley:
I don’t think is openGL 3.x but now I’m not sure that Maya 2012 or 13 will not implement geometry shader or tessellation in viewport.
Old(current) Maya viewport still use vertex array.

Hah, that’s fine. ViewPort 2.0, if I recall correctly, may even use DirectX. O.o I’ve been using the Maya 2011 beta for a couple months but haven’t had a chance to dig into the details about vp2.0 though.