public void SetData <T>(T[] data, int elementCount) where T : struct { CreateIfRequired(); var elementSize = Toolbox.SizeOf <T>(); var usageHint = Dynamic ? BufferUsageHint.DynamicDraw : BufferUsageHint.StaticDraw; GL.BindBuffer(target, handle); PlatformRenderer.CheckErrors(); GL.BufferData(target, new IntPtr(elementSize * elementCount), data, usageHint); PlatformRenderer.CheckErrors(); }
private void UpdateInputLayout() { if (inputLayout == null || (DirtyFlags & MeshDirtyFlags.AttributeLocations) != 0) { var elements = new List <VertexInputElement>(); var stride = Toolbox.SizeOf <T>(); foreach (var elementDescription in GetElementDescriptions()) { elements.Add(new VertexInputElement { Slot = 0, Attribute = AttributeLocations[elements.Count], Stride = stride, Offset = elementDescription.Offset, Format = elementDescription.Format, }); } inputLayout = VertexInputLayout.New(elements.ToArray()); DirtyFlags &= ~MeshDirtyFlags.AttributeLocations; } }