Hi,

   I used the following codes to create Volume data display.

    osg::ref_ptr<osg::Image> osgImage = new osg::Image;
    osg::ref_ptr<osgVolume::Volume> osgVolume = new osgVolume::Volume;
    osg::ref_ptr<osgVolume::VolumeTile> osgTile = new osgVolume::VolumeTile;

    osg::ref_ptr<osgVolume::ImageLayer>  osgLayer = new 
osgVolume::ImageLayer(osgImage.get());
    osgTile->setLayer(osgLayer.get());
    osgVolume->addChild(osgTile.get());

    osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(0.02f);
    osgVolume::SampleDensityProperty* sd = new 
osgVolume::SampleDensityProperty(0.005);
    osgVolume::TransparencyProperty* tp = new 
osgVolume::TransparencyProperty(1.0);
    osgVolume::TransferFunctionProperty* tfp = new 
osgVolume::TransferFunctionProperty(osgTransFunc.get());

    osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty;
    cp->addProperty(ap);
    cp->addProperty(sd);
    cp->addProperty(tp);
    cp->addProperty(tfp);

    osgLayer->addProperty(cp);
    osgTile->setVolumeTechnique(new osgVolume::RayTracedTechnique);

   The above codes are used on initializing.  I created the image pointer and 
assigned to image layer.  Then I will use setImage method to assign I defined 
the data pointer.

   osgImage->setImage(nx, ny, nz, 4, GL_RGBA, GL_UNSIGNED_BYTE, pdisp_ptr, 
osg::Image::NO_DELETE, 1);  
   //  where nx, ny, nz are size of data (width, height, depth);
   //  where pdisp_ptr is assigned for using defined data


   //Then  I also used the following codes to set the size of volume data.  I 
wonder whether I need the following codes if I already the size into image 
pointer.
   osg::ref_ptr<osg::RefMatrix> matrix = new osg::RefMatrix(nx, 0.0,   0.0,   
0.0,
                                                                                
                        0.0,   ny, 0.0,   0.0,
                                                                                
                        0.0,   0.0,   nx, 0.0,
                                                                                
                        0.0,   0.0,   0.0,   1.0);

   osgLayer->setLocator(new osgVolume::Locator(*matrix));
   osgTile->setLocator(new osgVolume::Locator(*matrix));


   Then I will try to assign the data value to pdisp_ptr.  After that, I will 
call osgImage->dirty().   But there is no changed on viewer.  Any idea?  This 
is my  first time to use osg on my application, so I am not sure whether my 
code is crroect.



Clement



________________________________________
From: [email protected] 
[[email protected]] On Behalf Of J.P. Delport 
[[email protected]]
Sent: Wednesday, 20 July 2011 1:00 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] How to update image data

Hi,

are you calling setImage only once? Are you using osg::Image::NO_DELETE?
How are you changing the data? Do you get the first image correctly?

jp

On 19/07/2011 16:09, [email protected] wrote:
> I tried, but it is no update.  Is there a function from viewer to update the 
> screen?
> ________________________________________
> From: [email protected] 
> [[email protected]] On Behalf Of J.P. Delport 
> [[email protected]]
> Sent: Tuesday, 19 July 2011 11:39 PM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] How to update image data
>
> see the dirty() function
>
> On 19/07/2011 14:10, [email protected] wrote:
>> Hi,
>>
>>       I used the Image to display data.  I used setImage and assigned I 
>> defined unsigned char pointer.  My question is how to let viewer to know to 
>> update the view after completed updated the data into image.
>>
>>
>> Regards,
>> Clement
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> --
> This message is subject to the CSIR's copyright terms and conditions, e-mail 
> legal notice, and implemented Open Document Format (ODF) standard.
> The full disclaimer details can be found at 
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by 
> MailScanner,
> and is believed to be clean.
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.

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

Reply via email to