opengl - SCNProgram - video input -


how can attach video input scnprogram in scenekit?

without using custom program, do:

func set(video player: avplayer, on node: scnnode) {     let size = player.currentitem!.asset.tracks(         withmediatype: avmediatypevideo).first!.naturalsize     let videonode = skvideonode(avplayer: player)     videonode.position = cgpoint(x: size.width/2, y: size.height/2)     videonode.size = size     let canvasscene = skscene()     canvasscene.size = size     canvasscene.addchild(videonode)      let material = scnmaterial()     material.diffuse.contents = canvasscene     node.geometry?.materials = [material] } 

which renders video skscene , uses input scnmaterial.

i'd use scnprogram on node, not figure out attach player input. don't mind if solution doesn't uses skscene intermediate rendering. sounds better if it's possible without.

have tried using avplayerlayer, subclass of calayer ? can feed calayer contents property of scnmaterialproperty.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -