Avoid inserting timer queries while constructing a display list
We only want to time actual drawing operations. When between glNewList
and glEndList, calls that look like drawing operations are not really,
instead these are just calls that are being recorded to be later
executed with glCallList. (And it won't work to put our timer queries
inside the display list.)
So, track when we are within glNewList/glEndList and don't add timer
queries. Instead, we will time these operations as a whole with a
timer query around the glCallList call itself.