private void UpdateEvaluator() { IntPtr pointer = this.PositionBufferPtr.MapBuffer(MapBufferAccess.ReadOnly); if (pointer == IntPtr.Zero)// this happens when not glMakeCurrent(). { //this.PositionBufferPtr.Unbind(); return; } int length = this.PositionBufferPtr.Length; mat4 modelMatrix = this.GetModelMatrix(); var array = new UnmanagedArray <vec3>(length); unsafe { var header = (vec3 *)array.Header.ToPointer(); var bufferHeader = (vec3 *)pointer.ToPointer(); for (int i = 0; i < length; i++) { header[i] = new vec3(modelMatrix * new vec4(bufferHeader[i], 1.0f)); } } this.Evaluator.Setup(array); array.Dispose(); this.PositionBufferPtr.UnmapBuffer(); }
private void Dispose(bool disposing) { if (this.disposedValue == false) { if (disposing) { // Dispose managed resources. } // Dispose unmanaged resources. UnmanagedArray <T> array = this.array; this.array = null; if (array != null) { array.Dispose(); } } this.disposedValue = true; }