Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ProcessVertices example anyone?

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
0
0
US
I've got a set of 1-8 CustomVertex.PositionColored vertices that I am rendering as a point list. Once I've rendered them, I need to label the points using transformed viewport coordinates and a call to DrawText.

Is there a way to get the transformed viewport coordinates of these vertices from directx w/o doing the math myself?

I assume that Device.ProcessVertices is the way to get the job done but I can't figure out how to make it work. In DirectX 9 C#, I keep getting System.InvalidArgumentException. I created the destBuffer with TransformedColored vertices.

Does anyone have a working example?

Thanks for any links or such!
 
I have also been looking for a good example. The difficult
part of ProcessVertices is setting up the vertex buffers
correctly. There is a complicated set of rules to get
the target buffer to match. It would be nice if there were
simply a function to get the necessary target FVF.

The only way I can find to get it right is to use the debug
driver for DirectX and tweak things based on the debug
messages. If rendering with a vertex shader, it seems even
more complex. I'm trying to get that working now, with no
success so far.
 
In C#, I was trying to come up with a valid vertexDeclaration parameter having no idea what information it encapsulated. In the end, if I remember right, the trick was to pass that parameter as null.

So what I did (since I don't use a mesh) was set the StreamSource (using an untransformed vertex buffer), VertexFormat, Texture, and Transform as though I was going to call DrawPrimitives. Then I called ProcessVertices with a second vertex buffer that was to contain transformed coordinates.

Let me know if you keep having trouble, I've gotten it to work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top