Hi all.
Just noticed that it is not possible to toggle the
setUseVertexAttributeAliasing after a viewer has been realized and
frame/run has been called and any text is involved in the scene. The
attached code is a modified osgViewer that will reproduce the issue. If 's'
(statistics) is shown after the call to setUseVertexAttributeAliasing
(start the application and press 's'), I get a call stack, meaning it is
not possible to toggle this feature while an application is being run. Is
that intentional?
Actually, when to call this method during initialization of an OSG
application seems to be a delicate choice.
Also, this design where you switch this via the context, means that you
cannot have any Fixed pipeline path in your application.
So if I would like to have one part of the graph being rendered
"shader-free" and another with shaders, applying these properties will
effectively break the "shader-free" part.
I am running OSG 3.6.4 on Windows 10
>
osg160-osg.dll!osg::VertexArrayState::applyDisablingOfVertexAttributes(osg::State
& state) Line 294 C++
osg160-osg.dll!osg::Geometry::drawVertexArraysImplementation(osg::RenderInfo
& renderInfo) Line 989 C++
osg160-osg.dll!osg::Geometry::drawImplementation(osg::RenderInfo &
renderInfo) Line 899 C++
osg160-osg.dll!osg::Drawable::drawInner(osg::RenderInfo & renderInfo)
Line 277 C++
osg160-osg.dll!osg::Drawable::draw(osg::RenderInfo & renderInfo) Line 619
C++
osg160-osgUtil.dll!osgUtil::RenderLeaf::render(osg::RenderInfo &
renderInfo, osgUtil::RenderLeaf * previous) Line 84 C++
osg160-osgUtil.dll!osgUtil::RenderBin::drawImplementation(osg::RenderInfo
& renderInfo, osgUtil::RenderLeaf * & previous) Line 488 C++
osg160-osgUtil.dll!osgUtil::RenderStage::drawImplementation(osg::RenderInfo
& renderInfo, osgUtil::RenderLeaf * & previous) Line 1408 C++
osg160-osgUtil.dll!osgUtil::RenderBin::draw(osg::RenderInfo & renderInfo,
osgUtil::RenderLeaf * & previous) Line 432 C++
osg160-osgUtil.dll!osgUtil::RenderStage::drawInner(osg::RenderInfo &
renderInfo, osgUtil::RenderLeaf * & previous, bool & doCopyTexture) Line
934 C++
--
__________________________________________
Anders Backman
--
You received this message because you are subscribed to the Google Groups
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/osg-users/CAG9QTxTXv3FJYBi46kU%3DcOqJ-dF3AnocaNg3AWxipEctJejEAA%40mail.gmail.com.
/* OpenSceneGraph example, osgshape.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Geode>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/Texture2D>
#include <osgUtil/ShaderGen>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/StateSetManipulator>
#include <osgGA/TrackballManipulator>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osg/Math>
// for the grid data..
osg::Geode* createShapes(osg::ArgumentParser& arguments)
{
osg::Geode* geode = new osg::Geode();
float radius = 0.8f;
float height = 1.0f;
osg::TessellationHints* hints = new osg::TessellationHints;
hints->setDetailRatio(0.5f);
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f,
0.0f, 0.0f), radius), hints));
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(2.0f, 0.0f,
0.0f), 2 * radius), hints));
geode->addDrawable(new osg::ShapeDrawable(new osg::Cone(osg::Vec3(4.0f, 0.0f,
0.0f), radius, height), hints));
geode->addDrawable(new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(6.0f,
0.0f, 0.0f), radius, height), hints));
geode->addDrawable(new osg::ShapeDrawable(new osg::Capsule(osg::Vec3(8.0f,
0.0f, 0.0f), radius, height), hints));
return geode;
}
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
// construct the viewer.
osgViewer::Viewer viewer(arguments);
// add model to viewer.
viewer.setSceneData(createShapes(arguments));
// add the state manipulator
viewer.addEventHandler(new
osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.realize();
int i = 0;
while (!viewer.done()) {
i++;
if (i == 2000)
{
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
for (osgViewer::Viewer::Windows::iterator itr = windows.begin(); itr !=
windows.end(); ++itr)
{
osg::State* s = (*itr)->getState();
s->setUseModelViewAndProjectionUniforms(true);
s->setUseVertexAttributeAliasing(true);
}
}
viewer.frame();
}
}