Discussion:
mixing drawprimitives & Mesh
(too old to reply)
TFM
2007-08-01 17:30:30 UTC
Permalink
Let me put my question subject another way, perhaps should be more
understandable for some people.

Hi,

I just need a suggestion, I'm creating a Mathematical plotter & for
rendering 2D graphs I use:

DrawPrimitives(PrimitiveType.LineStrip, 0, this.vertices.Count - 1);

but for 3D I use the Mesh structure.

Is this approach correct ?

Also as I need to switch between 2D & 3D I think I need to clear the
device data structures & stuff because I don't see a correct 2D plot
once I've made a 3D plot because I set stuff like IndexBuffer &
VertexBuffer for 3D and then need to return back to plain
DrawPrimitives. I guess you understand what I mean

Thanks
Giorgio Tino
2007-08-02 18:03:58 UTC
Permalink
Hi,

I think that I will answer with a question, because I'm dealing with
3D/2D graphs too :-) I'm drawing 3D stuff and I use an Orthogonal
camera, trying to pretend that those 3d meshes I'm drawing are in a 2D
space (but looking tridimensional)... I'm drawing 2D graphs too, and the
big problem I think I have is that, while the 3D part seems to be very
fast because I'm using NOT Transformed vertices (putting tranformation
matrices on the device stack and letting the device do all the
translations/scaling for me), in the 2D graphs I use Transformed
vertices, so I have to provide the 2D position (in screen coords) to
draw the primitives... this means that I need to recalculate per vertex
coordinates at every refresh...

BUT, if I'm not wrong, It seems to me that in OpenGL I can use the
graphic card matrix stuff to push/pop transformations even if I'm
dealing with 2D screen coords, right? Is there a way to do that in
DirectX in a fast way? I mean, some kind of Vertex that is a 2D vertex
on the screen but that can be positioned using the Device World matrix
to move it around? If I have to do that by myself, using C# to compute
the transormations, it seems to me that is way slower :-(

Any ideas?

Thanks!
Post by TFM
Let me put my question subject another way, perhaps should be more
understandable for some people.
Hi,
I just need a suggestion, I'm creating a Mathematical plotter & for
DrawPrimitives(PrimitiveType.LineStrip, 0, this.vertices.Count - 1);
but for 3D I use the Mesh structure.
Is this approach correct ?
Also as I need to switch between 2D & 3D I think I need to clear the
device data structures & stuff because I don't see a correct 2D plot
once I've made a 3D plot because I set stuff like IndexBuffer &
VertexBuffer for 3D and then need to return back to plain
DrawPrimitives. I guess you understand what I mean
Thanks
Loading...