private GLBuffer <T> GenerateVertexAttribute <T>(int index, T[] array, int count) where T : struct { var buffer = new GLBuffer <T>(BufferTarget.ArrayBuffer, array, count * sizeof(float), BufferUsageHint.StaticDraw); GL.VertexAttribPointer(index, count, VertexAttribPointerType.Float, false, buffer.Stride, 0); GL.EnableVertexAttribArray(index); return(buffer); }
public GLIndexTable(IndexTable indexTable, List <GLMaterial> materials) { ElementBuffer = new GLBuffer <ushort>(BufferTarget.ElementArrayBuffer, indexTable.Indices, sizeof(ushort), BufferUsageHint.StaticDraw); if (indexTable.PrimitiveType == MMLPrimitiveType.TriangleStrip) { PrimitiveType = GLPrimitiveType.TriangleStrip; } else { PrimitiveType = GLPrimitiveType.Triangles; } Material = materials[indexTable.MaterialIndex]; }