Crystal Space
Welcome, Guest. Please login or register.
November 28, 2015, 02:16:23 pm

Login with username, password and session length
Search:     Advanced search
9100 Posts in 2101 Topics by 10544 Members
Latest Member: Rgr3irc2
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Blit in Python
« previous next »
Pages: [1] Print
Author Topic: Blit in Python  (Read 2028 times)
Posts: 2

View Profile Email
« on: April 19, 2006, 05:20:48 pm »

Hi, this may be a dumb question,  I'm working of the 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):

        # 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

        # 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 =
  #get new video frame, init'd in code i didnt post, but it works. #creates the string buffer to pass to blit.

        tex = self.engine.FindTexture("video") #find the texture.
        tex.GetTextureHandle().Blit(0,0,,,, 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):
        #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/", line 238, in EventHandler
  File "./scripts/python/", line 191, in SetupFrame
deo.buffer, iTextureHandle.RGBA8888)
  File "/cygdrive/c/Documents and Settings/jricher/My Documents/Projects/Multi-U
AV/CrystalSpaceClient/CS/scripts/python/", 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?

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.171 seconds with 15 queries.