Hi,

   I have a problem to set the origin and the scale of the image.  I am using 
osgVolume to render an image.  Here is my code:


        osg::ref_ptr<osg::Image> osgImage = new osg::Image;
        osgTile = new osgVolume::VolumeTile;
        osgTile->setVolumeTechnique(new osgVolume::RayTracedTechnique());

        osgLayer= new osgVolume::ImageLayer(osgImage.get());
        osgVolume = new osgVolume::Volume;
        osgVolume->addChild(osgTile.get());

       /// the size of the image
        int nx = 350;
        int ny = 350;
        int nz = 60;

        osg::RefMatrix* matrix = new osg::RefMatrix(nx, 0.0,    0.0,    0.0,
                                                                                
0.0,    ny, 0.0,        0.0,
                                                                                
0.0,    0.0,    nz,     0.0,
                                                                                
0.0,    0.0,    0.0,    1.0);
        osgVolume::Locator* locator = new osgVolume::Locator(*matrix);
        osgLayer->setLocator(locator);
        osgLayer->offsetAndScaleImage(osg::Vec4(-nx/2, -ny/2, -nz/2, 1.0), 
osg::Vec4(1.0, 1.0, 1.0, 1.0));
        osgTile->setLocator(locator);
        osgTile->setLayer(osgLayer.get());


When I exxcute the above code, the image is located at somewhere, I need to use 
the mouse to zoom out until I saw the image.  Also the rotation point is at 
image of bottom left.  I would like to set the rotating point at the center of 
the image and it can show the right scale at startup.  Anyone knows how to do 
it?  Many thanks.


Regards,
Clement
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to