Hi, this may be a dumb question, I'm working of the tutorial2.py file. I have a Video Capture class that i wrote that captures video into a python string.
I'm trying to blit this string (buffer) onto a texture so i can have a wall with live video on it in crystal space.
Using the tutorial2 as a simple guide to try to get live video on those walls instead of the stone, i have the following code:
def SetupRoom(self):
self.engine.SetLightingCacheMode(0)
# l**** load video texture ****
self.engine.CreateBlackTexture("video", 512, 256, csColor(0, 255, 0), CS_TEXTURE_2D )
#if self.loader.LoadTexture("stone", "/lib/std/stone4.gif")==None:
# FatalError("Error: unable to load texture")
# now get it as a material from the engine
material=self.engine.GetMaterialList().FindByName("stone")
# create the 'room'
room = self.engine.CreateSector("room")
walls = self.engine.CreateSectorWallsMesh(room,"walls")
walls_state = SCF_QUERY_INTERFACE(walls.GetMeshObject().GetFactory(), iThingFactoryState)
walls_state.AddInsideBox (csVector3 (-5, 0, -5), csVector3 (5, 20, 5))
walls_state.SetPolygonMaterial (CS_POLYRANGE_LAST, material);
walls_state.SetPolygonTextureMapping (CS_POLYRANGE_LAST, 3);
return roomdef SetupRoom(self):
def SetupFrame (self):
#print 'SetupFrame called',
elapsed_time = self.vc.GetElapsedTicks()
self.video.update() #get new video frame, init'd in code i didnt post, but it works.
self.video.listToBuffer() #creates the string buffer to pass to blit.
tex = self.engine.FindTexture("video") #find the texture.
tex.GetTextureHandle().Blit(0,0,self.video.width, self.video.height, self.video.buffer, iTextureHandle.RGBA8888)
# Now rotate the camera according to keyboard state
speed = (elapsed_time / 1000.) * (0.03 * 20);
if self.keybd.GetKeyState(CSKEY_RIGHT):
self.view.GetCamera().GetTransform().RotateThis(CS_VEC_ROT_RIGHT, speed)
if self.keybd.GetKeyState(CSKEY_LEFT):
self.view.GetCamera().GetTransform().RotateThis(CS_VEC_ROT_LEFT, speed)
if self.keybd.GetKeyState(CSKEY_PGUP):
self.view.GetCamera().GetTransform().RotateThis(CS_VEC_TILT_UP, speed)
if self.keybd.GetKeyState(CSKEY_PGDN):
self.view.GetCamera().GetTransform().RotateThis(CS_VEC_TILT_DOWN, speed)
if self.keybd.GetKeyState(CSKEY_UP):
self.view.GetCamera().Move(CS_VEC_FORWARD * 4 * speed)
if self.keybd.GetKeyState(CSKEY_DOWN):
self.view.GetCamera().Move(CS_VEC_BACKWARD * 4 * speed)
# Tell 3D driver we're going to display 3D things.
if not self.g3d.BeginDraw(self.engine.GetBeginDrawFlags() | CSDRAW_3DGRAPHICS):
FatalError()
self.view.Draw()
#print 'SetupFrame done'
So it all seems to work, however, when i get to Blit() call, i get this error:
Blitting....Traceback (most recent call last):
File "./scripts/python/tutorial2.py", line 238, in EventHandler
app.SetupFrame()
File "./scripts/python/tutorial2.py", line 191, in SetupFrame
tex.GetTextureHandle().Blit(0,0,self.video.width, self.video.height, self.vi
deo.buffer, iTextureHandle.RGBA8888)
File "/cygdrive/c/Documents and Settings/jricher/My Documents/Projects/Multi-U
AV/CrystalSpaceClient/CS/scripts/python/cspace.py", line 10417, in Blit
def Blit(*args): return _cspace.iTextureHandle_Blit(*args)
NotImplementedError: No matching function for overloaded 'iTextureHandle_Blit'
Any idea on what i'm doing wrong?