Hi Robert;
I have done my terrain your way which in your introductions. Now I have so cute
terrain :) And I open this *.osga VPB terrain in my application with this code;
osg::ref_ptr node = osgDB::readNodeFile("XXX.osga");
and then I create a Globe with;
osg::Group* root = new osg::Group();
osg::Shape* sphere = new osg::Sphere(osg::Vec3f(0.0, 0.0, 0.0),1.0);
osg::ShapeDrawable* sphereGeometry = new osg::ShapeDrawable(sphere);
osg::Geode* sphereGeode = new osg::Geode();
sphereGeode->addDrawable(sphereGeometry);
root->addChild(sphereGeode);
Everything is gonna well..! Know I texture the terrain on sphere! İf I texture
the image I will use this codes;
osg::Texture2D* Texture = new osg::Texture2D;
// protect from being optimized away as static state:
Texture->setDataVariance(osg::Object::DYNAMIC);
// load an image by reading a file:
osg::Image* image = osgDB::readImageFile("XXX_Images");
if (!image)
{
cout << " couldn't find texture, quitting." << endl;
return -1;
}
// Assign the texture to the image we read from file:
Texture->setImage(image);
// Create a new StateSet with default settings:
osg::StateSet* stateOne = new osg::StateSet();
// Assign texture unit 0 of our new StateSet to the texture
//we just created and enable the texture.
stateOne->setTextureAttributeAndModes
(0,Texture,osg::StateAttribute::ON);
// Associate this state set with the Geode that contains
//the pyramid:
sphereGeode->setStateSet(stateOne);
But in upper code I must to texture this terrain(*.osga)! How can I do that
texturing? What is terrain texturing class in OSG(like osg::Image)?
Thanks very much..!
Ümit UZUN
----------------------------------------
> Date: Wed, 2 Jan 2008 16:38:25 +0000
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: [osg-users] Texturing a Terrain On A Sphere..!
>
> HI Umit,
>
> VPB supports placement of DEM's and Imagery in the correct location on
> the earth, all you need to do is supply your source data with the
> appropriate coordinates systems specified, the easiest way to do this
> is use to use GeoTiffs. Then its simply a case of :
>
> osgdem -t mysourceimage.tif --geocentric -o earth.ive -a earth.osga
>
> Then you just load the data into your viewer and your done - all the
> textures will appear in the correct position on the globe.
>
> Robert.
>
> On Jan 2, 2008 3:29 PM, ümit uzun wrote:
>>
>>
>> Hi Robert;
>>
>> I have tif formatted images some part of the world! And at the beginning, I
>> build them with VPB and so I created a sample terrain(XXX.osga) with
>> VirtulaTerrainBuillder.
>> And now I only want to know how can I texture this part of world terrain to
>> the Sphere surface which position is orijinal for this part of terrain's
>> coordinate.
>>
>> For example; I produce a terrain where belong Arizona! And I texture this
>> part of terrain on its real coordinate like on the earth! Actually not
>> texture this to all sphere surface! Is there any sample about this topic?
>>
>> Not : Sorry for my poor English writing:)
>>
>> Thanks Robert;
>>
>> Ümit UZUN
>>
>>> Date: Mon, 31 Dec 2007 17:39:03 +0000
>>> From: [EMAIL PROTECTED]
>>
>>> To: [email protected]
>>> Subject: Re: [osg-users] Texturing a Terrain On A Sphere..!
>>>
>>> Hi ümit,
>>>
>>> You really need to be more specific about what you are trying to do,
>> & gt; and what type of data you are trying to use. Are you trying to do the
>>
>>> database building yourself? Using VirtualPlanetBuilder??
>>>
>>> Robert.
>>>
>>> On Dec 28, 2007 7:44 PM, ümit uzun wrote:
>>>>
>>>> Hi mew;
>>>>
>>>> Sorry for giving wrong link! the real link is
>> http://www.palomino3d.org/pal/openscenegraph/ and I make a terrain
>> "Converting GIS Satellite Images for OSG" with VTP (Virtual Terrain Project)
>> using osgdem command! I have a *.osga formatted terrain!
>>>> I look at the osgtoy but it can not help me texturing the terrain on
>> sphere!
>>>>
>>>> Ümit UZUN
>>>> ----------------------------------------
>>>>> Date: Fri, 28 Dec 2007 11:10:26 -0600
>>>>> From: [EMAIL PROTECTED]
>>>>> To: [email protected]
>>>>> Subject: Re: [osg-users] Texturing a Terrain On A Sphere..!
>> > ;>
>>
>>>>>
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: [EMAIL PROTECTED] [mailto:osg-users-
>>>>>> [EMAIL PROTECTED] On Behalf Of ümit uzun
>>>>>> Sent: Friday, December 28, 2007 8:09 AM
>>>>>> To: OSG OSG
>>>>>> Subject: [osg-users] Texturing a Terrain On A Sphere..!
>>>>>>
>>>>>> Hi All;
>>>>>>
>>>>>> I have a terrain which has a Cordinate System like in
>>>>>> http://www.palomino3d.org/opnescenegraph And I want to texture map
>> this
>>>>>> terrain on the sphere (like earth) ! How can I do this work on my
>> earth
>>>>>> figure! Could anybody show me how to this please..! Or rotate me to
>>>>>> right example like this!
>>>>>
>>>>> That link doesn't work, s o unclear of your goal, but here's one way
>> to put a texture a sphere
>>
>>>>>
>>>>>
>> http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/src/osgPlugins/globe/
>>>>>
>>>>> -- mew
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>> _________________________________________________________________
>>>> Yeni nesil Windows Live Servisleri'ne şimdi ulaşın!
>>>> http://get.live.com
>>>>
>>>> _______________________________________________
>>>> 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
>>
>> ________________________________
>> Windows Live Messenger'ın için ücretsiz güncelleştirme! Buraya tıkla!
>> _______________________________________________
>> 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
_________________________________________________________________
Windows Live Messenger'ın için ücretsiz güncelleştirme!
http://get.live.com
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org