Hi have a look at osg::State interface, there are functions to tell osg that something was changed in gl state externally.
Cheers. 25.03.2013, 15:28, "Peter Klosowski" <klo...@gmail.com>: > Hi, > > I am working on a small application that uses SFML and OSG. Getting a simple > viewer up and running was very easy. In fact, most of my code is based on the > osgviewerSDL example. However, there is one significant difference which is > causing problems: > > SFML provides its own graphics module which uses OpenGL. This means that the > OpenGL state will get modified outside of OSG. This seems to cause problems, > for example it looks like OSG thinks that certain > VertexAttribArray/VertexAttribPointer settings are still active. How can I > tell OSG to reapply these settings each frame instead of caching them? > > The problem can be demonstrated with a simple render loop, like this: > > Code: > > static const int windowWidth = 800; > static const int windowHeight = 600; > > sf::RenderWindow window; > sf::VideoMode mode = sf::VideoMode::getDesktopMode(); > > mode.width = windowWidth; > mode.height = windowHeight; > > sf::ContextSettings settings(24, 8, 0, 4, 2); > > window.create(mode, "SFMLTest", sf::Style::Default, settings); > > osg::ref_ptr<osg::Group> root = new osg::Group; > > /* Create scene... */ > > osgViewer::Viewer viewer; > osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> gw = > viewer.setUpViewerAsEmbeddedInWindow(0, 0, windowWidth, windowHeight); > viewer.setCameraManipulator(new osgGA::TrackballManipulator); > viewer.setSceneData(root.get()); > viewer.realize(); > > auto state = gw->getState(); > state->setUseModelViewAndProjectionUniforms(true); > state->setUseVertexAttributeAliasing(true); > > while (window.isOpen()) > { > sf::Event event; > while (window.pollEvent(event)) > { > switch(event.type) > { > case sf::Event::Closed: > window.close(); > break; > } > } > > window.setActive(); > > window.pushGLStates(); > > viewer.frame(); > > window.popGLStates(); > > window.display(); > } > > Removing the pushGLStates/popGLStates solves the problem. However, this is > not a viable long term solution, since the context could be modified in > between two frames. > > Cheers, > Peter[/code] > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=52941#52941 > > _______________________________________________ > 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