Re: [osg-users] Change color of node read from dxf file

2018-11-19 Thread Chris Hanson
That's not really how it's done.

You can't add the Node you got from ReadNodeFile as a child of a Geode. I
don't even think that should compile because Geode isn't derive from
osg::Group.

What you need to do is create a visitor to travel through the children of
the "lines" Node (that Node is almost 100% certain to be an osg::Group with
many children), finding any osg::Nodes you are interested in and examining
how the color is set up on them (per-vertex, overall, etc) and changing the
color data there.


At a glance, this old example shows sort of what I'm talking about, but it
may need tweaking to compile with current sources:
http://forum.openscenegraph.org/viewtopic.php?t=10590=next

On Mon, Nov 19, 2018 at 10:56 AM Diego Mancilla 
wrote:

> I'm a newbie on OpenSceneGraph and 3D development.
>
>  I have a dxf file that contains a bunch of 3DPOLYLINES (with different
> colors). So far I have been able to read and display them on a viewer, but
> I haven been able to change the color of the rendered lines. I believe that
> I'm not understanding properly the graph relationships.
>
>  I'm  using the "Quick Start Guide" as reference and modifying an example
> that I found on the web.
>
>  A code snippet of what I have:
>
>
> Code:
> osg::ref_ptr geom = new osg::Geometry;
> osg::ref_ptr c = new osg::Vec4Array;
> geom->setColorArray(c.get());
> geom->setColorBinding(osg::Geometry::BIND_OVERALL);
> c->push_back(osg::Vec4(1.f, 0.f, 0.f, 1.f));
>
> osg::ref_ptr n = new osg::Vec3Array;
> geom->setNormalArray(n.get());
> geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
> n->push_back(osg::Vec3(0.f, -1.f, 0.f));
>
> osg::Node* lines = osgDB::readNodeFile("lines.dxf");
> osg::Geode* geode = new osg::Geode;
>
> geode->addChild(lines);
> geode->addDrawable(geom.get());
>
> std::cout << "Num Drawables in geode: " << geode->getNumDrawables() <<
> std::endl;
>
> osg::Camera* camera = new osg::Camera;
> camera->setViewport(0, 0, this->width(), this->height());
> camera->setClearColor(osg::Vec4(0.9f, 0.9f, 1.f, 1.f));
> float aspectRatio = static_cast(this->width()) /
> static_cast(this->height());
> camera->setProjectionMatrixAsPerspective(30.f, aspectRatio, 1.f, 1000.f);
> camera->setGraphicsContext(_mGraphicsWindow);
>
> _mViewer->setCamera(camera);
> _mViewer->setSceneData(geode);
> osgGA::TrackballManipulator* manipulator = new osgGA::TrackballManipulator;
> manipulator->setAllowThrow(false);
> this->setMouseTracking(true);
> _mViewer->setCameraManipulator(manipulator);
> _mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
> _mViewer->realize();
>
>
>
> Thank you!
>
> Cheers.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75209#75209
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-19 Thread Chris Hanson
Let me check with Thomas.

On Mon, Nov 19, 2018 at 5:46 PM Grigoriy Mylnikov 
wrote:

> At the moment, I implemented ShaderLight class that extends osg::Light and
> allows to use several point lights with per-pixel lighting (using my
> shaders). It works on android emulator.
>
> I'm not sure about where is a best place to add that lights' uniforms to
> scene graph (e.g. rootStateSet->addUniform(myLight0->positionUniform); ).
> For now, I just call it after creating every light. I think ShaderLight
> object should do it itself, but how can it get a StateSet to which uniforms
> should be added?
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75213#75213
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] possible (probable) state leakage in the master

2018-11-19 Thread Robert Osfield
Hi Nick,

I am working 100% on VSG most of my available work time right now.  On the
OSG side I'll be focused on bug fixes for the 3.6 branch, rather than
pushing development on OSG master.   My recommendation is that you test the
OSG-3.6 branch and see if the problem exists there, if it does create a
small example then I or others can test this and see if there is anything
amiss with your usage or with the OSG.  We can then get a fixed checked
into 3.6 branch.

If there are fixes in 3.6 that warrant a new release I'll look to getting a
3.6.4 stable release before Christmas, will need community support and
testing for this to happen.

Cheers,
Robert.


On Mon, 19 Nov 2018 at 13:15, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi Robert,
>
> I was experiencing this the last month or a two with the master without
> making noise about but it seam it is a real problem. I was under lazy
> impression that maybe my implementation wsa wrong but now with very simple
> case I can reproduce it:
>
> I have two files, one simple geometry as ive with colors per vertex, and
> other file as obj without any materials. The colors from the first file are
> somehow getting it thru to the other model by simply osgviewer file1 file2.
>
> In previous facing of this behavior, I was having shaders in the scene
> where I wanted parts to be rendered by shaders, parts by ffp, in a
> scenegraph like this: root->child1 with shader, root->child2 ffp. After
> updating (was really about two months ago) to 3.6.3 if I can recall (or
> even now with the master) I had to explicitly disable the shader from
> child1 to not be applied to child2 by setting it an empty Program(
> setModeEtc...(new osg::Program) ).
>
> If you are not in rush and have some time I can send you the files I have
> here that reproduce the problem (not for public), just ping me.
>
> XUbuntu 16.04
> Windows 10
> osg 3.7.0
>
> Thanks a bunch as always!
> Cheers, Nick
>
> --
> trajce nikolov nick
> ___
> 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] OpenGL ES 2.0 and LIGHTING

