EDIT: WAIT! May have it… [SOLVED] OnscreenImage & PNMImage - trying suggestions here. Why do I always find this stuff AFTER googling for an hour and posting…?
EDIT2: It works!
I’ve searched around but can’t find a similar topic.
Is there any way to render a PNMImage prior to saving it to a file? Or am I forced to save/load/display? My project is a heightmap editor, so constantly doing that could get expensive. Ideally, I need to update both the 2D and 3D preview in real time (or as close as possible).
I’ve tried passing my PNMImage object directly to OnscreenImage, but it doesn’t seem to like that:
preview2d = OnscreenImage( image=myPNMImage, pos=(0.2,0,-0.2) )
Which results in:
File "C:\Panda3D-1.8.1\direct\gui\OnscreenImage.py", line 55, in __init__ apply(self.setPos, pos) AssertionError: !is_empty() at line 1264 of panda/src/pgraph/nodePath.cxx
Looking at the code in OnscreenImage.py, line 55, it’s failing when setting the pos, which indicates my OnscreenImage is being born as an empty nodepath (I think that’s how it works, anyway…I read something along those lines somewhere). If it can’t accept my PNMImage object, I feel like it should error out there, rather than teasing me with empty hopes and dreams lol
Anyway, is there another approach that would work? I don’t see any other way to display an image anywhere in the API reference or manual, but certainly doesn’t mean that it’s not there.