Hi, I’ve been working with the latest alpha of Panda, and have been seeing a crash. I’ve minimized it down to (I believe) no less than these lines:
from pandac.PandaModules import PNMImage
pickLayer = PNMImage()
uniqueBuffer = base.win.makeTextureBuffer("uniqueBuffer", 128, 128)
pickTex = uniqueBuffer.getTexture()
pickTex.store( pickLayer ) # copy pickTex to an inspectable image
Here are the behaviors:
Panda3D 1.0.5: infinite loop of an assertion failure
Panda3D 1.0.9: graceful failure of assertion failure has_ram_image()
Panda3D 1.1.1 (alpha 2, i believe): no crash
Panda3D 1.2.3: graceful failure
Panda3d 1.4.0: pop-up window with “send error report to microsoft?” type C crash
Well, I guess we should return to the “graceful failure” of 1.2.3, rather than the hard crash of the latest.
Certainly it will trigger a failure of some kind, because you are attempting to copy from a Texture that has no image in system memory. You see, the default behavior of makeTextureBuffer() is to keep the texture image on the graphics card, and not copy it into system memory–the copy is expensive and only necessary if you intend to save the texture image locally, for instance with a call to tex.store().
To specify that the texture should be copied to memory, you need to specify “True” to the fifth parameter of makeTextureBuffer. This is behind the fourth parameter, which defaults to a new Texture object, so you can get to the fifth parameter like this:
uniqueBuffer = base.win.makeTextureBuffer("uniqueBuffer", 128, 128, Texture(), True)
Hmm, I’m actually seeing a graceful assertion-type failure. By “1.4.0”, do you mean a version of Panda that you built yourself from the latest trunk version? And if you built it yourself, did you compile with OPTIMIZE = 4? (This would disable all assertion checks and tend to cause crashes instead.)
Thanks David, I knew that’s what I wanted to do, but I wasn’t quite sure how to do it; I was looking at the docs for GraphicsWindow.makeTextureBuffer(), and trying to figure out whether to pass in those args sequentially as you did in your example, or to try and use a Python named array.
Yeah, the assertion would be nice to have back (if it is indeed missing.)
This is a version Josh gave me here at the ETC, labeled 1.4.0 alpha 3.