gpt4 book ai didi

使用 OpenGL ES 2.0 的 iOS 360 视频

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:00:12 24 4
gpt4 key购买 nike

我有一个应用程序,它使用 OpenGL ES 3.0 来播放 360 度视频,并使用天空球体实现。我想使用 OpenGL ES 2.0 来支持更多设备。

在 ViewController.swift 中,我在 setupContext() 方法中创建了 EAGLContext,它与 .OpenGLES3 一起使用,但是当我尝试使用 .OpenGLES2 时,我只看到黑屏。没有错误消息,我无法辨别 OpenGL ES 2.0 不支持哪些 API 函数。

context = EAGLContext(API: .OpenGLES3)
EAGLContext.setCurrentContext(context)

如何使用 OpenGL ES 2.0 使用天空球显示 360 度视频?主要实现在 Skysphere.swift 中。谢谢。

示例应用程序可在此处找到:https://github.com/devinshively/TestVideoPlayer

最佳答案

问题在于 OpenGL 3 会自动推断像素宽度和高度。要使用 OpenGL 2,我需要定义像素缓冲区属性 kCVPixelBufferWidthKey 和 kCVPixelBufferHeightKey。我用修复程序更新了测试库。

let pixelBufferAttributes = [kCVPixelBufferPixelFormatTypeKey as String : NSNumber(unsignedInt: kCVPixelFormatType_32BGRA),
kCVPixelBufferWidthKey as String : 1024,
kCVPixelBufferHeightKey as String : 512]

关于使用 OpenGL ES 2.0 的 iOS 360 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37330776/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com