I want to render the video from my webcam on an object from my egg file. Here is the code:
videoTexture = OpenCVTexture() videoTexture.fromCamera() mymodel = loader.loadModel('device.egg') mymodel.reparentTo(render) deviceScreen = self.base.find("**/screen") deviceScreen.setTexture(videoTexture)
This works but the video is stretched proportionally and I want the video fills all the object face. So I have a second thought is to render the video on a card, this is the code:
videoTextureScale = videoTexture.getTexScale() card = CardMaker('videoFace') card.setFrame(-videoTextureScale,videoTextureScale,-videoTextureScale,videoTextureScale) card.setUvRange(Point2(videoTextureScale,0), Point2(0,videoTextureScale)) card = render.attachNewNode(card.generate()) card.reparentTo(deviceScreen.getParent()) card.setTexture(videoTexture)
And a new doubt comes to me, how do I size and locate the card as the screen object?