Re: [osg-users] [osgPlugins] Implementing ReaderWriter in a class within application binary

2010-09-20 Thread Thomas Dickerson
That's good to know, I've registered for a wiki account and will do my best to 
post useful tips that I figure out. Most of the information I've seen on there 
up to this point seems to be related to developing around OSG rather than 
developing to extend it, which seems a little silly given how extensible and 
modular it has been designed to be.
~Thomas


Vermont Sustainable Heating Initiative (http://www.sustainableheatingvt.org) || 
Village2Village Project (http://www.village2villageproject.org)

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





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


Re: [osg-users] [osgPlugins] Implementing ReaderWriter in a class within application binary

2010-09-20 Thread Roland Smeenk
Hi Thomas,

as far as I know there's no developer documentation that describes the steps 
for writing a new readerwriter plugin.  You are welcome to write down your 
experiences while developing your own readerwriter.

You will probably first need to create a new Wiki account. See
http://www.openscenegraph.org/projects/osg/wiki/About/WikiEditing for 
instructions.

kind regards,

Roland Smeenk

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





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


Re: [osg-users] [osgPlugins] Implementing ReaderWriter in a class within application binary

2010-09-20 Thread Thomas Dickerson

Tim Moore wrote:
> You don't need to do anything special for a ReaderWriter that you wish to 
> link into your application. You write the class in exactly the same way, 
> including the REGISTER_OSGPLUGIN macro. Your plugin will be registered early 
> and OSG will use your code to load that file extension without searching for 
> an external plugin.
> 
> 
> Depending on your platform, you might need to perform some additional magic 
> to ensure that your code is actually linked into the application. On Unix, 
> for example, if your plugin code is in a statically-linked library, the .o 
> file containing the REGISTER_OSGPLUGIN "call" won't be linked in unless you 
> create some external reference to code in that file.
> 
> ...
> 
> Not FILE_NOT_HANDLED, but NOT_IMPLEMENTED. Since the default virtual methods 
> return NOT_IMPLEMENTED, it's cleaner not to implement them yourself; you 
> might get the return result wrong :)
> 
> 
> Tim
> 

Ah, that is just exactly what I wanted to know. Many thanks. Are either of 
these clearly documented on the wiki somewhere that I should know about? Or 
would it perhaps be worth starting an entry on developing a new plugin?
Thomas

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





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


Re: [osg-users] [osgPlugins] Implementing ReaderWriter in a class within application binary

2010-09-20 Thread Tim Moore
On Sun, Sep 19, 2010 at 7:06 PM, Thomas Dickerson  wrote:

> Hi Robert,
>
> Thank you for the time you take to make your response, and the level of
> information you included in it. Unfortunately I think you may have
> misunderstood my original question. I was not inquiring about the
> possibility of serializing my own classes into the native binary format, but
> rather I was wishing to know whether a class that implements the
> ReaderWriter functionality (i.e. the readNode and writeNode methods present
> in all osgDB plugins) for a new format must be compiled into an external
> plugin (.so), or whether it can be incorporated directly into my application
> code, and compiled as part of my application binary. The instructions I was
> able to find on the wiki regarding plugin implementation is a bit sketchy,
> and only covered the possibility of helping the osgDB locate ReaderWriter
> plugins that are actually stored as external plugins and not compiled into
> my application.
>
> You don't need to do anything special for a ReaderWriter that you wish to
link into your application. You write the class in exactly the same way,
including the REGISTER_OSGPLUGIN macro. Your plugin will be registered early
and OSG will use your code to load that file extension without searching for
an external plugin.

Depending on your platform, you might need to perform some additional magic
to ensure that your code is actually linked into the application. On Unix,
for example, if your plugin code is in a statically-linked library, the .o
file containing the REGISTER_OSGPLUGIN "call" won't be linked in unless you
create some external reference to code in that file.

Additionally I was wondering what "proper plugin etiquette" is for plugins
> that read a format, but do not also write to it. I noticed some plugins
> conditionally return a
> Code:
> WriteResult(WriteResult::FILE_NOT_HANDLED);
>
>
> My question on this second issue is whether it is "better manners" for my
> ReaderWriter class to implement a writeNode function that ALWAYS returns
> FILE_NOT_HANDLED, or whether it is best to just leave the function
> unimplemented.
>
Not FILE_NOT_HANDLED, but NOT_IMPLEMENTED. Since the default virtual methods
return NOT_IMPLEMENTED, it's cleaner not to implement them yourself; you
might get the return result wrong :)

Tim

>
> Thanks,
> Thomas
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=31803#31803
>
>
>
>
>
> ___
> 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] [osgPlugins] Implementing ReaderWriter in a class within application binary

2010-09-19 Thread Thomas Dickerson
Hi Robert,

Thank you for the time you take to make your response, and the level of 
information you included in it. Unfortunately I think you may have 
misunderstood my original question. I was not inquiring about the possibility 
of serializing my own classes into the native binary format, but rather I was 
wishing to know whether a class that implements the ReaderWriter functionality 
(i.e. the readNode and writeNode methods present in all osgDB plugins) for a 
new format must be compiled into an external plugin (.so), or whether it can be 
incorporated directly into my application code, and compiled as part of my 
application binary. The instructions I was able to find on the wiki regarding 
plugin implementation is a bit sketchy, and only covered the possibility of 
helping the osgDB locate ReaderWriter plugins that are actually stored as 
external plugins and not compiled into my application.

Additionally I was wondering what "proper plugin etiquette" is for plugins that 
read a format, but do not also write to it. I noticed some plugins 
conditionally return a 
Code:
WriteResult(WriteResult::FILE_NOT_HANDLED);


My question on this second issue is whether it is "better manners" for my 
ReaderWriter class to implement a writeNode function that ALWAYS returns 
FILE_NOT_HANDLED, or whether it is best to just leave the function 
unimplemented.

Thanks,
Thomas

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





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


Re: [osg-users] [osgPlugins] Implementing ReaderWriter in a class within application binary

2010-09-19 Thread Robert Osfield
Hi Thomas,

In svn/trunk there is support for extensible native binary format, the
serialization scheme that underpins this also support reading/writing
to ascii and xml format as well.  This will of be part of the 2.9.9
I'll make next week.  The author of this work is Wang Rui, and he's
wirtten a number of posts of the list about it, as well as post an
explanation on the wiki so go have a search for background reading.
You'll also find examples of how to set up serializers in the
src/osgWrappers/serializers/* directories.

In previous stable versions of the OSG (i.e. 2.8.3 and before) there
is only the .ive native binary, but this isn't extensible so doesn't
support serialization of your own classes.

Robert.


On Fri, Sep 17, 2010 at 9:54 PM, Thomas Dickerson  wrote:
> Hey everyone,
> Is it possible for osgDB to load classes implementing ReaderWriter 
> functionality out of my application binary, or must they be stored in a 
> separate .so in the plugin directory? If so, are there any special directions 
> I need to follow to get this working?
>
> Secondly, what is "proper" behavior for a plugin implementing only readNode 
> functionality? Do I leave writeNode unimplemented? Or should I implement 
> writeNode, but only return a WriteResult with a particular error status?
>
> Many thanks,
> Thomas
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=31786#31786
>
>
>
>
>
> ___
> 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