2016-05-19 98 views
2

我有一個應用程序使用OpenGL ES 3.0播放360視頻使用天空領域的實施。我想使用OpenGL ES 2.0來支持更多的設備。iOS 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

+0

爲什麼不只是加載球體網格和紋理映射視頻?而不是使用Sky Sphere實施。這樣您就可以輕鬆支持舊設備。 – codetiger

回答

0

的問題是OpenGL的3自動推斷像素的寬度和高度。要使用OpenGL 2,我需要定義像素緩衝區屬性kCVPixelBufferWidthKey和kCVPixelBufferHeightKey。我用修正更新了測試回購。

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