Hi,
I am experiencing a strange problem in my iOS app using OpenSceneGraph.
I use this code to create a graphics context
Code:
- (osg::ref_ptr<osg::GraphicsContext>)createGraphicContext
{
//create our graphics context directly so we can pass our own window
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;
// Init the Windata Variable that holds the handle for the Window to
display OSG in.
osg::ref_ptr<osg::Referenced> windata = new
osgViewer::GraphicsWindowIOS::WindowData(self.renderView,
osgViewer::GraphicsWindowIOS::WindowData::ALL_ORIENTATIONS);
// Setup the traits parameters
traits->x = 0;
traits->y = 0;
NSLog(@"is retina display? content scale factor is: %f",
self.renderView.contentScaleFactor);
traits->width =
self.renderView.bounds.size.width*self.renderView.contentScaleFactor;
traits->height =
self.renderView.bounds.size.height*self.renderView.contentScaleFactor;
NSLog(@"Traits width is %d, traits height is %d", traits->width,
traits->height);
traits->depth = 16; //keep memory down, default is currently 24
traits->sampleBuffers = true;
traits->samples = 4;
traits->alpha = 8;
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
traits->inheritedWindowData = windata;
// Create the Graphics Context
osg::ref_ptr<osg::GraphicsContext> graphicsContext =
osg::GraphicsContext::createGraphicsContext(traits.get());
#ifdef DEBUG_OPENSCENEGRAPH
osg::setNotifyLevel(osg::DEBUG_INFO);
#else
osg::setNotifyLevel(osg::FATAL);
#endif
return graphicsContext;
}
Now if I use the option
Code:
traits->sampleBuffers = false;
there is no problem.
But when I enable the antialiasing by setting it to true
Code:
traits->sampleBuffers = true;
After around 6 - 7 changes of orientation in the app (i.e. when the user
rotates the device),
the app crashes due to memory pressure.
The strange thing is that I am looking to the memory reported by XCode and the
memory is below 30 MB when the crash happens.
Do you have any idea why this crash is happening?
Am I missing some setting during the Graphics context creation ?
Thank you very much for your support,
John[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=58729#58729
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org