Stretching Video Texture

I want to render the video from my webcam on an object from my egg file. Here is the code:

videoTexture = OpenCVTexture() 
mymodel = loader.loadModel('device.egg') 
deviceScreen = self.base.find("**/screen") 

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.setUvRange(Point2(videoTextureScale[0],0), Point2(0,videoTextureScale[1])) 
card = render.attachNewNode(card.generate()) 

And a new doubt comes to me, how do I size and locate the card as the screen object?

You can use setPos and setScale for that.

I was wondering how I would be able to set one object’s size and position with another one’s values.

These sorts of things are illustrated in the manual and in the sample programs.


This is very useful for determining the right values: