更新时间:2022-03-24 05:11:40
的第三个参数是
The third parameter to glTexImage2D()
is the number of color components in the texture, not the pixel ordering of the texture. You want to use GL_RGBA
here, or it just won't work.
我不相信 glReadPixels()支持c $ c> GL_BGRA 虽然Apple在处理视频图像帧时推荐使用BGRA格式的纹理提供像素数据,但我认为你可以读取RGBA格式的数据,然后将其编码到磁盘,就像你在其他地方所描述的那样。
I don't believe GL_BGRA
is supported by glReadPixels()
on iOS devices as a color format. While providing pixel data to the textures in BGRA format is recommended by Apple when processing video image frames, I think you're fine in reading that back in RGBA format and then encoding that to disk, as you've described elsewhere.
如果你想看到一个示例项目,它在BGRA中使用摄像机视频帧,将它们发送到纹理,使用着色器处理它们,然后读取生成的像素,请点击此处。
If you want to see a sample project that takes camera video frames in BGRA, sends them to a texture, processes them using shaders, and then reads the resulting pixels back, you can check out the one I built here.