Ejemplo n.º 1
0
        public ClientBuffer(int dimensions, int count, BufferPrimitiveType type)
        {
            Dimensions = dimensions;
            Length     = count * (int)type * dimensions;
            Bytes      = Length * sizeof(float);
            Stride     = Dimensions * sizeof(float);

            Data = new float[Length];
        }
Ejemplo n.º 2
0
        public GPUBuffer(int dimensions, int count, BufferPrimitiveType type, float[] initialData, BufferUsage usage = BufferUsage.DynamicDraw)
        {
            Dimensions = dimensions;
            Length     = Dimensions * count * (int)type;
            Bytes      = Length * sizeof(float);
            Stride     = Dimensions * sizeof(float);

            // gen buffer
            GL.GenBuffers(1, out buffer);
            GL.BindBuffer(BufferTarget.ArrayBuffer, buffer);
            GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(Bytes), initialData, usage);
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
        }
Ejemplo n.º 3
0
 public GPUBuffer(int dimensions, int count, BufferPrimitiveType type, BufferUsage usage = BufferUsage.DynamicDraw) :
     this(dimensions, count, type, null, usage)
 {
 }
Ejemplo n.º 4
0
 public CachedGPUBuffer(int dimensions, int count, BufferPrimitiveType type, BufferUsage usage = BufferUsage.DynamicDraw) :
     this(dimensions, count, type, new float[count * dimensions * (int)type], usage)
 {
 }