hi, I use artoolkit in my ar project,and want to hide the video ,only show the 3D Model,but it seems that MovieTexture is not work without carmaker
from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
from panda3d.vision import *
from direct.actor import Actor
loadPrcFileData("", "auto-flip 1")
class Application(ShowBase):
def __init__(self):
ShowBase.__init__(self)
for i in range(WebcamVideo.getNumOptions()):
print WebcamVideo.getOption(i)
self.option = WebcamVideo.getOption(0)
self.videoTexture = MovieTexture(self.option)
videoTextureScale = Vec2(self.option.getSizeX()/float(self.videoTexture.getXSize()), self.option.getSizeY()/float(self.videoTexture.getYSize()))
self.cardMaker = CardMaker('cardMaker')
self.cardMaker.setFrame(-4/3.0,4/3.0,-1,1)
self.cardMaker.setUvRange(Point2(videoTextureScale[0],0), Point2(0,videoTextureScale[1]))
self.card = render.attachNewNode(self.cardMaker.generate())
self.card.setTexture(self.videoTexture)
self.card.setTwoSided(True)
self.card.setY(5)
self.card.setScale(1.50)
self.card.setSx(-self.card.getSx())
self.card.setBin("fixed", -1)
#self.card.hide()
model = loader.loadModel("panda")
model.reparentTo(render)
model.setBin("fixed", 1)
model.setScale(0.112,0.112, 0.112)
model.setPos(+8, -42, 0)
self.toolkit = ARToolKit.make(base.cam, Filename("./ar/camera_para.dat"), .5)
self.toolkit.attachPattern(Filename("./ar/patt.tu"), model)
taskMgr.add(self.update, "update")
def update(self,task):
self.toolkit.analyze(self.videoTexture)
return task.cont
w = Application()
base.run()
when self.card.hide() ,the marker could not be detected