public GraphicsBufferBase(GraphicsObject graphicsObject, string name, string attributeName, BufferType bufferType) : base(name) { GraphicsObject = graphicsObject; AttributeName = attributeName; this.bufferType = bufferType; }
public GraphicsBuffer(GraphicsObject graphicsObject, string name, string attributeName, BufferType bufferType) : base(graphicsObject, name, attributeName, bufferType) { GL.GenBuffers(1, out vbo); if (typeof(T) == typeof(sbyte)) { pointerType = VertexAttribPointerType.Byte; dataUnitSize = sizeof(sbyte); dataUnitCount = 1; } else if (typeof(T) == typeof(byte)) { pointerType = VertexAttribPointerType.UnsignedByte; dataUnitSize = sizeof(byte); dataUnitCount = 1; } else if (typeof(T) == typeof(short)) { pointerType = VertexAttribPointerType.Short; dataUnitSize = sizeof(short); dataUnitCount = 1; } else if (typeof(T) == typeof(ushort)) { pointerType = VertexAttribPointerType.UnsignedShort; dataUnitSize = sizeof(ushort); dataUnitCount = 1; } else if (typeof(T) == typeof(int)) { pointerType = VertexAttribPointerType.Int; dataUnitSize = sizeof(int); dataUnitCount = 1; } else if (typeof(T) == typeof(uint)) { pointerType = VertexAttribPointerType.UnsignedInt; dataUnitSize = sizeof(uint); dataUnitCount = 1; } else if (typeof(T) == typeof(float)) { pointerType = VertexAttribPointerType.Float; dataUnitSize = sizeof(float); dataUnitCount = 1; } else if (typeof(T) == typeof(double)) { pointerType = VertexAttribPointerType.Double; dataUnitSize = sizeof(double); dataUnitCount = 1; } else if (typeof(T) == typeof(Vector2)) { pointerType = VertexAttribPointerType.Float; dataUnitSize = sizeof(float); dataUnitCount = 2; } else if (typeof(T) == typeof(Vector3)) { pointerType = VertexAttribPointerType.Float; dataUnitSize = sizeof(float); dataUnitCount = 3; } else if (typeof(T) == typeof(Vector4)) { pointerType = VertexAttribPointerType.Float; dataUnitSize = sizeof(float); dataUnitCount = 4; } }