【问题标题】:Unity RenderTexture coordinate system origin is bottom-left on iPad, but top-left on iPhone 5SUnity RenderTexture 坐标系原点在 iPad 上是左下角,但在 iPhone 5S 上是左上角
【发布时间】:2016-03-25 18:48:42
【问题描述】:

我正在使用RenderTexture 在我的 Unity 游戏中截屏。

我已经成功地将相机内容绘制到目标RenderTexture 并使用以下代码抓取RenderTexture 的部分内容(即:感兴趣区域):

RenderTexture currentActiveRT = RenderTexture.active;

var renderTex = new RenderTexture ((int)renderTexSize.x, (int)renderTexSize.y, 24, RenderTextureFormat.ARGB32);

CameraScreenshot.targetTexture = renderTex;
CameraScreenshot.gameObject.SetActive (true);
CameraScreenshot.Render ();

RenderTexture.active = renderTex;

// 4. Create the final output Texture, which will have the the ROI drawn in the final size.
var tex = new Texture2D ((int)screenshotSize.x, (int)screenshotSize.y, TextureFormat.RGB24, false);
tex.ReadPixels (fROI, 0, 0, true);

// 5. Restore context and release resources.
RenderTexture.active = currentActiveRT;

在 Unity Editor 和 iPad 设备上一切正常,但是,在我的 iPhone 5S 设备上,最终输出出错,因为使用了 RenderTexture 的不同区域。经过一些调试后,我意识到在编辑器和 iPad 上,RenderTexture 坐标系的原点是 bottom-left(向上),但在 iPhone 上是 top-left (向下)。

有谁知道我该如何解决这个问题?

【问题讨论】:

    标签: ios iphone unity3d textures coordinate-systems


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 2010-11-23
      • 2017-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-28
      • 2016-10-29
      • 1970-01-01
      相关资源
      最近更新 更多