Hi all,

I'm trying to write a simple read/write acces to .osg files for my own class, 
using the REGISTER_DOTOSGWRAPPER macro, but nothing happens...

This is what I do:

in my IO.h:


Code:
#include "MyClass.h"

using namespace osgDB;

bool MyClass_readLocalData(osg::Object&, osgDB::Input&);
bool MyClass_writeLocalData(const osg::Object&, osgDB::Output&);

REGISTER_DOTOSGWRAPPER(MyClass)
(
    new osgMyClass::MyClass,
    "MyClass",
    "Object Node Group MyClass",
    &MyClass_readLocalData,
    &MyClass_writeLocalData
);



and in IO.cpp:


Code:
#include "IOPlanet.h"

bool MyClass_readLocalData(osg::Object& obj, osgDB::Input& fr)
{
   std::cout << "Hello in Read!" << std::endl;
}

bool MyClass_writeLocalData(const osg::Object& obj, osgDB::Output& fout)
{
   std::cout << "Hello in Write!" << std::endl;
}



and the "MyClass" class is the simplest thing in the world:

#include <iostream>


Code:
namespace osgMyClass 
{

        class MyClass: public osg::Group
        {
                public:

                        MyClass() { valeur = 1.0f; std::cout << "Hello 
MyClass!"<< std::endl; }
                        ~MyClass() {}

                public:

                        float value;
        };

}



I'm generating a dll with the IO files, and I put it in the osgPlugins 
directory, but the "Hello" messages are never readable, trying this in the main 
of an app:


Code:
osgMyClass::MyClass* test= new osgMyClass::MyClass();

osgDB::writeNodeFile((osg::Node&)*test, "test.osg");
osgDB::writeObjectFile((osg::Object&)*test, "test2.osg");



So where is the mistake ? Does the name of the dll must be something like 
"osgdb_osgMyClass" ? Changing its name changes nothing... seems OSG doesn't 
find it.

I try before to read and write data using the osgPlugins scheme with :
REGISTER_OSGPLUGIN(plt, ReaderWriterPLT), and all works well. So I understand 
the process with plugins, but not with dotosgwrappers...

If someone can help me, it's seems to be a little thing missing at a little 
place :)

thanks a lot

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to