<div dir="ltr">Hi Brett,<div>if getHandle()->getLineWidth() returns 0 or a negative value that would explain all. Can you write out the problematic node to an osg file and see if the invalid value error occurs in the osgviewer as well?</div><div>That would help to narrow down the options.</div><div>Laurens.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 27, 2019 at 2:19 AM Brett Sackstein <<a href="mailto:basackstein@hotmail.com">basackstein@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello, I'm using osg and osgEarth to create a program. I try to draw a path that follows another node in the scene such that when I set its position, I add an additional GL_POINT vertex and a pair of LINE_STRIP vertices for a new anchor point for two geodes. However, I'm constantly being spammed in my application output with the invalid value error. <br>
<br>
I have been pulling my hair out because I spent hours figuring out which geometry was causing it. This is the format of my code upon construction:<br>
<br>
<br>
Code:<br>
PathNode::PathNode(IPathObject *pathObject, osgEarth::MapNode* mapNode) : CommonMapNode(pathObject, mapNode), osg::Group(), m_crossedDateLine(false), m_offset(0.0){<br>
<br>
m_lineColorArray = new osg::Vec4Array;<br>
m_glPointColorArray = new osg::Vec4Array;<br>
<br>
m_lineVertexArray = new osg::Vec3Array;<br>
m_glPointVertexArray = new osg::Vec3Array;<br>
<br>
m_lineGeom = new osg::Geometry;<br>
m_lineGeom->setUseDisplayList(false);<br>
m_lineGeom->setUseVertexArrayObject(true);<br>
m_lineGeom->setUseVertexBufferObjects(true);<br>
m_lineGeom->setDataVariance(osg::Object::DataVariance::DYNAMIC);<br>
<br>
m_glPointGeom = new osg::Geometry;<br>
m_glPointGeom->setUseDisplayList(false);<br>
m_glPointGeom->setUseVertexArrayObject(true);<br>
m_glPointGeom->setUseVertexBufferObjects(true);<br>
m_glPointGeom->setDataVariance(osg::Object::DataVariance::DYNAMIC);<br>
<br>
m_lineStripGeode = new osg::Geode;<br>
m_glPointGeode = new osg::Geode;<br>
<br>
m_lineStripGeode->getOrCreateStateSet()->setRenderBinDetails(0, "RenderBin", osg::StateSet::OVERRIDE_PROTECTED_RENDERBIN_DETAILS);<br>
m_glPointGeode->getOrCreateStateSet()->setRenderBinDetails(0, "RenderBin", osg::StateSet::OVERRIDE_PROTECTED_RENDERBIN_DETAILS);<br>
<br>
m_lineStripGeode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);<br>
m_glPointGeode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);<br>
<br>
//Line Geometry<br>
m_lineGeom->setVertexArray(m_lineVertexArray);<br>
m_lineGeom->setDataVariance(osg::Object::DataVariance::DYNAMIC);<br>
m_lineDrawArray = new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, m_lineVertexArray->size());<br>
m_lineDrawArray->setDataVariance(osg::Object::DataVariance::DYNAMIC);<br>
m_lineGeom->addPrimitiveSet(m_lineDrawArray);<br>
m_lineWidth = new osg::LineWidth(getHandle()->getLineWidth());<br>
m_lineGeom->getOrCreateStateSet()->setMode(GL_LINE_SMOOTH, osg::StateAttribute::ON);<br>
m_lineGeom->getOrCreateStateSet()->setAttributeAndModes(m_lineWidth, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON | osg::StateAttribute::PROTECTED);<br>
m_lineGeom->setColorArray(m_lineColorArray, osg::Array::BIND_PER_VERTEX);<br>
<br>
//Line Geode<br>
m_lineStripGeode->addDrawable(m_lineGeom);<br>
m_lineStripGeode->setDataVariance(osg::Object::DataVariance::DYNAMIC);<br>
m_lineStripGeode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);<br>
m_lineStripGeode->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);<br>
m_lineStripGeode->getOrCreateStateSet()->setMode(GL_LINE_SMOOTH, osg::StateAttribute::ON);<br>
m_lineStripGeode->addCullCallback(new osgEarth::HorizonCullCallback);<br>
<br>
//GL Point Geometry<br>
m_glPointGeom->setColorArray(m_glPointColorArray, osg::Array::BIND_OVERALL);<br>
m_glPointGeom->setVertexArray(m_glPointVertexArray);<br>
<br>
m_glPointsDrawArray = new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, m_glPointVertexArray->size());<br>
m_glPointGeom->addPrimitiveSet(m_glPointsDrawArray);<br>
m_glPointGeom->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);<br>
osg::ref_ptr<osg::Point> pointAttributes = new osg::Point(5);<br>
m_glPointGeom->getOrCreateStateSet()->setAttributeAndModes(pointAttributes, osg::StateAttribute::ON);<br>
m_glPointGeom->setColorArray(m_glPointColorArray, osg::Array::BIND_PER_VERTEX);<br>
<br>
//GL Point Geode<br>
m_glPointGeode->addDrawable(m_glPointGeom);<br>
<br>
addChild(m_lineStripGeode);<br>
addChild(m_glPointGeode);<br>
}<br>
<br>
<br>
<br>
<br>
It turns out the lines:<br>
<br>
<br>
Code:<br>
m_lineWidth = new osg::LineWidth(getHandle()->getLineWidth());<br>
m_lineGeom->getOrCreateStateSet()->setAttributeAndModes(m_lineWidth, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON | osg::StateAttribute::PROTECTED);<br>
<br>
<br>
<br>
<br>
Is what is causing this error to spam my output. Nothing visually seems incorrect. All colors and points are correct. Nothing is blinking or acting strange. What I don't understand with this "path" that I've created is that I actually have a "line" equivalent class that literally does the same thing, but with only 2 points and not 1 to n points and doesn't use GL_POINT at all for the end points. <br>
<br>
I figured out if I just don't add the osg::LineWidth to the m_lineGeom variable, then the error disappears, but I need the ability to set the line's width. Can anybody explain what may be causing this to print even though nothing about my lines look ill-formed? Thanks for any help.<br>
<br>
- Blanky<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=76334#76334" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=76334#76334</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>