1.SurfaceTexture详解
SurfaceTexture详解
ä¹å讲å°äº flutterçTexture
SurfaceTexture æ¯ Surface å OpenGL ES (GLES) 纹ççç»åãSurfaceTexture ç¨äºæä¾è¾åºå° GLES 纹çç Surface
SurfaceTexture å å«ä¸ä¸ª BufferQueueãå½ç产æ¹å°æ°çç¼å²åºæå ¥éåæ¶ï¼onFrameAvailable() åè°ä¼éç¥åºç¨ãç¶åï¼åºç¨è°ç¨ updateTexImage()ï¼è¿ä¼éæ¾å åå æçç¼å²åºï¼ä»éåä¸è·åæ°ç¼å²åºå¹¶æ§è¡ EGL è°ç¨ï¼ä»è使 GLES å¯å°æ¤ç¼å²åºä½ä¸ºå¤é¨çº¹ç使ç¨ã
å ³é®æ¹æ³ï¼
SurfaceTexture(int texName,源码niucms源码下载 boolean singleBufferMode)æé æ¹æ³
setOnFrameAvailableListener 设置åè°ï¼å½ç产è åå¤å¥½æ°ç帧åä¼è°ç¨Listener
updateTexImage æ´æ°textureå°æå®çGLESContext
detachFromGLContext
attachToGLContext
解ç»/ç»å® å½åGLContext
getTransformMatrix 设置ééæ ·çº¹çç©éµï¼å½æ¸²æçæ¶åä¼ç¨å°è¿ä¸ªæ°æ®
release() å®å ¨éæ¾ SufaceTextureç buffers并ä¸å§Surfaceç¶æ置为abandoned
android-8.0.0_r1 æºç 解æï¼
GLConsumeråæ°è§£éï¼
bqæ¯BufferQueueå建BufferConsumer
tex 表示è¦å°å¾åæµä¼ è¾å°çOpenGL ES纹çå称ã
texTargetæå®äºåªä¸ªçº¹çå°è¢«ç»å®
useFenceSync表示æ¯å¦éè¦åæ¥è®¿é®ç¼å²åº
å¯ä»¥ä»ä¸ä¸ªOpenGL ESä¸ä¸æä¸å离GLConsumerï¼ç¶ååå«ä½¿ç¨detachFromContextåattachToContextæ¹æ³å°GLConsumeréå å°å¦ä¸ä¸ªä¸ä¸æã
å¦æ设置texåæ°åä¼éè¿attachToContextå°GLConsumeréå å°OpenGL ES contextä¸ã
第ä¸æ¬¡è°ç¨updateTexImageæä¼ç»å®ï¼ä¹åææ对updateTexImageçè°ç¨å¿ 须使ç¨ç¸åçå½åOpenGL ES contextè¿è¡
acquireBufferLockedå建EglImage并设置å°EglSlotsä¸
updateAndReleaseLocked æ´æ° EglImage
createIfNeeded å¦æEGLDisplayæ¹åæè cropæ¹ååä¼å建EglImage
bindToTextureTarget å°è°ç¨glEGLImageTargetTexture2DOESå»ç»å®imageå°æå®çç®æ 纹ç
è¿éå建EGLImageKHRï¼EGLImageKHRç¨äºå ±äº«EGLèµæº
EGLçShareContextæ¯å¸¸è§çå ±äº«ä¸ä¸æçæ¹å¼ï¼iOSå¹³å°çEAGLå«ShareGroupï¼ã
å½share_contextåæ°ä¼ å ¥å¦ä¸ä¸ªEGLçcontextæ¶ï¼è¿ä¸¤ä¸ªEGLContextå°±å¯ä»¥å ±äº«çº¹ç以åVBOçã
éè¦æ³¨æçæ¯container objectsä¸è½è¢«å ±äº«ï¼æ¯å¦ï¼
Framebuffer objects
Vertex array objects
Transform feedback objects
Program pipeline objects
åèï¼ /project/deep-android-v1/classes.html
EGLImageKHR: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_image_base.txt