Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-07-30 Thread Andrew Thompson
Hi all,

An update on this problem, I've managed to solve it by the following steps

[list=]
[*]As I was operating in Debug mode, the IVE plugin required zlib1d.dll - so 
I copy/pasted zlib1.dll and renamed it to d and put this in C:\. I can 
confirm this works now in debug and release
[*]Then I do the serialization to stream as suggested above
[*]Finally, I can get a pointer to the ostringstream's string buffer and copy 
it to my destination file writer to complete the custom serialization
[/list]

/

// Create an output string stream and write the node to the stream
std::ostringstream outputStream;
osgDB::ReaderWriter::WriteResult wr = writer-writeNode(*geode, outputStream, 
0);

// Get the string containing the Geode data and the length of the string
std::string geodeString = outputStream.str();
int geodeLength = geodeString.length();

const char * pGeodeBytes = geodeString.c_str();

// Do work with pGeodeBytes




Thanks for the stringstream code!
Andrew
[/b]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15657#15657





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-07-29 Thread Andrew Thompson
Hi there,

I finally got around to implementing this functionality (!!) - it works great 
with osg as the target format, but with ive the getReaderWriteForExtension 
call returns null. 

I assume I am missing an environment variable or something and the OSG cannot 
find the correct plugin? For clarification, I have osgdb_ive.dll located at 
C:\OpenSceneGraph\Bin\osgPlugins-2.8.0 and I have the following environment 
variables set (under Windows Vista 32bit)

OSG_FILE_PATH = 
C:\OpenSceneGraph\data;C:\OpenSceneGraph\data\Images;C:\OpenSceneGraph\data\fonts

OSG_ROOT = C:\OpenSceneGraph

OSGHOME = C:\OpenSceneGraph

Path = C:\OpenSceneGraph\bin;C:\OpenSceneGraph\share\OpenSceneGraph\bin\ ...

Thank you!

Andrew

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15582#15582





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-07-29 Thread Andrew Thompson
To clarify this problem, 

I have checked my environment variables and added the plugins directory to 
PATH, I also was missing zlib1.dll which I have copied to the bin directory. 
Now when I go to the command prompt and type 

osgconv --format ive

it comes back with a ReaderWriter for the IVE format, whereas before it popped 
up an error that zlib was missing. 

However ...

In my code it still fails to load the ReaderWriter for the IVE format. 

///
std::string plugin = 
osgDB::Registry::instance()-createLibraryNameForExtension(ive);

osgDB::Registry::LoadStatus status = 
osgDB::Registry::instance()-loadLibrary(plugin);

// Status comes back as Not Loaded
/

Is there anything I'm missing here? Thanks very much, 
Andrew

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15593#15593





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-06-05 Thread Andrew Thompson
Hi there, 

This is the first time I've posted on these boards, I wonder if any of you guys 
can help me out?

I am developing a CAD application that uses OpenSceneGraph and I need to 
implement custom serialization of the CAD data to/from disk. This requires 
saving individual nodes and their children to a custom file format along with 
some other data from the app. 

Now I notice OSG has the ability to save/load multiple file formats using the 
Plugins but what I'd really like to do is save/load a node to a memory pointer, 
so the node data is held in memory as opposed to being written to a file. This 
would allow me to serialize this node data inside my own custom file format. 

Is there any way to serialize / deserialize a node to memory using the existing 
plugins? If not, how could I go about implementing this?

Thank you very much in advance, 

AndyB

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=13565#13565





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-06-05 Thread Andrew Thompson
... To add to the above, I just noticed osg::ReaderWriter::writeNode has an 
overload accepting a std::ostream

I imagine this is what I'm looking for - the ability to read and write nodes to 
a memory stream. 

Does anyone have any experience this this overload and can offer comment on it? 

Thank you :)

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=13567#13567





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-06-05 Thread Robert Osfield
Hi Andrew,

If you don't have any custom nodes then you could use the .ive format,
and use the .ive plugins support istream/ostreams.

   osgDB::ReaderWriter* writer =
osgDB::Registry::instance()-getReaderWriterForExtension(ive);
  if(writer)
  {
  std::stringstream outputStream;
  osgDB::ReaderWriter::WriteResult wr =
writer-writeNode(*node,outputStream,0));
  if(wr.success()) {... do your stuff to write output the
stringstream... }

  }


Robert.


On Fri, Jun 5, 2009 at 10:27 AM, Andrew Thompsonandyb1...@yahoo.co.uk wrote:
 Hi there,

 This is the first time I've posted on these boards, I wonder if any of you 
 guys can help me out?

 I am developing a CAD application that uses OpenSceneGraph and I need to 
 implement custom serialization of the CAD data to/from disk. This requires 
 saving individual nodes and their children to a custom file format along with 
 some other data from the app.

 Now I notice OSG has the ability to save/load multiple file formats using the 
 Plugins but what I'd really like to do is save/load a node to a memory 
 pointer, so the node data is held in memory as opposed to being written to a 
 file. This would allow me to serialize this node data inside my own custom 
 file format.

 Is there any way to serialize / deserialize a node to memory using the 
 existing plugins? If not, how could I go about implementing this?

 Thank you very much in advance,

 AndyB

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=13565#13565





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-06-05 Thread Andrew Thompson
Hi Robert, 

Thank you for your reply. Some quick questions for you - 

By custom nodes do you mean my own classes inheriting a node? If so, no I don't 
have these. I am creating geometry inside Geode's in code, but the structure is 
very simple. 

As for the .ive format, I'll do a bit of googling to see what I come up with. 
What I'm ideally looking for is the fastest method of serializing nodes to 
memory stream (ideally binary format as opposed to text) and (of course this is 
a trade-off) the smallest file size once I save these blobs of memory.

The CAD application I am working on has to handle input data with literally 
millions of meshes. 

Thank you!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=13569#13569





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Serializing / Deserializing an osg::Node to memory pointer

2009-06-05 Thread Robert Osfield
Hi Andy,

It does sounds like .ive should foot the bill for you as your just
using standard OSG classes.

Robert.

On Fri, Jun 5, 2009 at 12:45 PM, Andrew Thompsonandyb1...@yahoo.co.uk wrote:
 Hi Robert,

 Thank you for your reply. Some quick questions for you -

 By custom nodes do you mean my own classes inheriting a node? If so, no I 
 don't have these. I am creating geometry inside Geode's in code, but the 
 structure is very simple.

 As for the .ive format, I'll do a bit of googling to see what I come up with. 
 What I'm ideally looking for is the fastest method of serializing nodes to 
 memory stream (ideally binary format as opposed to text) and (of course this 
 is a trade-off) the smallest file size once I save these blobs of memory.

 The CAD application I am working on has to handle input data with literally 
 millions of meshes.

 Thank you!

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=13569#13569





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org