日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

unity android surface,安卓surfacetexture用unity显示

發布時間:2024/3/26 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 unity android surface,安卓surfacetexture用unity显示 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規已被系統折疊?隱藏此樓查看此樓

那就是這樣?

//先給 生成個 SurfaceTexture 并為他 生成個 紋理ID

int SurfaceTextureId;

int[] SurfaceIdContainer = new int[1]

GLES20.glGenTextures(1, SurfaceIdContainer, 0);

SurfaceTextureId=textureIdContainer[0];

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,SurfaceTextureId);

texture=new SurfaceTexture(SurfaceTextureId);

texture.setOnFrameAvailableListener(this);

//再來個 texture2d

int TextureId;

int[] textureIdContainer = new int[1]

GLES20.glGenTextures(1, textureIdContainer, 0);

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,textureIdContainer[0]);

TextureId=textureIdContainer[0];

然后這個 TextureId 傳給 unity 調用外部紋理

Texture2D.CreateExternalTexture(Screen.width, Screen.height, TextureFormat.BGRA32, false,false, (IntPtr)textureId);

//接著 創建個 FBO

int handle[] = { 0 };

GLES20.glGenFramebuffers(1, handle, 0);

int mFrameBufferID = handle[0];

GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBufferID);

//然后就等 onFrameAvailable調用時 在里面

texture.updateTexImage();

GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFrameBufferID);

//把SurfaceTexture 的紋理加到這個 FBO ?

GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, SurfaceTextureId, 0);

//然后綁定那個2D 圖片?

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, TextureId);

總結

以上是生活随笔為你收集整理的unity android surface,安卓surfacetexture用unity显示的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。