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
Post a Comment