Loading image problem.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Nosvera2
Posts: 16
Joined: Wed May 28, 2008 3:11 am
Location: Van Buren, Arkansas

Loading image problem.

Post by Nosvera2 »

I started messing around with the 2D parts of Irrlicht and am trying to load a large background image. Unfortunately, it won't load and I don't know why. Heres the code that creates and displays it and the error message. The image is located in the same folder as the project code.
Creates:
ITexture* map = driver->getTexture("maptest1.bmp");
driver->makeColorKeyTexture(map, core::position2d<s32>(0,0));

Displays:
driver->beginScene(true, true, video::SColor(255,255,255,255));
driver->draw2DImage(map, core::position2d<s32>(0,0),
core::rect<s32>(0,0,200,200), 0, SColor(255,255,255,255), true);
driver->endScene();

Error Message:
"Could not open file of texture: maptest1.bmp"

*Any help on this would be appreciated.*
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The image is definitely not found. It could be a problem with the working directory of MSVC.
Nosvera2
Posts: 16
Joined: Wed May 28, 2008 3:11 am
Location: Van Buren, Arkansas

...and I fix it how?

Post by Nosvera2 »

Ok, that doesn't help me because I don't know what MSVC directories are or how they work. Could you tell me a possible way to fix it please?
paooolino
Posts: 50
Joined: Wed Dec 21, 2005 12:17 pm
Location: Brescia, Italy
Contact:

Re: Loading image problem.

Post by paooolino »

Nosvera2 wrote:I started messing around with the 2D parts of Irrlicht and am trying to load a large background image. Unfortunately, it won't load and I don't know why. Heres the code that creates and displays it and the error message. The image is located in the same folder as the project code.
It should be located in the same folder as the EXE file.
Try starting the application from his directory and not from your IDE, if you didn't do it yet.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: ...and I fix it how?

Post by rogerborg »

Nosvera2 wrote:Ok, that doesn't help me because I don't know what MSVC directories are or how they work. Could you tell me a possible way to fix it please?
Depends. Could you press F1 or Google?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Nosvera2
Posts: 16
Joined: Wed May 28, 2008 3:11 am
Location: Van Buren, Arkansas

Non-power-of 2????

Post by Nosvera2 »

Ok, thanks to the guy above the guy above this post, I got it loading the image. However, now I get this error I've never seen before and don't understand.

"Performance warning, slow loading of non power of 2 texture."

Does this mean the pixel size of the texture has to be a power of 2? Cuz the pic is 200x200 pixels, which is a power of 2.
paooolino
Posts: 50
Joined: Wed Dec 21, 2005 12:17 pm
Location: Brescia, Italy
Contact:

Post by paooolino »

200 is not power of 2. powers of 2 are:

2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 ...
Post Reply