2018-11-19 Thread Grigoriy Mylnikov
At the moment, I implemented ShaderLight class that extends osg::Light and 
allows to use several point lights with per-pixel lighting (using my shaders). 
It works on android emulator.

I'm not sure about where is a best place to add that lights' uniforms to scene 
graph (e.g. rootStateSet->addUniform(myLight0->positionUniform); ). For now, I 
just call it after creating every light. I think ShaderLight object should do 
it itself, but how can it get a StateSet to which uniforms should be added?

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





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


Re: [osg-users] A question of "ShaderPipeline disabled" about OSG for MacOS

2018-11-19 Thread Dening Luo
Hi everyone,

I have a question about OSG for MacOS. My system is OS X EI Capitan, whose 
version is 10.11.6. , and the Graphics card is NVIDIA Geforce GTX 680MX.


I have built the OpenSceneGraph 3.7.0 successfully, but I come across a problem 
of "
void StateSet::setGlobalDefaults() ShaderPipeline disabled.

" when I run the examples. I don't know what is the OSG bug, or the computer 
system problem.

Thank you!

Cheers,
loening

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





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


[osg-users] possible (probable) state leakage in the master

2018-11-19 Thread Trajce Nikolov NICK
Hi Robert,

I was experiencing this the last month or a two with the master without
making noise about but it seam it is a real problem. I was under lazy
impression that maybe my implementation wsa wrong but now with very simple
case I can reproduce it:

I have two files, one simple geometry as ive with colors per vertex, and
other file as obj without any materials. The colors from the first file are
somehow getting it thru to the other model by simply osgviewer file1 file2.

In previous facing of this behavior, I was having shaders in the scene
where I wanted parts to be rendered by shaders, parts by ffp, in a
scenegraph like this: root->child1 with shader, root->child2 ffp. After
updating (was really about two months ago) to 3.6.3 if I can recall (or
even now with the master) I had to explicitly disable the shader from
child1 to not be applied to child2 by setting it an empty Program(
setModeEtc...(new osg::Program) ).

If you are not in rush and have some time I can send you the files I have
here that reproduce the problem (not for public), just ping me.

XUbuntu 16.04
Windows 10
osg 3.7.0

Thanks a bunch as always!
Cheers, Nick

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


[osg-users] Change color of node read from dxf file

2018-11-19 Thread Diego Mancilla
I'm a newbie on OpenSceneGraph and 3D development.

 I have a dxf file that contains a bunch of 3DPOLYLINES (with different 
colors). So far I have been able to read and display them on a viewer, but I 
haven been able to change the color of the rendered lines. I believe that I'm 
not understanding properly the graph relationships.

 I'm  using the "Quick Start Guide" as reference and modifying an example that 
I found on the web.

 A code snippet of what I have:


Code:
osg::ref_ptr geom = new osg::Geometry;
osg::ref_ptr c = new osg::Vec4Array;
geom->setColorArray(c.get());
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
c->push_back(osg::Vec4(1.f, 0.f, 0.f, 1.f));

osg::ref_ptr n = new osg::Vec3Array;
geom->setNormalArray(n.get());
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
n->push_back(osg::Vec3(0.f, -1.f, 0.f));

osg::Node* lines = osgDB::readNodeFile("lines.dxf");
osg::Geode* geode = new osg::Geode;

geode->addChild(lines);
geode->addDrawable(geom.get());

std::cout << "Num Drawables in geode: " << geode->getNumDrawables() << 
std::endl;

osg::Camera* camera = new osg::Camera;
camera->setViewport(0, 0, this->width(), this->height());
camera->setClearColor(osg::Vec4(0.9f, 0.9f, 1.f, 1.f));
float aspectRatio = static_cast(this->width()) / 
static_cast(this->height());
camera->setProjectionMatrixAsPerspective(30.f, aspectRatio, 1.f, 1000.f);
camera->setGraphicsContext(_mGraphicsWindow);

_mViewer->setCamera(camera);
_mViewer->setSceneData(geode);
osgGA::TrackballManipulator* manipulator = new osgGA::TrackballManipulator;
manipulator->setAllowThrow(false);
this->setMouseTracking(true);
_mViewer->setCameraManipulator(manipulator);
_mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
_mViewer->realize();



Thank you!

Cheers.

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





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