/// <summary> /// </summary> protected override void UnlockImpl() { if (this._lockedToScratch) { if (this._scratchUploadOnUnlock) { // have to write the data back to vertex buffer this.WriteData(this._scratchOffset, this._scratchSize, this._scratchPtr, this._scratchOffset == 0 && this._scratchSize == sizeInBytes); } // deallocate from scratch buffer ((GLESHardwareBufferManager)HardwareBufferManager.Instance).DeallocateScratch(this._scratchPtr); this._lockedToScratch = false; } else { OpenGL.BindBuffer(All.ElementArrayBuffer, this._bufferId); GLESConfig.GlCheckError(this); if (!OpenGLOES.UnmapBuffer(All.ElementArrayBuffer)) { throw new AxiomException("Buffer data corrupted, please reload"); } } isLocked = false; }