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 - Access directive function from component class or template -

python - Evaluating the next line in a For Loop while in the current iteration -

php - Auto increment employee ID -