RE: Exception raised when drawing many circles
- From: v-raygon@xxxxxxxxxxxxxxxxxxxx (Rhett Gong [MSFT])
- Date: Thu, 15 Sep 2005 06:59:11 GMT
>Line.DrawTransform(). The debug message of Direct3D is "Direct3D9: (ERROR)
>:Index stream does not have required number of indices. DrawIndexedPrimitive
>failed."
As you've found, this error raises because there is not enough vertices to meet the PrimitiveCount you specified in the call. I checked your code and you put 145 vertices in
the buffer, 145 /3 = 48 + 1 = 47 + 4. that is why you get DrawIndexedPrimitive call failed.
IDirect3DDevice9::DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2)"
To resolve this issue, you can use following ways:
1> I suggest you measure the buffer first, if buffer_size % 3 != 0, allocate extra buffer to make sure buffer_size % 3 == 0. In you case you need to allocate 147 vertices buffer
and fill the last two vertices with same value as vertex 145.
2> if the last vertex is ok to discard, you can allocate a buffer with 144 vertices to get you program work.
Please let me know if my answer helps you resolve the problem. If there is anything more I can assist you, please feel free to let me know.
Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp&SD=msdn
This posting is provided "AS IS" with no warranties and confers no rights.
.
- References:
- Exception raised when drawing many circles
- From: Olivier Lauffenburger
- RE: Exception raised when drawing many circles
- From: Rhett Gong [MSFT]
- RE: Exception raised when drawing many circles
- From: Olivier Lauffenburger
- RE: Exception raised when drawing many circles
- From: Rhett Gong [MSFT]
- RE: Exception raised when drawing many circles
- From: Olivier Lauffenburger
- RE: Exception raised when drawing many circles
- From: Rhett Gong [MSFT]
- RE: Exception raised when drawing many circles
- From: Olivier Lauffenburger
- RE: Exception raised when drawing many circles
- From: Rhett Gong [MSFT]
- Exception raised when drawing many circles
- Prev by Date: Re: Application.DoEvents() Causing a 4kb memory leak??
- Next by Date: Re: Fading a mesh
- Previous by thread: RE: Exception raised when drawing many circles
- Next by thread: RE: Exception raised when drawing many circles
- Index(es):
Relevant Pages
|