How can I find missing glPopMatrix() in Visual Studio
I have a theory according to which the bugs I'm experiencing are due to a glPushMatrix() beign used without a matching glPopMatrix(). My project is rather big so I would like to be able to find these mi开发者_如何学Gossing glPopMatrix() easily. I thought of using a search using regular expression, but I can't seem to find out how to find what I want (plus, regexp in visual studio isn't exactly the same as what I'm used to (php) so I'm a bit lost. Anyways, any ideas on how to do this?
You can verify your theory by checking if glGetError()
returns GL_STACK_OVERFLOW
at some point.
To find the missing references, I cannot think of anything better than to run a full-text search on your project for glPushMatrix
and try to find the corresponding glPopMatrix
for every one of them.
Or there's one more solution:
You can use an OpenGL debugger like GLIntercept (which comes in the form of an altered opengl32.dll
file and dumps a lot of useful information, including all the OpenGL commands which were executed (there can be a flat log or a single-frame log of them). This can give you a good view on what went wrong and when.
精彩评论