using Microsoft.Xna.Framework.Graphics; VertexBuffer vb = new VertexBuffer(graphicsDevice, typeof(VertexPositionColor), 12, BufferUsage.WriteOnly); VertexPositionColor[] vertices = new VertexPositionColor[12]; // ... code to create and populate vertices ... vb.SetData(vertices); GraphicsDevice.SetVertexBuffer(vb);
using SharpGL; using SharpGL.VertexBuffers; VertexBuffer buffer = new VertexBuffer(); float[] vertices = new float[12]; // ... code to create and populate vertices ... buffer.Create(gl); buffer.Bind(gl); buffer.SetData(gl, vertices);Package/library used: For Example 1, the Microsoft.Xna.Framework.Graphics namespace is used, which is part of the XNA Framework. For Example 2, the SharpGL library is used, which is a free C# OpenGL wrapper for creating 3D graphics.