displaying 2d images

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Ananditha Roy
Kobold
Posts: 30
Joined: Wed Mar 14, 2012 2:25 pm

displaying 2d images

Post by Ananditha Roy »

Hi ,

I am trying to display the 2D image in my application .I followed the same in the tutorial .


Ogre::MaterialPtr material =Ogre::MaterialManager::getSingleton().create("Background", "General");
material->getTechnique(0)->getPass(0)->createTextureUnitState("level_1.png");//
material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);

Ogre::Rectangle2D* rect = new Ogre::Rectangle2D(true);
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
rect->setMaterial("Background");
rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
rect->setBoundingBox(aabInf);
m_pCubeNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode("Background");
m_pCubeNode->attachObject(rect);
material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setScrollAnimation(-0.25, 0.0);


After running the application , it is not displaying anything as a back ground .
But when i add the default images in the media/Materials/textures/spheremap.png , in the code it is displaying the 2d images . But not displaying my own .png files . Please help me

thanks&regards
ananditha
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: displaying 2d images

Post by bstone »

I'd double check your camera/viewport settings. If you put a regular mesh, does it display fine? What if you a default material is used?
Ananditha Roy
Kobold
Posts: 30
Joined: Wed Mar 14, 2012 2:25 pm

Re: displaying 2d images

Post by Ananditha Roy »

Hi ,

I am getting this error , Please check and help me ...

Error loading texture level11.png. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource level11.png in resource group General or any other group. in ResourceGroupManager::openResource at /Users/davidrogers/Documents/Ogre/ogre-v1-7/OgreMain/src/OgreResourceGroupManager.cpp (line 753)
I dont have this path . i am new to this .. please help me ..Thanks
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: displaying 2d images

Post by bstone »

Check your resources.cfg file. You have to provide correct paths to your resources there.