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. [UnityShader基础]07.MaterialPropertyDrawer

    参考链接: https://blog.csdn.net/e295166319/article/details/60141677 https://docs.unity3d.com/ScriptRefer ...

  2. SAML2.0 SP端处理

    sso response解析 import java.io.ByteArrayInputStream; import java.io.InputStream; import java.security ...

  3. frist Django app— 二、 Model和管理界面

    Django是符合MVC架构的,这里现学习M—Model,而且Django自带了一个管理model(数据库)的界面,所以一并学习. Database 配置 编辑Django的配置文件settings. ...

  4. 使用jTessBoxEditorFX训练Tesseract-OCR教程

    使用jTessBoxEditorFX训练Tesseract-OCR教程 注:1,工具是JAVA编写的,所以在使用工具之间,需要安装JAVA环境. 2,安装Tesseract-OCR应用程序,并将目录添 ...

  5. MVC 执行顺序

    MVC在底层和传统的asp.net是一致的,在底层之上,相关流程如下: 1)Global.asax里,MvcApplication对象的Application_Start()事件中,调用 RouteC ...

  6. django APPEND_SLASH

    #设置项是否开启URL访问地址后面不为/跳转至带有/的路径APPEND_SLASH=True

  7. gitlab api 使用

    api文档:https://docs.gitlab.com/ee/api/projects.html#project-visibility-level 1.项目查询 http://127.0.0.1: ...

  8. 如何配置mysql的超时时间

    http://bigdata.51cto.com/art/201710/555377.htm

  9. 微软Microsoft SQL server 之 MDS connection问题

    微软的MDS和DQS使用面大概还不太广的两个新产品,之前有说道DQS的system.web的register的问题,MDS的问题就经常会碰到链接的问题,当你的用户在Excel中经常都会发生以下问题的时 ...

  10. rem_750

    /* fix the code flash the page */ var globalWidth = document.documentElement.clientWidth;//window.in ...