PDA

View Full Version : division by zero when using vertex array



ze_jappie
01-10-2002, 10:24 PM
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??

Jappie

knackered
01-11-2002, 12:04 AM
And this division by zero is in the driver dll/so, yes?
Have you tried stepping through your code with a debugger?

ze_jappie
01-11-2002, 05:52 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif
What I mean, isn't there some kind of catch when using vertex arrays that I forgot to take into account?

Jappie

Master Lolo
01-11-2002, 07:17 AM
If you're using visual c++, then when your app crashes you can press the 'retry' button to debug at this moment.

DFrey
01-11-2002, 07:57 AM
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.

ze_jappie
01-12-2002, 09:00 AM
Now this is nice: I tried compiling the program at home (made it at school, but haven't had any spare time whatsoever http://www.opengl.org/discussion_boards/ubb/smile.gif, 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 http://www.opengl.org/discussion_boards/ubb/smile.gif

Jappie