Skip to main content
GameDev.net gamedev.net
🔒 Locked

MDX SDK Tutorial 2 Question

Started by gp343 Nov 25, 2003 at 7:00 PM 0 replies 400+ views
Original Post
gp343
gp343
Hi there i''m a newbie to MDX, and was wondering how can i create more than one polygon with MDX. As an example tutorial 2 of the MDX SDK creates one polygon, however i want to create another polygon on the same form. I''m very particular about tutorial 2. All i need to see is come sample code that makes use of tutorial 2 to create more than one polygon. You help is highly appreciated. Thanks James
djkno3
djkno3
Well you would have to do a couple of things. To make more than one triangle you would make more than 3 verticies in the vertex array (make sure you make the verticies in multiples of 3 or else it won't work right)

also you will have to make changes to this line
vertexBuffer = new VertexBuffer(typeof(CustomVertex.TransformedColored),
3,//Change this to the number of verticies you have
dev, 0, CustomVertex.TransformedColored.Format, Pool.Default);


and this

CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[3];//change this to the number of verticies you made


finally this line

device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1);//change to the number of objects you made (verticies divided by 3)


and that *should* do it, I'm just playing with DX9 now so if it doesn't work sorry, but it should be somthing along that line


[edited by - djkno3 on November 26, 2003 12:14:56 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.