Re: [osg-users] display terrainTile

2009-12-02 Thread Thomas Maier
Hi,

thanks alot, after inserting the technique it complained about a missing 
locator, now it works. thanks alot

Thank you!

Cheers,
Thomas

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] display terrainTile

2009-12-02 Thread Robert Osfield
Hi Thomas,

You'll need to attach a TerrainTechnique to the TerrainTile, for
instance just add an osgTerrrain::GeometryTechnique to the TerrainTile
- this will be responsible to generating the subgraph that does actual
rendering of the tile.

One of the features of osgTerrain is that it allows decouples the data
representation from the rendering implementation, which enables you to
easily change the data or change the rendering technique used.

Robert.

On Wed, Dec 2, 2009 at 3:07 PM, Thomas Maier  wrote:
> Hi,
>
> i got this little piece of code, with which i wanna display a heightfield. I 
> read that for performance reasons one should use terrainTile and add the 
> heightfield to it, but i dont get it to display in the viewer? i know the 
> osgTerrain example, but i find it is too big for starting. i hope someone 
> could help me?
> Here is the small code:
>
> int main() {
>        osg::ref_ptr terrainTile;
>        osg::ref_ptr hf;
>        osg::ref_ptr hfl;
>        osg::ref_ptr group;
>        osg::ref_ptr viewer;
>
>        group                           = new osg::Group();
>        terrainTile             = new osgTerrain::TerrainTile();
>        hf                                      = new osg::HeightField();
>        hfl                             = new osgTerrain::HeightFieldLayer();
>        viewer                          = new osgViewer::Viewer();
>
>
>        hf.get()->allocate(100, 100);
>        hf.get()->setXInterval(10.0);
>        hf.get()->setYInterval(10.0);
>
>        for(unsigned int r=0;r<100;++r)
>        {
>           for(unsigned int c=0;c<100;++c)
>           {
>                   hf.get()->setHeight(c,r,400);
>           }
>        }
>
>        hfl.get()->setHeightField(hf.get());
>        terrainTile.get()->setElevationLayer(hfl.get());
>        group.get()->addChild(terrainTile.get());
>
>
>        viewer.get()->setSceneData(group.get());
>        viewer.get()->realize();
>        viewer.get()->run();
> }
>
>
>
> Thank you!
>
> Cheers,
> Thomas
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=20758#20758
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] display terrainTile

2009-12-02 Thread Thomas Maier
Hi,

i got this little piece of code, with which i wanna display a heightfield. I 
read that for performance reasons one should use terrainTile and add the 
heightfield to it, but i dont get it to display in the viewer? i know the 
osgTerrain example, but i find it is too big for starting. i hope someone could 
help me? 
Here is the small code:

int main() {
osg::ref_ptr terrainTile;
osg::ref_ptr hf;
osg::ref_ptr hfl;
osg::ref_ptr group;
osg::ref_ptr viewer;

group   = new osg::Group();
terrainTile = new osgTerrain::TerrainTile();
hf  = new osg::HeightField();
hfl = new osgTerrain::HeightFieldLayer();
viewer  = new osgViewer::Viewer();


hf.get()->allocate(100, 100);
hf.get()->setXInterval(10.0);
hf.get()->setYInterval(10.0);

for(unsigned int r=0;r<100;++r)
{
   for(unsigned int c=0;c<100;++c)
   {
   hf.get()->setHeight(c,r,400);
   }
}

hfl.get()->setHeightField(hf.get());
terrainTile.get()->setElevationLayer(hfl.get());
group.get()->addChild(terrainTile.get());


viewer.get()->setSceneData(group.get());
viewer.get()->realize();
viewer.get()->run();
}



Thank you!

Cheers,
Thomas

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org