aeolian
25-03-2009 12:52:14
Hi guys,
I'm writting some code to load a custom texture image streamed over a network from a central server than added to ogres resource pool at the client display side. On the server the file is read and transmitted as a list in the form 'name' | 'data'
This is then parsed on the client:
The problem i am having is there are two available Image.load interfaces
And because file.read() returns a string, python interprets the data as being a filename, not the contents of the file itself.
So, my question is, how can i get python to recognise the data stream as data and not as a filename.
Thanks in advance
I'm writting some code to load a custom texture image streamed over a network from a central server than added to ogres resource pool at the client display side. On the server the file is read and transmitted as a list in the form 'name' | 'data'
data = file("Dirt.jpg").read()
startup = {'name':'splash', 'data':data}
This is then parsed on the client:
if material['name'] in self.available_material_list:
#Material already loaded
print "Material already exists, skipping"
return True
else:
print "Attempting to load material ", material['name']
img = ogre.Image()
img.load((material['data']),'')
textureManager = ogre.TextureManager.getSingleton ()
textureManager.loadImage(material['name'], 'General', img)
self.available_material_list.append(material['name'])
return True
The problem i am having is there are two available Image.load interfaces
Load(
class Ogre::Image {lvalue},
class Ogre::SharedPtr<class Ogre::DataStream> {lvalue} stream,
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > type='')
load(
class Ogre::Image {lvalue},
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > strFileName,
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > groupName)
And because file.read() returns a string, python interprets the data as being a filename, not the contents of the file itself.
So, my question is, how can i get python to recognise the data stream as data and not as a filename.
Thanks in advance
