Search the Community
Showing results for tags 'fit texture'.
-
Hi! In my Babylon scene I have a room with a plane, representing a screen. My idea is to display a video on this screen when it's clicked and turn it of if it's clicked again. Code: var screen1 = scene.getMeshByName("Lerret");activateVideoTexture(screen1);function activateVideoTexture(mesh){ mesh.actionManager = new BABYLON.ActionManager(scene); var action = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function(){ mesh.material.diffuseTexture=new BABYLON.VideoTexture("video", ["01_Tumor-Glioblastoma.mp4"], 640, scene, true); mesh.material.emissiveColor = new BABYLON.Color3(1,1,1); }); var action2 = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger, function(){ mesh.material.diffuseTexture.dispose(); mesh.material = new BABYLON.StandardMaterial("texture1", scene); }); mesh.actionManager.registerAction(action).then(action2);}I've got to major problems: 1: When the VideoTexture is activated/applied the screen only show the very top left corner of the video (i think). The screen is all brown, which is the color in the top left corner in the video. It seems like the plane just projects the color of the top-left pixel in the video I also get this warning in the console "[.WebGLRenderingContext-05B3F9D8]RENDER WARNING: there is no texture bound to the unit 1" So how do I make the video fit/stretch to the size of the plane it is applied to? I've set the size parameter to 640, which is the pixel width of the video. Don't know if it is this "size" is refering to. 2: When you click the second time I want the videoTexture to disappear, which actually works as it is now, except that the sound continues. How can I handle this?
- 69 replies
-
- VideoTexture
- sound
-
(and 3 more)
Tagged with: