division by zero when using vertex array

Hi ppl,

I made a little program that renders a patch of terrain from a heightmap. Using a brute-force approach to render things works very well. Since I wanted to optimize things a bit, I implemented a vertex array. Now here’s the problem: when rendering the terrain using the vertex array, I get a floating-point division by zero error whenever I move the viewpoint over a certain z-value. If I move over this boundary using a brute-force render, everything’s fine. When I don’t cross that particular value using vertex arrays, everything works fine too. I’m pretty sure that the coordinates I calculated for my array are correct. Any ideas??


And this division by zero is in the driver dll/so, yes?
Have you tried stepping through your code with a debugger?

Well, that’s kinda hard considering it only crashes when the z-value reaches a certain value. Where should I put the breakpoint in this case? Don’t want to go into the debugger every frame
What I mean, isn’t there some kind of catch when using vertex arrays that I forgot to take into account?


If you’re using visual c++, then when your app crashes you can press the ‘retry’ button to debug at this moment.

I would suggest using a conditional breakpoint. Just break into the debugger when your z-value hits that certain value. Then slowly step through your code taking note of all values.

Now this is nice: I tried compiling the program at home (made it at school, but haven’t had any spare time whatsoever , and it works perfectly! Could the problem have something to do with the school-graphics card (Matrox G400) not having the vertex array extension, and the home graphics card (NVidia TNT2) having it?

Anyway, thanks for all your replies, haven’t tried that conditional breakpoint stuff yet, but it sounds mighty handy, and haven’t tried the reply option yet 'cause I use Borland Builder