RE: Exception raised when drawing many circles



>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.

.



Relevant Pages

  • Re: Win2K to Win2003
    ... Microsoft Online Partner Support ... Thanks Vincent for your assistance. ... I have now raised a support ticket with Microsoft to resolve the ...
    (microsoft.public.windows.server.migration)
  • RE: Big Blue Error
    ... > Reading your entry below we are experiencing the same problem as you the ... Like you is there anyone that can help us resolve this? ... MSFT seems to be trying to find a solution to the problem. ...
    (microsoft.public.windowsupdate)
  • RE: DataGridBoolColumn behavior
    ... You may set the AllowNull property of the DataGridBoolColumn to false if ... need a 2-state bool column. ... Does it resolve your problem? ... Microsoft Online Partner Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Catching monitor sleep
    ... Rhett Gong [MSFT] wrote: ... > the WMI Win32_DesktopMonitor or SystemParameterInfo with ... > Please let me know if this could resolve your problem. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Things in an OnLoad event
    ... Try following way in your main code (not repro sample) to see if it could ... resolve your problem: ... Rhett Gong [MSFT] ...
    (microsoft.public.dotnet.framework.windowsforms)