Ejemplo n.º 1
0
        public void SetData <T>(T[] source, int sourceStartIndex, int sourceCount, int targetStartIndex = 0) where T : struct
        {
            VerifyParametersSetData(source, sourceStartIndex, sourceCount, targetStartIndex);
            GCHandle gCHandle = GCHandle.Alloc(source, GCHandleType.Pinned);

            try
            {
                int num          = Utilities.SizeOf <T>();
                int vertexStride = VertexDeclaration.VertexStride;
                GLWrapper.BindBuffer(All.ArrayBuffer, m_buffer);
                GL.BufferSubData(All.ArrayBuffer, new IntPtr(targetStartIndex * vertexStride), new IntPtr(num * sourceCount), gCHandle.AddrOfPinnedObject() + sourceStartIndex * num);
            }
            finally
            {
                gCHandle.Free();
            }
        }
Ejemplo n.º 2
0
 public void AllocateBuffer()
 {
     GL.GenBuffers(1, out m_buffer);
     GLWrapper.BindBuffer(All.ArrayBuffer, m_buffer);
     GL.BufferData(All.ArrayBuffer, new IntPtr(VertexDeclaration.VertexStride * VerticesCount), IntPtr.Zero, All.StaticDraw);
 }
Ejemplo n.º 3
0
 public void AllocateBuffer()
 {
     GL.GenBuffers(1, out m_buffer);
     GLWrapper.BindBuffer(All.ElementArrayBuffer, m_buffer);
     GL.BufferData(All.ElementArrayBuffer, new IntPtr(IndexFormat.GetSize() * IndicesCount), IntPtr.Zero, All.StaticDraw);
 }