protected override void BindInternal(BufferTarget target) { Internal.OpenGL.Methods.glBindBuffer(OpenGLEngine.BufferTargetToGLBufferTarget(target), Handle); Internal.OpenGL.Methods.glErrorToException(); _target = target; }
protected override void SetDataInternal <T>(T[] data, BufferDataUsage usage) { // ohhh yeahh int size = data.Length * Marshal.SizeOf(typeof(T)); GCHandle ptr = GCHandle.Alloc(data, GCHandleType.Pinned); try { Internal.OpenGL.Methods.glBufferData(OpenGLEngine.BufferTargetToGLBufferTarget(_target), size, ptr.AddrOfPinnedObject(), OpenGLEngine.BufferDataUsageToGLBufferDataUsage(usage)); } finally { ptr.Free(); } Internal.OpenGL.Methods.glErrorToException(); }
protected override void UnbindInternal() { Internal.OpenGL.Methods.glBindBuffer(OpenGLEngine.BufferTargetToGLBufferTarget(_target), 0); Internal.OpenGL.Methods.glErrorToException(); }