赞
踩
- private Texture2D ConvertTexture(Texture2D source)
- {
- RenderTexture renderTex = RenderTexture.GetTemporary(
- source.width,
- source.height,
- 0,
- RenderTextureFormat.Default,
- RenderTextureReadWrite.Linear);
-
- Graphics.Blit(source, renderTex);
- RenderTexture previous = RenderTexture.active;
- RenderTexture.active = renderTex;
- Texture2D readableText = new Texture2D(source.width, source.height);
- readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
- readableText.Apply();
- RenderTexture.active = previous;
- RenderTexture.ReleaseTemporary(renderTex);
- return readableText;
- }
- private Texture2D ConvertTexture(Texture2D source)
- {
- byte[] pix = source.GetRawTextureData();
- Texture2D readableText = new Texture2D(source.width, source.height, source.format, false);
- readableText.LoadRawTextureData(pix);
- readableText.Apply();
- return readableText;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。