Hi Andrew, If you have too much data for OpenGL to handle it will report an error. What you have to do is work out how to work with small models or create the models in such a way that they don't have such a large OpenGL footprint.
You say nothing about what your models contain, or what type of application behavior you want when managing these models, given this there really isn't much we can advice, it's simply too open ended. Robert. On 5 September 2013 13:59, Andrew Nie <[email protected]> wrote: > Hi, > I load several model files and encountered the following warning: > "detected OpenGL error 'out of memory' at After Renderer::compile". Here > is my code: > > int main() > { > > osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer(); > > osg::ref_ptr<osg::Group> root = new osg::Group(); > > osg::ref_ptr<osg::Node> node1 = > osgDB::readNodeFile("E:\\Scene\\Background.ive"); > osg::ref_ptr<osg::Node> node2 = > osgDB::readNodeFile("E:\\Scene\\N_0.ive");// > osg::ref_ptr<osg::Node> node3 = > osgDB::readNodeFile("E:\\Scene\\Q_0.ive");// > osg::ref_ptr<osg::Node> node4 = > osgDB::readNodeFile("E:\\Scene\\TH_0.ive");// > > > osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform(); > > > mt->setMatrix(osg::Matrix::rotate(osg::PI_2,osg::Vec3d(1.0,0.0,0.0))); > mt->addChild(node1); > mt->addChild(node2); > mt->addChild(node3); > mt->addChild(node4); > > > // > root->addChild(mt); > > // > osgUtil::Optimizer optimizer ; > optimizer.optimize(root.get()) ; > > osg::ref_ptr<osgGA::TrackballManipulator> tb = new > osgGA::TrackballManipulator(); > tb->setTrackballSize(0.9); > viewer->setCameraManipulator(tb); > viewer->setSceneData(root.get()); > > viewer->realize(); > > viewer->run(); > > return 0 ; > } > > The four ive files (Background.ive,N_0.ive,Q_0.ive,TH_0.ive) are > 400M,260M,211M,410M > respectively. I found that,if I only load the first two files, the warning > did't appear, but if load one more file of the other two, the warning show > up. > Has anyone encountered such a problem?Any advice and suggestion will be > appreciated... > > > ... > > Thank you! > > Cheers, > Andrew > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=56121#56121 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

