Zero sized texture

Problems building or running the engine, queries about how to use features etc.
Post Reply
Skuisy
Gnoblar
Posts: 2
Joined: Fri May 20, 2016 7:25 pm

Zero sized texture

Post by Skuisy »

Hey everyone,

I'm working on Ogre3D with the Version 1.10.0unstable (Xalafu) and CEGUI.

Here is my problem, i have my first class that implements my menu and the function where all start:

Code: Select all

 
  createCamera();
  createScene();
  createFrameListener();

  while(true) {
    Ogre::WindowEventUtilities::messagePump();
    if(mWindow->isClosed())
        return false;
    if(!mRoot->renderOneFrame())
      return false;
  }
Then i have a button Play that lauches the game:

Code: Select all

void Menu::play()
{
  Bomberman     bomberman(mRoot, mWindow, mSceneMgr, mListener, _nbPlayerLocal, _nbPlayerOther);

  CEGUI::WindowManager::getSingleton().destroyAllWindows();
  mCamera->setPosition(0, 170, 130);
  mCamera->lookAt(Ogre::Vector3(0, 0, 0));
  mSceneMgr->getRootSceneNode()->removeChild("backgroundMenu");
  bomberman.play();
}
But in my class Bomberman, when i try to create my map, i got this error:

Code: Select all

        if (_map[i][j] == 1){
          ent = mSceneMgr->createEntity("cube.mesh");
          nodeCube = _nodeMap->createChildSceneNode();
          nodeCube->attachObject(ent);
          ent->setMaterialName("cubeWall");
          nodeCube->scale(Ogre::Vector3(0.1, 0.15, 0.1));
          nodeCube->translate(startX + (static_cast<int>(i) % static_cast<int>(width)) * 10.0, 5.0, startZ + x * 10.0);
        }
"OGRE EXCEPTION(3:RenderingAPIException): Zero sized texture surface on texture Steel.png face 0 mipmap 0. Probably, the GL driver refused to create the texture."

That's strange because if I try to create my map in my class Menu, i don't have any error..
Any ideas ?


EDIT:

Some news. In my class Map, i create a plane in my constructor:

Code: Select all

Map::Map(Ogre::SceneManager *scenemgr)
{
  std::ifstream	myFile("map.txt");
  std::string	input;
  int		i;

  i = 0;

  mSceneMgr = scenemgr;

  _nodeMap = createGround(mSceneMgr->getRootSceneNode()->createChildSceneNode("nodeRoot"));
}
This is my function createGround:

Code: Select all

Ogre::SceneNode  *Map::createGround(Ogre::SceneNode *nodeRoot) const
{
  Ogre::Entity      *ent;
  Ogre::SceneNode   *nodePlan, *nodeCube;
  Ogre::Plane       plan(Ogre::Vector3::UNIT_Y, 0);

  Ogre::MeshManager::getSingleton().createPlane("sol", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plan, 170, 150, 10, 10, true, 1, 1, 1, Ogre::Vector3::UNIT_Z);
  ent = mSceneMgr->createEntity("sol");
  ent->setMaterialName("DarkGrass");
  nodePlan = mSceneMgr->getRootSceneNode()->createChildSceneNode("nodePlan");
  nodePlan->attachObject(ent);

  // mSceneMgr->createEntity("cubeMesh", "cube.mesh");
  // ent->setMaterialName("cubeWall");
  // nodeCube = nodePlan->createChildSceneNode();
  // nodeCube->attachObject(ent);
  // nodeCube->scale(Ogre::Vector3(0.1, 0.15, 0.1));

  return (nodePlan);
}
And here in this function IF i create a cube and set a material to it (code in commented code), it works properly. So my question is why i cant set a material in my function printMap, that i put just above (with the if _map[j]).

Thank's in advance.
Skuisy
Gnoblar
Posts: 2
Joined: Fri May 20, 2016 7:25 pm

Re: Zero sized texture

Post by Skuisy »

Hey,

I edited my question with more informations.

Thank's.
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: Zero sized texture

Post by frostbyte »

not sure but i think its a threading issue...
opengl context can be only used by the thread that created it( opengl driver map context ID to a thread id )
when you use cegui you use a diffrerent thread so opengl driver does'nt recognize the context

solution: use cegui just to raise a flag( boolean value ) and use it in your rendering-loop
it is always safer do ogre related functions from the thread that initialized ogre...

good luck...
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos
Post Reply