Image load from resource

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
hari002244
Gnoblar
Posts: 4
Joined: Tue Jan 21, 2014 2:49 pm

Image load from resource

Post by hari002244 »

I have added an existing item(Image) into the Resources folder of my project through visual studio. But how can i load that image and display it. I had figured how to display from tutorials. but the resource tutorial is not understanding. Can anyone explain how to do this?

I am currently doing:

Code: Select all

ConfigFile cf;
	cf.load("resources_d.cfg");
	
	Image bg;
	ResourceGroupManager::getSingleton().addResourceLocation("back","../../Media/thumbnails/background.jpg");
	DataStreamPtr dsp=ResourceGroupManager::getSingleton().openResource("background");
	bg.load(dsp);
But it is throwing an exception ItemIdentityException::

Code: Select all

OGRE EXCEPTION(5:ItemIdentityException): Cannot find an archive factory to deal with archive of type ../../Media/thumbnails/background.jpg in ArchiveManager::load at ..\..\..\..\OgreMain\src\OgreArchiveManager.cpp (line 67)
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Image load from resource

Post by c6burns »

Docu: http://www.ogre3d.org/docs/api/1.9/clas ... a8b2b78c8d

Example usage:

Code: Select all

Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/terrain1_low", "FileSystem", "terrain1");
You are mixing up the parameters :)
Post Reply