public void SetIndicesFromPointer(IntPtr pointer, int length)
        {
            if (length < 0)
            {
                throw new ArgumentException(nameof(length));
            }

            indexBuffer.Bind();
            indexBuffer.CopyRawData(pointer, (uint)length);
            indexBuffer.Unbind();
        }
예제 #2
0
 public StreamDisplayList(uint vertexSize, OpenGL.PrimitiveType primitiveType = OpenGL.PrimitiveType.Triangles, uint vertexBufferSize = 1024, uint indexBufferSize = 1024, ShaderPipeline pipeline = null, Core.VertexAttributeDescription[] vertexAttributes = null) : base(vertexSize, pipeline, vertexAttributes)
 {
     vertexArrayBuffer = new VertexArrayBuffer <T>(vertexSize, OpenGL.BufferUsage.StreamDraw, primitiveType);
     indexBuffer       = new IndexBuffer <T>(OpenGL.BufferUsage.StreamDraw);
     vertexArrayObject = new VertexArrayObject <T>(vertexArrayBuffer, this.pipeline, this.vertexAttributes);
     vertexArrayBuffer.Bind();
     indexBuffer.Bind();
     vertexArrayBuffer.CopyRawData(IntPtr.Zero, vertexSize * vertexBufferSize);
     indexBuffer.CopyRawData(IntPtr.Zero, sizeof(int) * indexBufferSize);
     indexBuffer.Unbind();
     vertexArrayBuffer.Unbind();
 }