Crash problem

BlitzMax Forums/BlitzMax Programming/Crash problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The following fragment of code is crashing after some cycles of display.All the code is not shown for proprietary reasons. Please suggest the possible causes for the problem.

<CODE>
While Not KeyDown(KEY_ESCAPE)
Cls()
BindTexture( texture )
DrawTexture( texture )
Flip( 1 )
Wend


Function DrawTexture( texture:IDirectDrawSurface7 )
'some vertex initialization code here and finally this fucntion is called
device.DrawPrimitive( D3DPT_TRIANGLEFAN, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1, vertData, numVerts, 0 )
End Function


Function BindTexture( texture:IDirectDrawSurface7 )
Local device:IDirect3DDevice7 = D3D7GraphicsDriver().Direct3DDevice7()
device.SetTexture( 0, texture )
device.SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE )
'.... some other SetTextureState calls here
End Function


</CODE>