Sunday, January 15, 2012

Dev diary: stupid bug/mistake

Today something else than weeks update :] right now I finished looking for some stupid bug or I should say my mistake. Maybe this will help somebody so for some brief about it:
I create object on empty map and then after removing it I get crash. Callstack in visual studio 2010 showed me only one call with some address and without any description. Of course in main thread :]
Sounds great :] after some debugging I found that crash always happened on function glDrawArrays
which is use in engine to render dynamic geometry and never on rendering objects. It was great because I could focus on this one place on dynamic geometry. And in this moment again I realize how much I need to learn and practice.

I focused on dynamic geometry and searched there error for 2-3 hours but of course mistake weren't exactly there. Problem were on Vertex Attributes which were in my code enabled but never disabled.

Crash never happened on rendering normal objects because they VBO in this case always use more attributes than dynamics geometry. So in ogl some attributes were always binded to this bigger VBO. On removing object I destroyed this VBO and than app crashed. It's somehow funny because in earlier version of render code there were code to do it but I changed part of it's implementation and by mistake remove it :]

No comments:

Post a Comment