[osg-users] iOS: how to draw into a UIView object instead of app's window?

Alessandro Terenzi a.terenzi at gmail.com
Wed Apr 20 04:00:52 PDT 2011


Hi,

I'm trying to modify the osgviewer example for iOS in order to be able to
draw into a specified UIView object rather than to the application's
window.


Basically I created a custom ViewController with a couple of views, one of
which occupies a small area of the main window. Then, once the controller's
views have been loaded, I setup OSG as shown in the osgviewer example, but
instead of doing:


osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowIOS::
WindowData(window);


I do this:


osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowIOS::
WindowData(my_OsgView);


where my_OsgView is a UIView object. But this is not working, I get the
osgviewer's view on screen but not where I expect: the viewer's view seems
to have the same size of the UIView object (and this is OK) but it is
displayed away from the UIView itself...I guess that the viewer's view is
created has a 'child' of my UIView object but I expected that the viewer's
view actually 'became' my UIView object. In other words it seems that
another view is created instead of just using the one I created with
Interface Builder.


What is the correct way to draw in a generic UIView instead of the
application's window?


Thanks.

Alessandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20110420/82b0f12d/attachment-0003.htm>


More information about the osg-users mailing list