private void SaveRenderTextureToPNG(Texture inputTex, string file)
{
RenderTexture temp = RenderTexture.GetTemporary(inputTex.width, inputTex.height, , RenderTextureFormat.ARGB32);
Graphics.Blit(inputTex, temp);
Texture2D tex2D = GetRTPixels(temp);
RenderTexture.ReleaseTemporary(temp);
File.WriteAllBytes(file, tex2D.EncodeToPNG());
} private Texture2D GetRTPixels(RenderTexture rt)
{
RenderTexture currentActiveRT = RenderTexture.active;
RenderTexture.active = rt;
Texture2D tex = new Texture2D(rt.width, rt.height);
tex.ReadPixels(new Rect(, , tex.width, tex.height), , );
RenderTexture.active = currentActiveRT;
return tex;
}
            Color[] colors = tex.GetPixels(capx, capy, capwidth, capheight);
System.Array.Reverse(colors, , colors.Length); Texture2D t = new Texture2D(capwidth, capheight, TextureFormat.RGB24, true);
//Debug.Log("Pixel size:" + capx + " " + capy + " " + capwidth + " " + capheight);
//t.ReadPixels(new Rect(capx, capy, capwidth, capheight), 0, 0, false); //for (int i = 0; i < capwidth; i++)
//{
// for(int j=0;j<capheight;j++)
// {
// Color temp = t.GetPixel(i, j);
// t.SetPixel(i,j,)
// }
//} t.SetPixels(colors);
t.Apply();

最新文章

  1. liunx 磁盘管理命令记录
  2. Windows.document
  3. iOS打包ipa给客户测试流程
  4. error while loading shared libraries: xxx.so.x&quot;错误的原因和解决办法
  5. android之数据库SQLite(一)
  6. android百度地图中的地图缩放级别
  7. JS 提示框 alert()、confirm()、prompt()的三者的区别
  8. tarjan缩点
  9. getopt()函数
  10. Android绘图机制(一)——自定义View的基础属性和方法
  11. kuangbin带你飞dp专题-基础dp
  12. vue-文字块收缩与展开功能
  13. Hadoop集群及基本组件搭建
  14. sudo权限管理
  15. 微信、陌陌等著名IM软件设计架构详解(转)
  16. wpf-典型的mvvm模式通用中小型管理系统框架0
  17. semi-consistent简介
  18. centos7.x网卡bond配置
  19. AndroidのUI体验之上拉下拉
  20. 在SQL Server中调用.NET程序集

热门文章

  1. 基于操作系统原理的Linux 的用户管理
  2. springboot系列之02-需要了解的宏观知识点
  3. DocumentFormat.OpenXml read excel file
  4. c#学习路线应该靠谱
  5. 如何配置VMware客户虚拟机使用NAT模式联网通信
  6. laravel 5.5 运行在 php7.0 报错 Symfony\Component\Translation\Translator.php FatalThrowableErrorParse error: syntax error, unexpected &#39;?&#39;, expecting variable (T_VARIABLE)
  7. iOS渠道分包2种模式之包内注入文件分包
  8. 《构建之法》MSF&amp;需求分析
  9. Android中内存泄露与如何有效避免OOM总结
  10. 分享一个移动端rem布局的适配mixin