Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DrawPrimitiv or DrawIndexedPrimitiv

0 views
Skip to first unread message

Carsten

unread,
Oct 16, 2009, 8:06:24 AM10/16/09
to
I'll spout a new problem. It's a continuation of my previous post.
I have a faint idea, that I've solved these kind of problems before by
moving from Draw_indexed to simply Draw. If that's the case, there
will be an error in the following:

I'll aggregate a vertex- and Index-buffer from 'shapes' that are to be
drawn either DrawPrimitives or DrawIndexedPrimitives. It may not be
rational to add Indices in the indicesbuffer for DrawPrimitive calls,
but I do. Skip the fact that I can move the basevertex, it's too late
right now. So, for each new shape I add, it's indices will be added
the value of the previous shapes accumulated vertexListlength
(right?).
As long as I add shapes to be called on DrawPrimitives, the length of
the indexList is equel to the length of the vertexList, but a
DrawIndexedPrimitives gives a longer indexList, and the two lists
becomes unsyncronized. Any shape recieves a value for the accumulated
Index- and Vertex-offset when they have delivered their vertex/index-
contents to the buffers.
I don't recall to have had any problems when one DrawIndexedPrimitive
shape has been added and Drawn. The problem that I refer to in the
previous post contains the two Identical objects aggregated next to
each other in the buffers .. and the later may be off it's mark
somehow since it causes problems. Becourse the shapes have their
needed offsets for the Draw Call, I use them, and make sure that they
separate appropriately into the DrawPrimitive or DrawIndexedPrimitives
calls.
Something like:
DrawIndexedPrimitiv(0 , PrimitivType.Trianglelist
, shp.VertexOffset , shp.IndexOffset , shp.PrimitivCount)
Or something very equel (again-the exact code is on my other pc)

Is there any error in the principel I use? Or in calling
DrawIndexedPrimitiv and DrawPrimitiv in the same run and on the same
buffers.

On crash-prevention .. I thought to add extra values to the buffers
(of appropriate strides), to let 'off-by-one' errors pass harmlessly.
But I would rather make the code precise.

Carsten

0 new messages