Re: [osg-users] Related to osg lines

2017-04-18 Thread Rambabu Repaka
Hi, Iam using the following code and drawing the lines in osg and clamping the 
lines to the terrain for the purpose of road drawing

LineSymbol* line = style.getOrCreate();
line->stroke()->color() = Color(Color::Black, 0.5f);
line->stroke()->width() = 8.0f;
line->tessellationSize() = 5;
line->stroke()->widthUnits() = Units::METERS;

   AltitudeSymbol* alt = style.getOrCreate();
alt->clamping() = alt->CLAMP_TO_TERRAIN;

   But for me i want road with texture so what iam 
   adding the quad and applying texture in the below code

   osg::ref_ptr vertices = new osg::Vec3Array;
vertices->push_back(osg::Vec3(-1.0f,0.0f,-2.0f));
vertices->push_back(osg::Vec3(1.0f,0.0f,-2.0f));
vertices->push_back(osg::Vec3(1.0f,0.0f,2.0f));
vertices->push_back(osg::Vec3(-1.0f,0.0f,2.0f));

osg::ref_ptr normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));

osg::ref_ptr colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.0f, 0.0f, 0.0f,0.0f));
   
osg::ref_ptr texcoords = new osg::Vec2Array;
texcoords->push_back(osg::Vec2(0.0f, 0.0f));
texcoords->push_back(osg::Vec2(0.0f, 1.0f));
texcoords->push_back(osg::Vec2(1.0f, 1.0f));
texcoords->push_back(osg::Vec2(1.0f, 0.0f));

osg::ref_ptr geom = new osg::Geometry;
geom->setVertexArray(vertices.get());
geom->setNormalArray(normals.get());
geom->setColorArray(colors.get());
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setTexCoordArray(0,texcoords.get());
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));

osg::ref_ptr texture = new osg::Texture2D;
texture->setWrap(osg::Texture2D::WRAP_S,  
osg::Texture2D::CLAMP); 
 
texture->setWrap(osg::Texture2D::WRAP_T, 
osg::Texture2D::CLAMP);
osg::ref_ptr image = 
osgDB::readImageFile("D:/Images/roadPic.jpg");
texture->setImage(image);
   
osg::ref_ptr root = new osg::Geode;
root->addDrawable(geom.get());
  
root->getOrCreateStateSet()->setTextureAttributeAndModes(0,texture.get());

 how to clamp the quad to the terrain  for drawing the road in osgearth  or any 
other way to add the texture to those lines? 




... 

Thank you!

Cheers,
Rambabu

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





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


Re: [osg-users] Related to osg lines

2017-04-18 Thread 龚来恩
Hi,
I think LineSymbol class has no this kind of function. Maybe you could use 
osg to do it.

Glen


8802...@qq.com
 
From: Rambabu Repaka
Date: 2017-04-18 17:53
To: osg-users
Subject: Re: [osg-users] Related to osg lines
Hi,In osgearth project  linesymbol is using  and drawing the road but i want to 
add the texture to those lines,Normally how to add texture to the line in osg ?
 
... 
 
Thank you!
 
Cheers,
Rambabu
 
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70776#70776
 
 
 
 
 
___
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


Re: [osg-users] Related to osg lines

2017-04-18 Thread Rambabu Repaka
Hi,In osgearth project  linesymbol is using  and drawing the road but i want to 
add the texture to those lines,Normally how to add texture to the line in osg ?

... 

Thank you!

Cheers,
Rambabu

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





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


Re: [osg-users] Related to osg lines

2017-04-18 Thread 龚来恩
Hello,
I saw these codes in OSGEarth project.

Glen



8802...@qq.com
 
From: Robert Osfield
Date: 2017-04-18 17:26
To: OpenSceneGraph Users
Subject: Re: [osg-users] Related to osg lines
On 18 April 2017 at 10:22, Rambabu Repaka  wrote:
> Hi,Iam drawing lines using the following code in osg
>  LineSymbol* line = style.getOrCreate();
>  line->stroke()->color() = Color(Color::Black, 0.5f);
>  line->stroke()->width() = 4.5f;
>  line->tessellationSize() = 5;
>  line->stroke()->widthUnits() = Units::METERS;
> How to add texture image to these Lines ?
 
The OSG does not have any class called LineSymbol, so I can't see how
it's related ot the OSG.
___
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


Re: [osg-users] Related to osg lines

2017-04-18 Thread Robert Osfield
On 18 April 2017 at 10:22, Rambabu Repaka  wrote:
> Hi,Iam drawing lines using the following code in osg
>  LineSymbol* line = style.getOrCreate();
>  line->stroke()->color() = Color(Color::Black, 0.5f);
>  line->stroke()->width() = 4.5f;
>  line->tessellationSize() = 5;
>  line->stroke()->widthUnits() = Units::METERS;
> How to add texture image to these Lines ?

The OSG does not have any class called LineSymbol, so I can't see how
it's related ot the OSG.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Related to osg lines

2017-04-18 Thread Rambabu Repaka
Hi,Iam drawing lines using the following code in osg 
 LineSymbol* line = style.getOrCreate();
 line->stroke()->color() = Color(Color::Black, 0.5f);
 line->stroke()->width() = 4.5f;
 line->tessellationSize() = 5;
 line->stroke()->widthUnits() = Units::METERS;
How to add texture image to these Lines ?


... 

Thank you!

Cheers,
Rambabu

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





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