[MDX 2.0] IndexBuffer Example?

Started by
3 comments, last by caledh 18 years, 3 months ago
I have been able to put together a successful VertexBuffer example after reading this post: http://www.gamedev.net/community/forums/topic.asp?topic_id=364970 However, I tried to set up an IndexBuffer and got completely baffled. I'm looking at c-unit's tutorials and trying to modify the code for setting up an index buffer of a simple 2 triangle box. No dice so far. Has anyone been able to set up a successful IndexBuffer using the new GraphicBuffer<> and can you post your source code?
Advertisement
So, is there no one out there working with MDX 2.0? No one who's tried the Index Buffer?
I'm not a big fan of index buffers myself.

One thing I have caught on to, is that some of the overloads of certain functions might not do exactly what you expect them to. To be on the safe side, always use the overload that has the same parameters as the non-managed one does, as it's most likely to do what you expect it to.

Hope this helps :).
Sirob Yes.» - status: Work-O-Rama.
something like that...
m_Verts[0].setPos(Vector(x1,y1,0));m_Verts[1].setPos(Vector(x2,y1,0));m_Verts[2].setPos(Vector(x1,y2,0));m_Verts[3].setPos(Vector(x2,y2,0));	const int points = 6;int ptrs[points] = {0,2,1,1,2,3};vertexBuffer->lock(Verts,4);indexbuffer->lock(ptrs,points);
Insufficent Information: we need more infromationhttp://staff.samods.org/aiursrage2k/
Thank you for the replies. Since this is Managed DirectX 2.0, the C++ example is correct, but doesn't apply since I am working out the C# version. Thank you though. Yes, that is definitely how you do the index buffer. The thing that has really changed here involves the use of the GraphicsBuffer<T> generic to write to the VertexBuffer. I'm just wondering if the same technique is used for the IndexBuffer. I tried to use it in the same way that the SetData() would work except it would Lock the GraphicsBuffer, write the bytes (or indices) and then unlock it. One GraphicsBuffer for the Vertexes and one for the Indexes. Then render the VB, and set the indexes to the IndexBuffer. No dice.

Probably better if I post the code.

Thanks for your responses so far.

This topic is closed to new replies.

Advertisement