Example #1
0
        public unsafe void UpdateVertexData <T>(T[] verts, int offset, int vertexCount)
        {
            GCHandle handleVerticies = GCHandle.Alloc(verts, GCHandleType.Pinned);

            IntPtr ptrVerticies = handleVerticies.AddrOfPinnedObject();


            GlBindings.BindBuffer(BufferTarget.GL_ARRAY_BUFFER, m_VertexArrayBufferId);
            GlBindings.BufferSubData(BufferTarget.GL_ARRAY_BUFFER, (IntPtr)0, (IntPtr)(m_Stride * vertexCount), ptrVerticies);

            handleVerticies.Free();
        }
Example #2
0
        public unsafe void UpdateIndexData32(uint[] indicies)
        {
            GCHandle handleIndicies = GCHandle.Alloc(indicies, GCHandleType.Pinned);

            IntPtr ptrIndicies = handleIndicies.AddrOfPinnedObject();

            GlBindings.BindBuffer(BufferTarget.GL_ELEMENT_ARRAY_BUFFER, m_IndexBufferId);
            GlBindings.BufferSubData(BufferTarget.GL_ELEMENT_ARRAY_BUFFER, (IntPtr)0, (IntPtr)(4 * indicies.Length), ptrIndicies);
            handleIndicies.Free();

            m_VertexCount = indicies.Length;
        }