The document discusses vertex buffers and index buffers in drawing primitives to the screen. It explains that a vertex buffer stores the vertex data and a draw call specifies the primitive count, while an index buffer stores indices that reference vertices in the vertex buffer to draw different geometric shapes. For example, it shows how to draw a quad using two triangles indexed by two sets of three indices in the index buffer that reference the four vertices in the vertex buffer.
The document discusses vertex buffers and index buffers in drawing primitives to the screen. It explains that a vertex buffer stores the vertex data and a draw call specifies the primitive count, while an index buffer stores indices that reference vertices in the vertex buffer to draw different geometric shapes. For example, it shows how to draw a quad using two triangles indexed by two sets of three indices in the index buffer that reference the four vertices in the vertex buffer.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
C:\Users\user\Desktop\2.
cs
Friday, August 16, 2013 10:17 PM
// primitive count - In buffer creation:
public VertexBuffer ( GraphicsDevice graphicsDevice, int sizeInBytes, //depends on the primitive count. BufferUsage usage ) // primitive count - In draw call public void DrawPrimitives ( PrimitiveType primitiveType, int startVertex, int primitiveCount ) //======================================================================================== // INDEX_BUFFER VS. VERTEX_BUFFER // Imagine You want to draw the following quad on Your screen: /* (0,1)________(1,1) (x,y) plane | | | | |________| (0,0) (1,0) v2________v3 | | | | |________| v0 v1
(x,y) plane
*/
//first triangle indexed by [0][2][1] is v0,v2,v1
//{0,0,0}{0,1,0}{1,0,0} corresponds to drawing (0,0)(0,1)(1,0)
//second triangle indexed by [2][1][3] is v2,v1,v3
//{0,1,0}{1,0,0}{1,1,0} corresponds to drawing (0,1)(1,0)(1,1)