/// <summary> /// </summary> /// <param name="data"> </param> /// <param name="dest"> </param> protected override void Upload(PixelBox data, BasicBox dest) { OpenGL.BindTexture(this._target, this._textureId); GLESConfig.GlCheckError(this); if (PixelUtil.IsCompressed(data.Format)) { if (data.Format != Format || !data.IsConsecutive) { throw new AxiomException("Compressed images must be consecutive, in the source format"); } if (data.Format != Format || !data.IsConsecutive) { throw new AxiomException("Compressed images must be consecutive, in the source format."); } All format = GLESPixelUtil.GetClosestGLInternalFormat(Format); // Data must be consecutive and at beginning of buffer as PixelStorei not allowed // for compressed formats if (dest.Left == 0 && dest.Top == 0) { OpenGL.CompressedTexImage2D(All.Texture2D, this._level, format, dest.Width, dest.Height, 0, data.ConsecutiveSize, data.Data); } else { OpenGL.CompressedTexSubImage2D(All.Texture2D, this._level, dest.Left, dest.Top, dest.Width, dest.Height, format, data.ConsecutiveSize, data.Data); } GLESConfig.GlCheckError(this); } else if (this._softwareMipmap) { if (data.Width != data.RowPitch) { //TODO throw new AxiomException("Unsupported Texture format!"); } if (data.Height * data.Width != data.SlicePitch) { //TODO throw new AxiomException("Unsupported Texture format!"); } OpenGL.PixelStore(All.UnpackAlignment, 1); GLESConfig.GlCheckError(this); BuildMipmaps(data); } else { if (data.Width != data.RowPitch) { //TODO throw new AxiomException("Unsupported Texture format!"); } if (data.Height * data.Width != data.SlicePitch) { //TODO throw new AxiomException("Unsupported Texture format!"); } if (((data.Width * PixelUtil.GetNumElemBytes(data.Format)) & 3) != 0) { // Standard alignment of 4 is not right OpenGL.PixelStore(All.UnpackAlignment, 1); GLESConfig.GlCheckError(this); } All form = GLESPixelUtil.GetGLOriginFormat(data.Format); All pix = GLESPixelUtil.GetGLOriginDataType(data.Format); GLESConfig.GlCheckError(this); GL.TexSubImage2D(this._faceTarget, this._level, dest.Left, dest.Top, dest.Width, dest.Height, GLESPixelUtil.GetGLOriginFormat(data.Format), GLESPixelUtil.GetGLOriginDataType(data.Format), data.Data); GLESConfig.GlCheckError(this); } OpenGL.PixelStore(All.UnpackAlignment, 4); GLESConfig.GlCheckError(this); }