Trouble with glDrawElements

I am having troubles with the following snipet of code. The way things are set up I will be rendering terrain with this code. This works fine when first loaded.
However, if the user wants to increase the terrain magnification I need to recalculate the mesh and re-run this code. When that happens it starts removing pieces of the rendered image until it is all gone! Is OGL not reassigning the pointer values and collecteding bad memory locations?
call glVertexPointer(3, GL_FLOAT, 0, loc(cubeverts))
call glNormalPointer(GL_FLOAT, 0,loc(cubenormals))

call glnewlist(1,GL_COMPILE)
call glDrawElements(GL_QUADS,nverts,GL_UNSIGNED_INT,indecies)
call glendlist()

Why dont you just use glScale?

I need to change the ratio of the highs to the lows, then calculate new normals to get the correct effect. Just changing the scale doesn’t work right.

[This message has been edited by mountain_ike (edited 02-26-2004).]

Display lists copy the client state data at the point of compile. Changing the pointers, or the data pointed at, after you’ve compiled the list won’t change the list contents at all.

Do I need to delete the call list to clear it? I thought that calling glnewlist again would reset the compiled data…

Yes, that’s how it’s supposed to work. From your code, it was un-clear to me whether you did this every frame – if so, why are you using display lists at all?

To be honest, a display list does not sound like the right too for this job. In any case, the spec isn’t completely clear on what happens when a list ID is re-used. I would assume that it should behave the same as with texture objects. Have you tried your program with a different driver or perhaps with Mesa?

I believe you can call glNewList on the same ID without a problem. glDeleteLists() undoes glGenLists(), it’s not for undoing glNewList. However I have found that remaking display lists is extremely slow.

I am only regenerating the display list under very special circumstances, but I will still need to do it. Most of the time I just access the list without generating it. This may not be a question for the advanced group, but is there a better way to do this?

[This message has been edited by mountain_ike (edited 03-01-2004).]

I’m having the same problem having VBOs and Display Lists get along nicely together. I also have vertex data that needs to be updated. If the only reason you’re updating your vertex data is in order to recalculate the normals you might try enabling GL_RESCALE_NORMAL.
this way you could use glScalef to do your scaling and your normals would automatically get rescaled as well.