-1

I need to play a video on a OpenGL surface. I think I will need to render each frame of the video to a texture in a loop and then render it via OpenGL. is this possible under ios and/or android ?

genpfault
  • 51,148
  • 11
  • 85
  • 139
zeus
  • 12,173
  • 9
  • 63
  • 184

1 Answers1

1

It is possible on iOS, but it's pretty tricky business to get it to run fast enough to keep up with a video stream.

There is an old demo app from Apple called ChromaKey that takes a CVPixelBuffer from Core Video and maps it directly into an OpenGL texture without having to copy the data. That makes performance MUCH better, and is the approach I would suggest.

I don't know if there is more current sample code available that shows how it's done. That code is back from the days of iOS 6, and was written in Objective-C. (I would suggest doing new iOS development in Swift, since that's where Apple is putting its emphasis.)

Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • 1
    thanks Duncan, i try to find the chromakey demo without any success :( it's perfect objective-c for me :) – zeus Jan 31 '17 at 21:21
  • 1
    I probably have the project somewhere. If you can point me to your email address, I can send it to you (I advise against posting your email address here, at least without obscuring it, since web crawlers tend to latch onto you and blast you with spam.) – Duncan C Jan 31 '17 at 22:51
  • is "nospam" part of the address, or should I remove that? – Duncan C Jan 31 '17 at 23:29
  • 1
    Go ahead and delete that comment. I've sent it. – Duncan C Feb 01 '17 at 11:41
  • 1
    @dunkan : thanks i work on it, sad that on stackoverflow we can't join file here ... – zeus Feb 01 '17 at 14:42
  • The Apple engineer that gave me that project asked me not to post it on public sites. (He said it was ok to share with individual devs, just not post it publicly.) – Duncan C Feb 01 '17 at 14:50