PDA

View Full Version : 3.2 core & PushAttrib



Bloodtoes
04-04-2010, 01:28 AM
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?

martinsm
04-04-2010, 01:31 AM
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.

Bloodtoes
04-04-2010, 01:37 AM
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?

Alfonse Reinheart
04-04-2010, 01:42 AM
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.

Bloodtoes
04-04-2010, 01:57 AM
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. :)

Alfonse Reinheart
04-04-2010, 02:09 AM
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.

Bloodtoes
04-04-2010, 02:14 AM
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. ;)

Rosario Leonardi
04-04-2010, 09:29 AM
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. :D
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.

Bloodtoes
04-04-2010, 03:11 PM
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.