Copying a texture from a C array to a texture each frame

In my app I have a camera feed that I get using a C module. In Python I have a task that does this each frame:

self.label_texture.setRamMipmapPointerFromInt(self.nui.label_map, 0, 640*480*4)

Where self.nui is a binded C class, and self.label_texture was previously initialized like this:

self.label_texture = Texture()
self.label_texture.setup2dTexture(640, 480, Texture.TUnsignedByte, Texture.FRgba8)

It works, but the video feed sometimes freezes for several seconds. I have previously built a C/OpenGL app using the same video feed that works fine, so I suspect there is a problem with how I send the data to Panda. Should I call setRamMipmapPointerFromInt each frame? If not, how do I tell Panda it should read the texture data again?


Hmm, it seems like you’re doing everything right. Is it the texture feed that freezes, or is it possibly the entire frame? Can you see anything interesting happen in PStats when it freezes?


I started testing yesterday in the production machine where this app will run, and it worked fine there.

The production machine has Ubuntu 11.10, and is running the latest build of Panda 1.8. My development machine (where I have the problem) is running OS X 10.7 with a Panda 1.7 build from a month ago.

Because it’s working in the production machine, and we have to finish this app in a few days I’ll ignore the problems in my machine for now :slight_smile: When we are done with this project I’ll see if updating Panda fixes the problem on my Mac.

Thanks a lot for your help.