# [MDX] First steps... [SOLVED]

This topic is 4592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So, I'm trying to port my application over to C# using the .NET 2.0 MDX assemblies. No go. I'm trying to render some transformed vertices, as a first step. Everything runs great, but nothing gets rendered. The clear operation is running correctly. Also, I'm not getting any exceptions, so I'm assuming everything is running correctly. The debug runtimes return nothing useful. I've turned off Z-buffering, alphablending, culling and lighting. I've set all matrices, even though I'm drawing transformed vertices, so it shouldn't matter. The only thing I can think of is not locking/unlocking the buffer correctly. It's not throwing an exception though, so I'm not too sure. Here's my lock code:
            GraphicsBuffer buff =
m_Buffer.Lock<Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored>(0, 20 * 29, LockFlags.None);
Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored[] verts = m_Window.GetVertexData();
for (short i = 0; i < 29; i++)
buff.GetBuffer<Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored>() = verts;
m_Buffer.Unlock();


Any ideas? Thanks a bunch. [EDIT] Turns out one of the overloads of the setstreamsource wasn't working right. Using a different one (the one with all 4 arguments) worked. [Edited by - sirob on December 19, 2005 7:46:54 AM]

##### Share on other sites
Usually when I debug my locking and unlocking of the vertex buffers, I use the VertexBuffer's SetData() method that will do the locking and unlocking internally for you and copy the data into the vertex buffer.

e.g. C#
CustomVertex.PositionColored[] triangle = new CustomVertex.PositionColored[3];triangle[0] = new CustomVertex.PositionColored(-1.0f, 0.0f, 0.0f, Color.Red.ToArgb());triangle[1] = new CustomVertex.PositionColored(-1.0f, 2.0f, 0.0f, Color.Green.ToArgb());triangle[2] = new CustomVertex.PositionColored( 1.0f, 0.0f, 0.0f, Color.Blue.ToArgb());vb = new VertexBuffer(typeof(CustomVertex.PositionColored), 3, Device, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Managed);vb.SetData(triangle, 0, LockFlags.None);

I hope this helps.
Take care.

##### Share on other sites
The VertexBuffer class doesn't seem to have a "SetData" function in the version I'm using (2.00.**). Is it supposed to?

##### Share on other sites
I *guess* not, since most getting/setting in the 2.0 libraries is done using generics. Since they also cancelled the GraphicsStream, I think this holds true. Alas, since MDX2.0 is relatively new and not used widely, there's little we can tell you about it... You could take a look at ZMan's articles about what's changed in MDX2.0, but that's by no means a complete reference...

You might want to consider sticking with 'standard' (non-.NET-2.0) MDX for now. There's little enough information available for that as it is, let alone for the 2.0 version. But if you want to continue with MDX2.0, I think there should be something about filling buffers in the docs, no? (sorry, haven't checked it out myself yet)

##### Share on other sites
Well, I've been waiting a while for MDX2.0, I don't really want to start doing MDX1.1 now and have to switch over to 2.0 pretty soon.

It's gotta work, I was just hoping someone could help out with ideas. I'm guessing since I'm not getting any exceptions it's something generally DX related and not something I'm doing wrong in MDX.

I've check the z-buffer like a million times :).

Anywho, thanks for the help, I'll post if I find something.

[EDIT] see first post.

1. 1
Rutin
19
2. 2
JoeJ
15
3. 3
4. 4
5. 5

• 24
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001778
×