OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Related to osg lines


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Rambabu
Appreciator


Joined: 10 Nov 2016
Posts: 101

PostPosted: Tue Apr 18, 2017 9:22 am    Post subject:
Related to osg lines
Reply with quote

Hi,Iam drawing lines using the following code in osg
LineSymbol* line = style.getOrCreate<LineSymbol>();
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
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 10892

PostPosted: Tue Apr 18, 2017 9:30 am    Post subject:
Related to osg lines
Reply with quote

On 18 April 2017 at 10:22, Rambabu Repaka <> wrote:
Quote:
Hi,Iam drawing lines using the following code in osg
LineSymbol* line = style.getOrCreate<LineSymbol>();
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.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
first_gle
Newbie


Joined: 30 Mar 2017
Posts: 2

PostPosted: Tue Apr 18, 2017 9:41 am    Post subject:
Related to osg lines
Reply with quote

Hello,
I saw these codes in OSGEarth project.


Glen





Quote:

From: Robert Osfield (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Date: 2017-04-18 17:26
To: OpenSceneGraph Users (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: Re: Related to osg lines


On 18 April 2017 at 10:22, Rambabu Repaka <> wrote:
Quote:
Hi,Iam drawing lines using the following code in osg
LineSymbol* line = style.getOrCreate<LineSymbol>();
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.




------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Rambabu
Appreciator


Joined: 10 Nov 2016
Posts: 101

PostPosted: Tue Apr 18, 2017 9:53 am    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
first_gle
Newbie


Joined: 30 Mar 2017
Posts: 2

PostPosted: Tue Apr 18, 2017 10:05 am    Post subject:
Related to osg lines
Reply with quote

Hi,
I think LineSymbol class has no this kind of function. Maybe you could use osg to do it.


Glen



Quote:

From: Rambabu Repaka (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Date: 2017-04-18 17:53
To: osg-users (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
Subject: Re: 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









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Rambabu
Appreciator


Joined: 10 Nov 2016
Posts: 101

PostPosted: Tue Apr 18, 2017 12:24 pm    Post subject:
Reply with quote

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<LineSymbol>();
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<AltitudeSymbol>();
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<osg::Vec3Array> 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<osg::Vec3Array> normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));

osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.0f, 0.0f, 0.0f,0.0f));

osg::ref_ptr<osg::Vec2Array> 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<osg::Geometry> 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<osg::Texture2D> 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<osg::Image> image =
osgDB::readImageFile("D:/Images/roadPic.jpg");
texture->setImage(image);

osg::ref_ptr<osg::Geode> 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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Related to memcpy Rambabu General 1 Mon Apr 17, 2017 4:17 am View latest post
No new posts Visual flicker when using multi-pass ... hartwigw General 3 Sat Jan 07, 2017 6:21 pm View latest post
No new posts Text following lines shaders with osg... kragnfroll General 1 Mon Jan 02, 2017 1:25 pm View latest post
No new posts glsl version 130 not supported (and r... Bruno Oliveira General 9 Sat Oct 22, 2016 6:22 pm View latest post
No new posts LOD for drawing lines of a co-ordinat... Andreas Goebel General 1 Thu Oct 13, 2016 2:28 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP