Texture??

:cry:
i run this code

texImage=PNMImage()
texImage.read(Filename(“models/mapworld.png”))
tex=Texture()
tex.load(texImage)

then it show error like this

AssertionError: _num_channels >=1 && _num_channels <=4 at line 92 of
c:\temp\mkpr\panda3d-1.3.2\built\include\pnmImageHeader.I

the thing is
i want to use OnscreenImage fn

minimap = OnscreenImage (image = ‘models/mapworld.png’, scale = 0.5)
it show error that attribute image must be texture, not nontype

help me plz
:cry:
i want to show image 2d to my game

Hm. I just tried the same thing — not using your image of course, I’m using a different one — but I don’t get the same assertion error. I am using 1.4.0, though. Do you get the same error with 1.4.0?

Gorn,

I assume you’re trying the build a minimap like in the file you downloaded today from the Showcase section.

You are welcome to use the minimap class I wrote. You just change out the background image and anything else you need. You don’t need to write it over again unless you just don’t like how it works.

The PMNImage() function was pretty buggy when I was working with it also. The reason I wanted to use PMNImage instead of something easier like onscreen image or making a texture card was that I wanted to have the actual graphic of the minimap (the landscape) change as time passed. You may not find that necessary for your program.

I would check a couple of things:

  1. Make sure that in the folder where your .py file is located that you have a folder called “models” and that inside that folder you have an image called “mapworld.png”

  2. You need to have a line like

from pandac.PandaModules import * 

or

from pandac.PandaModules import Filename

as well.

Based on the errors you wrote I’d bet it’s the first problem (#1).

:slight_smile: thanks a lot
mavasher

Josh Yelon

sorry i’m don’t know
:confused: i not upgrade to 1.4.0 yet

This error message:

AssertionError: _num_channels >=1 && _num_channels <=4 at line 92 of
c:\temp\mkpr\panda3d-1.3.2\built\include\pnmImageHeader.I 

Simply means that it was unable to load the image file altogether. You must have specified an invalid path to the texture file.

David

:slight_smile: yes David

b’cos i use program paint save picture to .png file
panda3d can’t read it and show that error
i don’t know why?

when i use program adobe photoshop save it to .png file
the code is work

555 :open_mouth: so confuse

I’m not sure, but I think its because of the fact Paint saves png files normally with .PNG - capital letters in the extension. Panda3d paths are case-sensitive. Perhaps that’s the reason…