Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS中创建RGB CVOpenGLESTexture_Ios_Textures_Opengl Es 2.0_Core Video - Fatal编程技术网

在iOS中创建RGB CVOpenGLESTexture

在iOS中创建RGB CVOpenGLESTexture,ios,textures,opengl-es-2.0,core-video,Ios,Textures,Opengl Es 2.0,Core Video,我正在尝试在iOS中创建一个3通道CVOpenGLESTexture 通过在CVPixelBufferCreate()中指定kCVPixelFormatType\u OneComponent8并在CVOpenGLESTextureCacheCreateTextureFromImage()中为格式和内部格式指定kCVPixelFormatType\u OneComponent8,我可以成功创建单通道纹理 类似地,我可以通过在CVPixelBufferCreate()中指定kCVPixelForma

我正在尝试在iOS中创建一个3通道
CVOpenGLESTexture

通过在
CVPixelBufferCreate()
中指定
kCVPixelFormatType\u OneComponent8
并在
CVOpenGLESTextureCacheCreateTextureFromImage()
中为
格式
内部格式
指定
kCVPixelFormatType\u OneComponent8
,我可以成功创建单通道纹理

类似地,我可以通过在
CVPixelBufferCreate()
中指定
kCVPixelFormatType\u 32BGRA
GL\u RGBA
中为
format
internalFormat
指定
CVOpenGLESTextureCacheCreateTextureFromImage()
中的
kcvpixelbufferformattype
成功创建4通道RGBA纹理

我需要创建具有可访问像素的3通道24位RGB(或BGR)纹理。
我似乎找不到
CVPixelBufferCreate()
CVOpenGLESTextureCacheCreateTextureFromImage()
的正确参数(或其组合),这两个参数都不会导致任何一个失败

其他信息
在我的设备上,受支持的FOURCC格式类型由
CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes()
提供:
32
24
16
L565
5551
L555
2vuy
2vuf
yuvf
yuvf
40
L008
L010
2vuf
y416
BGRA
b64a
b48r
b32a
b16g
R10k
v308
v216
v210
v410
r4fl
grb4
,<代码>411f,<代码>4111V,<代码>411f,<代码>422v,<代码>422f,<代码>420f420f,<代码>420f<代码>420f<代码>420f<代码<代码>420f<<代码>420f420f420f420f420f420f420f420f420f420f420f420f420f420f420f420f>,,
w40m
x420
x422
x444
x44p
xf20
xf22
xf44
xf4p
x22p
xf2p
b3a8

有趣的是,其中一些值没有在
CVPixelBuffer.h
中定义


当我将
kCVPixelFormatType_24RGB
24==0x18
)传递到
CVPixelBufferCreate()
时,它成功了,但是
CVOpenGLESTextureCacheCreateTextureFromImage()
失败了:
kcvreturnpixelbuffernotopengelcompatible

,虽然我会很高兴被证明是错误的,并告诉我如何做到这一点

正如我所展示的(再次回答我自己),可以列出设备上支持的所有fourCC缓冲区格式,以及与每种fourCC格式相关联的一组格式属性

与此问题相关的标志为:

  • kCVPixelFormatOpenGLESCompatibility
  • kCVPixelFormatContainsAlpha
    :应为false
  • kCVPixelFormatContainsRGB
    :注意:仅从
    \uuuIphone\u8\u0
    支持,但不是严格必需的
  • 使用调试器,我找到了另一个有用的键:
    CFSTR(“IOSurfaceOpenGLESTextureCompatibility”)
    ,它将验证OpenGL ES纹理支持直接像素访问,而不需要(速度较慢的)
    glReadPixels()
    glTexImage2D()
不幸的是,使用这些标志,目前似乎没有这种RGB/BGR支持的格式