So I’m trying to debug this program. I did not write this program, and the code is not mine, so I can’t really post any of it up here. Sorry, guys.
Basically, it’s an extremely large program using a wxGLCanvas. However, the rendering speed is running extremely slowly. I created a small Qt program to display the same data, and the whole rendering loop takes about 24.8 clock ticks (thousandths of a second) to render the scene, while the exact same code in the Wx application takes 534.6 seconds.
The code is of this form
glBegin(GL_TRIANGLES)
for(iterator::i=theList.begin(); i!=theList.end(); i++){
glVertex(theList.node[0].x, theList.node[0].y, theList.node[0].z);
glVertex(theList.node[1].x, theList.node[1].y, theList.node[1].z);
//The rest of the points here
//Yes, I'm making sure they're actually triangles
}
glEnd()
A few things that are bizarre:
First, although the input routines between the two programs are slightly different (wxString v. QString), I’ve outputted the data structures, and diff-ed their output. Except for minor round-off changes, there is no difference. However, even if I take all the glVertex calls out of the loop (and turn off glBegin/glEnd) the loop still takes longer to execute in the WxWidgets program. Bizarre? I think so! It’s merely an stl iterator going through an stl map, and yes, I’ve checked, they’re both going through the loop the same number of times. However it takes on average 0.4 seconds on my toy Qt app, but 32.5 seconds on my large Wx app.
Also, I’ve output every glGet, and there is no difference (save for GL_STENCIL_BITS, but that has no effect), but even the glVertex calls take longer in the Wx app. (I made a for loop to draw the same triangles over and over, and it took 23.6 on the Wx app, and 1.73 on the Qt app)
So questions I have:
- Is there anything in OpenGL’s state that would be affecting the rendering speed that I can’t check with a glGet? Because I’ve checked everything in glGet.
2)Can anyone think of any other reason this effect would happen.
I have a feeling that the author of this code did something strange with WxWidgets that I haven’t done in my toy program, but I am having a bugger of a time figuring it out.
Any ideas, planet earth?