BufferSubData() 개인적인 메소드

private BufferSubData ( UInt32 target, IntPtr offset, IntPtr size, void data ) : void
target System.UInt32
offset System.IntPtr
size System.IntPtr
data void
리턴 void
예제 #1
0
        //glMapBuffer <<< NOTE: This method is slower, only use if have to
        //glUnmapBuffer
        public unsafe override void Update(int[] indices, int updateCount)
        {
            GL.BindBuffer(GL.ELEMENT_ARRAY_BUFFER, indexBuffer);

            if (_32BitIndices)
            {
                fixed(int *indicesPtr = indices)
                {
                    IntPtr bufferSize = new IntPtr(indexByteSize * updateCount);

                    GL.BufferSubData(GL.ELEMENT_ARRAY_BUFFER, IntPtr.Zero, bufferSize, indicesPtr);
                }
            }
            else
            {
                var indices16Bit = new short[updateCount];
                for (int i = 0; i != updateCount; ++i)
                {
                    indices16Bit[i] = (short)indices[i];
                }

                fixed(short *indicesPtr = indices16Bit)
                {
                    IntPtr bufferSize = new IntPtr(indexByteSize * updateCount);

                    GL.BufferSubData(GL.ELEMENT_ARRAY_BUFFER, IntPtr.Zero, bufferSize, indicesPtr);
                }
            }

                        #if DEBUG
            Video.checkForError();
                        #endif
        }
예제 #2
0
        public unsafe override void Update(float[] vertices, int updateCount)
        {
            GL.BindBuffer(GL.ARRAY_BUFFER, vertexBuffer);
            fixed(float *verticesPtr = vertices)
            {
                IntPtr bufferSize = new IntPtr(vertexByteSize * updateCount);

                GL.BufferSubData(GL.ARRAY_BUFFER, IntPtr.Zero, bufferSize, verticesPtr);
            }

                        #if DEBUG
            Video.checkForError();
                        #endif
        }