can't get textures to load

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
chaotischerapostel
Posts: 19
Joined: Wed Jan 23, 2008 7:10 am

can't get textures to load

Post by chaotischerapostel »

Code: Select all

#include <irrlicht.h>
#include <iostream>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#pragma comment(lib, "Irrlicht.lib")

int main()
{
	IrrlichtDevice *device = 
		createDevice(EDT_DIRECT3D9, dimension2d<s32>(512, 384), 16,
			false, false, false, 0);

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();

	smgr->loadScene("../Amphitheatrum Flavium/media/testarea.irr");

	smgr->addCameraSceneNodeFPS();

	device->getCursorControl()->setVisible(false);

	while(device->run())
	{
		driver->beginScene(true, true, SColor(0, 200, 200, 200));

		smgr->drawAll();

		driver->endScene();
	}
	device->drop();

	return 0;
}
I don't know what I'm doing wrong some .irr files will load some don't, all the textures are in the media folder for my project right next to the .irr file but the console says that it can't load the files. I have tryed .jpg, .bmp could try others but it seems hopeless. Im using irrlicht 1.4 and the irredit 1.4 alpha. Can someone plz attmpt to help me.
wizecoder
Posts: 13
Joined: Thu Jan 03, 2008 9:36 pm

Post by wizecoder »

Could you show us the basic layout of your project because you might be pointing to the wrong location.
chaotischerapostel
Posts: 19
Joined: Wed Jan 23, 2008 7:10 am

Post by chaotischerapostel »

http://www.mediafire.com/?0uzjyyv09ym

Thats my file structure.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

the problem seems to be with the xml file (.irr file), the pathes are wrong (at least if you run the program in a diferent folder)... ;)
open the .irr file and search for this lines:

Code: Select all

<string name="Heightmap" value="../../Documents and Settings/Owner/Desktop/Amphitheatrum Flavium/Media/terrain-heightmap.bmp" />

and 

<texture name="Texture1" value="../../documents and settings/owner/desktop/amphitheatrum flavium/media/wall.jpg" />
and set them to the correct folder(s)... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
chaotischerapostel
Posts: 19
Joined: Wed Jan 23, 2008 7:10 am

Post by chaotischerapostel »

im not shure what you mean. Open it with irrEdit, or is there someway I can accsess the writen form of the file?
Frosty Topaz
Posts: 107
Joined: Sat Nov 04, 2006 9:42 pm

Post by Frosty Topaz »

IrrEdit makes paths based on where it is. It's meant to be used by sticking it in your project's folder where the executable of your project will go.

However, you can also set the working directory of IrrEdit through it's options. Point it at the directory where your project's exe will go and it should work. You may get a message box on IrrEdit startup which is hidden behind the splash screen. Just hit enter if that happens.
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
chaotischerapostel
Posts: 19
Joined: Wed Jan 23, 2008 7:10 am

Post by chaotischerapostel »

i don't know its not working, Visual C++ makes me mad, everything is to confusing, it creates new folders for everything and nothing ever works without extreme amounts of tweeking and file moving. DEV-C++ is much better, more straight foward but it does'nt support Directx right away, and scince im just starting with irrlicht i dont want to have to compile or download anything extra.
Vsk
Posts: 343
Joined: Thu Sep 27, 2007 4:43 pm

Post by Vsk »

chaotischerapostel wrote:i don't know its not working, Visual C++ makes me mad, everything is to confusing, it creates new folders for everything and nothing ever works without extreme amounts of tweeking and file moving. DEV-C++ is much better, more straight foward but it does'nt support Directx right away, and scince im just starting with irrlicht i dont want to have to compile or download anything extra.
Jaja :o , I am too and old user of Dev-c++ that now I am using visual c++ in work.
It is right, dev-c++ is much strigh foward and simple. When I used microsoft visual c++ I thought, that because this was microsoft software it was gonna be more easy to use more "user oriented" but nothing at all. I already manage quite well vsc++ but anyway dev is muchmore simple.

But dev has his problems too.
But at last I've no found any good enogh serious ide for c++.
I am looking for something that as you said be "stargih foward to use" but powerfull in the way that eclipse is to java (Eclipse rocks by the way).
I've installed visual assist in mvc++ but it doesn't copare with the amazing Eclipse. And I don't understand why nobady has implemented this features. (Even if c++ structrs is far complicate and flexible thatn java, this is not excuse :P).

Good luck with vsc++.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

chaotischerapostel wrote:im not shure what you mean. Open it with irrEdit, or is there someway I can accsess the writen form of the file?
simply open it in an editor (notepad), it's just a plaint text file... ;)


For the IDEs, did you try Code::Blocks, it's realy great !!! :)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Frosty Topaz
Posts: 107
Joined: Sat Nov 04, 2006 9:42 pm

Post by Frosty Topaz »

Visual Studio does have lots of options. If you don't know what they are you can probably safely ignore them. It will create files for it's own internal processing. Ignore those too.

By default VS will create a Debug or Release directory where it will put intermediate build files and the final build output. If you want to run the program directly you will have to move it out of the Debug or Release folder and into the parent folder. Or you can run the program directly from VS as if it was already in the parent folder.

There are good reasons for this. It means you can set up builds for different platforms in both debug and release mode, build them all, and not ever have them overwrite each other. It also keeps all the intermediate build files out of the way but still accessible so that incremental builds can occur.

And since it's a Microsoft program, when in doubt, press F1.

But this thread is about problems loading resources in your program. That problem has little or nothing to do with which IDE you use. The paths in the irr file are wrong. They're most likely relative to the location of IrrEdit, not to the location where you saved the irr file. You can fix it by moving IrrEdit, or setting the working directory in IrrEdit's options. You will certainly have to resave the irr file, you may have to reload the textures. That will depend on how IrrEdit internally handles loading/saving.
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
Post Reply