private Texture2D TextureToTexture2D(Texture texture)
{
Texture2D texture2D = new Texture2D(texture.width, texture.height, TextureFormat.RGBA32, false);
RenderTexture currentRT = RenderTexture.active;
RenderTexture renderTexture = RenderTexture.GetTemporary(texture.width, texture.height, );
Graphics.Blit(texture, renderTexture); RenderTexture.active = renderTexture;
texture2D.ReadPixels(new Rect(, , renderTexture.width, renderTexture.height), , );
texture2D.Apply(); RenderTexture.active = currentRT;
RenderTexture.ReleaseTemporary(renderTexture); return texture2D;
}
 private Texture2D RenderTextureToTexture2D(RenderTexture texture)
{
RenderTexture RT = RenderTexture.active;
RenderTexture.active = texture;
Texture2D texture2D = new Texture2D(texture.width,texture.height);
texture2D.ReadPixels(new Rect(,,texture2D.width,texture2D.height),,);
return texture2D;
}

 

Texture转Texture2D的更多相关文章

  1. Texture to texture2D以及texture2D像素反转

    private void SaveRenderTextureToPNG(Texture inputTex, string file) { RenderTexture temp = RenderText ...

  2. CSharpGL(29)初步封装Texture和Framebuffer

    +BIT祝威+悄悄在此留下版了个权的信息说: CSharpGL(29)初步封装Texture和Framebuffer +BIT祝威+悄悄在此留下版了个权的信息说: Texture和Framebuffe ...

  3. 设置texture

    //获取内部资源贴图 public void setInsideTexture() { Texture2D texture = Resources.Load(texture_url) as Textu ...

  4. unity读取Texture文件并转为Sprit

    using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; usin ...

  5. GPU深度发掘(一)::GPGPU数学基础教程

    作者:Dominik Göddeke                 译者:华文广 Contents 介绍 准备条件 硬件设备要求 软件设备要求 两者选择 初始化OpenGL GLUT OpenGL ...

  6. unity发布安卓 截图保存到本地

    using System.IO; //获取系统时间并命名相片名 System.DateTime now = System.DateTime.Now; string times = now.ToStri ...

  7. Unity-WIKI 之 AnimationToPNG

    组件功能 把3D角色的动画录制成PNG一帧一帧输出,这是一个件多么美好的事! 可能遇到问题 有可能当你新建完脚本时会出现下面的错误: `System.IO.File' does not contain ...

  8. Unity3D入门之GUI基础以及常用GUI控件使用(2)

    1.GUI基础 (1)GUI部分是每帧擦除重绘的,只应该在OnGUI中绘制GUI,按钮:GUILayout.Button(“Hello”); 只读标签:GUILayout.Label() (2)修改控 ...

  9. Unity中制作游戏的快照游戏支持玩家拍快照

    Unity中制作游戏的快照游戏支持玩家拍快照 有些游戏支持玩家“拍快照”,也就是将游戏的精彩瞬间以图片的形式记录下来的功能.这个功能比较有趣,而且以后的用途也会很广,为此本节打算介绍:截取矩形区域内游 ...

随机推荐

  1. 接口测试 - ti

    脚本 主程序 #!/bin/bash . /etc/ti/ti.conf . /etc/ti/ti.fun #-basic.json | curl -H "Content-Type:appl ...

  2. Delphi Exif

    这久要用到读取JPG 的 Exif 信息,先是在盒子里下了个Demo,但是那个太老了,是2003年的,后来下载了个CCR 1.5.1是可以使用了,但是我个人用的是Delphi 2007,似乎CCR 1 ...

  3. mvc后台上传

    public ActionResult AddEnclosure(HttpPostedFileBase Filedata) { if (Filedata == null || string.IsNul ...

  4. Python第10天

    装饰器:本质上是函数,为其他函数添加附件功能. 装饰器 = 高阶函数 + 函数嵌套 + 闭包 原则(开放封闭原则):1,不修改被修饰函数代码.2,不修改被修饰函数调用方式. @方法名

  5. VUE系列一:VUE入门:搭建脚手架CLI(新建自己的一个VUE项目)

    一.VUE脚手架介绍 官方说明:Vue 提供了一个官方的 CLI,为单页面应用快速搭建 (SPA) 繁杂的脚手架.它为现代前端工作流提供了 batteries-included 的构建设置.只需要几分 ...

  6. P1100 高低位交换

    题目描述 给出一个小于2^{32}232的正整数.这个数可以用一个3232位的二进制数表示(不足3232位用00补足).我们称这个二进制数的前1616位为“高位”,后1616位为“低位”.将它的高低位 ...

  7. List 去重

    private static List removeDuplicate(List list) { HashSet h = new HashSet(list); list.clear(); list.a ...

  8. supervisord的安装使用

    由于生产环境使用的的tomcat,项目比较重要,所以要做进程守护,本来打算自己写脚本,但是效果不理想,想了下还是用supervisord了 由于很久不用,所以写下来部署步骤 第一:安装,安装的方法有y ...

  9. web移动端区分Android或者ios系统

    // 这里区分方式类似于区分不同浏览器, 这里是es6的写法,在react项目中使用过的. const ua = typeof window === 'object' ? window.navigat ...

  10. wdcp lanmp 安装+搭建网站+安全狗安装 详细实用

    先说一下WDCP,其实就是一个集成环境,优点是有后台可视化面板操作,不像一般的linux似的 都要用代码命令! Linux 的PHP 环境一般就是两个搭配 [mysql+Apache+PHP]和[My ...