Original Post
I''ve got a really weird bug and was hoping someone could point me in the right direction... I''ve made a simple sprite class that splits up a texture into a given number of frames and makes a Vertex Buffer with two triangles with proper tex coords.
When I try to render the sprite, it always renders two frames forward. If I ask for frame 0, it gives me frame 2. If there are 16 frames (0-15) and I ask for 13, 14 or 15 I get frame 15. If I only have 2 frames it just makes frames 0 and 1 render frame 1. I can get "around" this problem if I ask for frames -2 for frame 0, frame 10 for frame 12, etc... I checked with D3Dspy and my VB is setup like I expect it''s supposed to be, and when I try to render frame 0 I make this call:
(*dev)->SetStreamSource(0, m_pVB, 0, sizeof(SPR_VERTEX)); (*dev)->SetFVF(D3DFVF_SPR_VERTEX); int start = m_curFrame * 6; (*dev)->DrawPrimitive(D3DPT_TRIANGLELIST, start, 6);D3Dspy shows the DrawPrimitive call is made with start = 0, but yet it draws vertices 12-17 as I see them in D3Dspy''s VB data window. If I set m_curFrame = -2, the DrawPrimitive gets called with start = -12... and it draws vertices 0-5... @!#$@#%! any ideas?