[osg-users] osgEphemeris

Robert Osfield robert.osfield at gmail.com
Wed Sep 10 01:00:34 PDT 2008


Hi Filip,

Good detective work.  This does look like a bug in osgEmpheris, where
it's modifying an image, but then not calling dirty() on it where it
should, as its the dirty() call that tells the Texture object to
upload the new the data.  Previously it'll have been relying upon an
inefficiency in the osg::Texture2D::setImage() method that has now
been fixed, so only really worked previously by fluke.

Robert.

On Tue, Sep 9, 2008 at 10:24 PM, Filip Holm <filip.holm at gmail.com> wrote:
> I tracked down the osgEphemris texture update problem earlier today. If you
> have updated to osg-2.6.0 or later there is a change in how Texture2D works.
> Since I do not have the code at hand I'll tell what the problem is and you
> should be able to find it quite easy.
>
> Find the method in ephemeris that writes to the _skyTexture you'll notice
> that it's code that looks something like this:
>
> Image* image = _skyTexture->getImage();
>
> <snip>
>
> unsigned int* ptr = image->data;
>
> //Modifying ptr data
>
> <snip>
>
> _skyTexture->setImage(image);  <----- This is why skytexture texture does
> not update!!
>
> //If you replace the setImage call with the following line, everything works
> fine:
>
> image->dirty();
>
>  new osgCode causing ephemeris bug to appear:
> osg::Texture2D::setImage(Image* image)
> {
>     if(_image == image)
>         return;
>     .....
> }
>
> Let me know if this doesn't fix your problem.
>
> Filip
>
> On Tue, Sep 9, 2008 at 3:30 PM, Viggo Løvli <vigigio at hotmail.com> wrote:
>>
>> Hi Adrian,
>>
>> I have experienced a similar problem.
>>
>> First, check that you set a decent radius for the Ephemeris dome. Example:
>> 5000 meters...
>> Ensure that your far-clip is at least that far away.
>>
>> Ephemeris can be set to follow camera.
>> If you do not set this then you must have camera inside the Ephemeris
>> dome.
>>
>> If you set it to follow camera, then you are supposed to see it all the
>> time.
>>
>> I did however get into a struggle with it where the dome disappeared at
>> seemingly random times.
>> It depended on where my camera was and the radius of the Ephemeris dome.
>> I learnt that if the Ephemeris dome radius was low (5000meters) then it
>> would often pop away (as in not visible) when I moved my camera away from
>> world centre. The problem increased the further away I went. At 10000meters
>> from the world centre I would almost never see the Ephemeris dome.
>>
>> Ephemeris was in fact following my camera, but it does this in a special
>> way. It actually 'update' its position after culling is almost done. So at
>> times it may be culled even though you say it shall follow camera.
>>
>> The solution was to write a node-visitor that turns off culling for
>> Ephemeris's root node and all of its child nodes.
>>
>> I am not sure if this is the same problem as you have but you can try it.
>>
>> Node visitor's apply function looks like this:
>> void DisableCullingVisitor::apply( osg::Node& node )
>> {
>>     node.setCullingActive( false );
>>     traverse( node );
>> }
>> Ensure that it is set up to traverse all children.
>>
>> Hope it helps,
>> Viggo
>>
>> ________________________________
>> Date: Tue, 9 Sep 2008 14:29:04 +0200
>> From: 3dhelp at gmail.com
>> To: osg-users at lists.openscenegraph.org
>> Subject: [osg-users] osgEphemeris
>> Hi just come back to the good old osgEphemeris, i can not see any sky
>> texture, what is wrong. do someone know the bug.
>> adrian
>> --
>> ********************************************
>> Adrian Egli
>> ________________________________
>> Windows Live Messenger. Hold kontakten med vennene dine.
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list