Sign in to follow this  

Irrlicht problem

This topic is 4414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Attention all Irrlicht users. I have hit a somewhat major snag in my development process. I have a map for my first level and I wanted to test it out so banged out a few lines of code and tried to load it up. Program compiles fine and runs, but doesn't show anything because none of the textures are being loaded. I've tried it in two different formats: CShop native CSM and X formats both give the same results. Mesh loads fine, all textures fail to load. I have verified directory structure as far how it's referenced in the mesh file and placed my textures accordingly. What do you think could be the problem? Thanks. -AJ

Share this post


Link to post
Share on other sites
Have you run it in debug (with console output)? You should see "Could not load texture xxx"
Also the X file has to be text and not binary. Maybe they're in the wrong directory or something.

Can we see the code or a screenie?

Share this post


Link to post
Share on other sites
I'm guessing the textures are in the wrong directory. Unless you specify a texture directory, you usually have to keep the textures in the same directory you keep the map in. At least that's the way it works with DeleD maps, so I assume it's the same.

Share this post


Link to post
Share on other sites
Quote:

Originally posted by Sol462
Have you run it in debug (with console output)? You should see "Could not load texture xxx"
Also the X file has to be text and not binary. Maybe they're in the wrong directory or something.

Can we see the code or a screenie?


Yes I have run it in debug and got the error message you are referring to. The X file is in text and all textures are in the same directory as the X file. Screens of what it is supposed to look like are here(taken from inside the world editor) and here is a screen of what comes up:



And here is the code:


#include "main.h"

int main() {
IrrlichtDevice* device=0;
IVideoDriver* vidDriver = 0;
ISceneManager* sceneMan=0;
device = createDevice(EDT_DIRECTX9, dimension2d<s32>(1024, 768), 32, false, false, false, 0);

vidDriver = device->getVideoDriver();
sceneMan = device->getSceneManager();

IAnimatedMesh *mesh = sceneMan->getMesh("castle.csm");

ICameraSceneNode* camera = 0;

camera = sceneMan->addCameraSceneNodeFPS(0, 100.0f, 300.0f);

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

vidDriver->setAmbientLight(SColorf(64,64,64));


while(device->run()) {
vidDriver->beginScene(true, true, SColor(200, 130, 36, 95));
sceneMan->drawAll();
vidDriver->endScene();
}

device->drop();

return 0;
}



Thanks for the help and any that this extra info illicits.

-AJ

Share this post


Link to post
Share on other sites
You loaded the mesh, but you didn't add it to the scene. Lines 309 to 313 inclusive of ISceneManager.h:


* To load and display a mesh quickly, just do this:
* \code
* SceneManager->addAnimatedMeshSceneNode(
* SceneManager->getMesh("yourmesh.3ds"));
* \endcode

Share this post


Link to post
Share on other sites
depending on how you exported the model, with or without textures applied. I have exported with materials applied and this is the code:

IAnimatedMeshSceneNode* model;
model = m_Scene->addAnimatedMeshSceneNode(m_Scene->getMesh("Data/Media/Models/model.x"));

add this line if you havn't exported with texture;

model->setMaterialTexture(1, m_Video->getTexture("Data/Media/Models/modelTexture.bmp"));

might also add this, or the model may be pitch black
model->setMaterialFlag(EMF_LIGHTING, false);

try that and let us know how you go, hopefully goes good

Share this post


Link to post
Share on other sites
Well well what do ya know....it really was as simple as I thought it was going to be. Thanks guys for all the help. It doesn't render perfectly, the two polys that make up the side of the roof aren't rendering but I don't think that will be too big a deal to fix. Other than that it renders beautifully and once I get some lights in there and some shading, boy it's going to look good [smile] Thanks again.

-AJ

Share this post


Link to post
Share on other sites

This topic is 4414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this