Archived

This topic is now archived and is closed to further replies.

Wreakon

DirectX Division By Zero

Recommended Posts

Wreakon    121
m_d3d_Device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, uim_vbLoc/36, mi_NumVertices, 0, 210); That line of code sometimes generates a "Division by Zero Error", I don''t know what''s wrong, has anyone had this problem before? Can anyone suggest any reasonbale things I can look in?. Thanks. Wreakon www.pcwebvia.fs2.com

Share this post


Link to post
Share on other sites
Pactuul    122
Well think about it...it''s saying it''s a division error...

Where''s the division?

OHHH yeah I see it : "uim_vbLoc/36"

sorry couldn''t resist...makes sure that uim_vbLoc doesn''t become zero at some point obviously.



Pactuul

"The thing I like about friends in my classes is that they can''t access my private members directly."
"When listening to some one tell about their problem (whether it''s code or not), don''t listen to what went right or wrong, but what they assumed....."



Share this post


Link to post
Share on other sites
Tooon    122
Hmm, maybe you shouldn't have the last parameters as a constant - and instead make it depend on the amount of vertices to be drawn (m_numVertices/3)).
Are you 100% sure that this is the method causing the error? Maybe you could put some sort of log before the functioncall so that you can see what [uim_vbLoc] and [numVertices] contained at the time the error occured...

/ Tooon


Edited by - Tooon on January 9, 2002 2:32:03 AM

Share this post


Link to post
Share on other sites
Wreakon    121
Haha, good one yes,
0/36 is completely valid.
36/0 is not.

Guys I solved it last night, but I didn''t post it. I had an idea of what was going on, my sizes were not in line with the Indexed Buffer size. Basicly my assumption is that when the IB number overflow it causes those errors.


Thanks for suggestions anyway.
Wreakon

Share this post


Link to post
Share on other sites