PDA

View Full Version : Performance with some old code



Boumbles
03-17-2014, 12:18 PM
I've inherited a project using some pretty old OpenGL code. I haven't really used OpenGL in a while nor did I ever use it in a production environment. It's a 3D visualization program and its performance leaves a lot to be desired. I've tried running the project using gDEBugger but I'm a bit stumped as to what I'm seeing.

It appears that the program is using a lot of deprecated functionality. gDEBugger is saying that 78.13% of calls are to deprecated functions (yay?). Of those I'm seeing things like glVertex3d, glNormal3f, glVertex2d near the top in terms of calls. These seem to be being called by things like gluCylinder and the like. In school we learned to use glBegin/end with shapes from glu. It seems that nowadays it's prefered to use vertex buffer arrays.

The vertex batches section in gDEBugger is telling me that 99% of my batches are made up of 1 vertex. I'm assuming this has to do with the glu functions. I understand that using larger vertex batches would be preferred.

Should I consider rewriting all the opengl code to use vertex batches, drawing all the shapes manually this way? Or is there a way to use the glu functions with vertex batches?

Steven Katic
03-17-2014, 05:41 PM
RE: I'm assuming this has to do with the glu functions.
I would more likely assume it relates to each call to things like glVertex3d. last I saw(anybody can correct me if things have changed) the fixed function pipeline "under the hood" is actually implemented with the programmable pipeline vertex buffer stuff. So the 99% of the batches made up of one vertex seems consistent with this.


RE: Should I consider rewriting all the opengl code to use vertex batches, drawing all the shapes manually this way?
most certainly

RE:Or is there a way to use the glu functions with vertex batches? I doubt it. You have to make your own. But I do recall the OpenGL SuperBible 5 code has some example substitutes using vbos. It's GLTools library is really worth a look (for close substitutes of fixed pipeline api) in general aswell, which may suit your current context.