Texture 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
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Texture problem

Post by kendric »

Hi, I was working on a project based off of the irrilicht\newton tutorial and I had it compiling and running just fine. I started a set of modifications and when i try to run now I get an Access violation writing location 0x81d15a3a when doing this:

IAnimatedMesh *mesh = smgr->getMesh("data/smallcube.3ds");
ISceneNode *node= smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialTexture(0, driver->getTexture("data/crate.jpg"));

When i step into setMaterialTexture, the violation happens on the line accented below:

void setMaterialTexture(u32 textureLayer, video::ITexture* texture)
{
if (textureLayer>= video::MATERIAL_MAX_TEXTURES)
return;

for (u32 i=0; i<getMaterialCount(); ++i)********
getMaterial(i).Textures[textureLayer] = texture;
}

I have worked in java for many years and am comming back to c++
The function pointer is on that line, i hit step into and it throws the access violation. From looking on the net, access violation most commonly is caused by trying to use a null object. The only thing I can gather is the getMaterialCount function is causing it. The material shows as created in the console output. Any ideas as to what might have happened?
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Apparently this was caused by me having a animated mesh with no texture elsewhere in the code.
Post Reply