Texture convert to PNIImage

Hi,
when I have questions when I convert my texture to PNMImage, i use texture.store function, but get false back and my PNIImage return 0 by 0 pixels, 0 channels, 255 maxval, anyhint?

I use render to target example and change a little bit:

if __name__ == "__main__":
    demo = TeapotOnTVDemo()
    while(1):
        image=PNMImage()
        tex=demo.check_texture.getTexture()
        tex.store(image)
        print(image)
        demo.taskMgr.step()

after I run this, I got image: 0 by 0 pixels, 0 channels, 255 maxval, really don’t know why.

By default a texture buffer is only stored on the GPU, if you want to access the content of the texture on the CPU, you have to set to_ram=True when calling make_texture_buffer() (or RTM_copy_ram when using add_render_texture() ).

2 Likes