How to know if projection and modelview are changed?


Is there an easy way to check if any of the projection and the modelview (translation, rotation) has been changed? A naive way is to check if the projection matrix and modelview matrix are changed. If this is the only way, then does OpenGl have a function to retrieve the combination matrix of these two matices? I want to reduce the overhead for the comparison.

My purpose is to recalculate the part of the model for display each time the model is rotated (or translated), or the projection is changed. Please advise. Thanks.


Umm… YOU call GL to change these matrices. GL won’t do it behind your back. How about just stuffing something in a member variable somewhere when you change it, and test that?
Or a global, even, if that’s your thing?


I am sorry not to make myself clear. The code that does the transformation and projection is in another dll which is quite complicated and not under my control. I don’t even want to touch it or figure out where is the most safe place to catch all possible events. That is why I wonder I can do the testing under my own code. Thanks.

Then the only way is to glGet() those matrices.

Never buy libraries you don’t get source for.