Hi,

instead of making the opengl-view transparent you can render the
live-video as a texture inside osg, you'll have to feed the video-image
into an osg-texture, but it's relatively simple to do.

If you insist in a transparent opengl view you'll have to hack
GraphicsWindowIOS.mm, as there's no support for transparent views yet.

Change eaglLayer.opaque = YES; to eaglLayer.opaque = NO; around line
200, and be sure, that your osg-displaysettings /
GraphicsWindows::Traits require an alpha-channel. (I have not tested
this approach, ymmv)

For some background:
http://stackoverflow.com/questions/1394934/iphone-layering-a-transparent-opengl-view-on-top-of-a-uiview

HTH,
Stephan

Am 26.11.11 21:36, schrieb Jeremy Blatter:
> I'm developing an augmented reality application for iPad. I'm using 
> OpenSceneGraph to render the 3D objects over the camera view.
> My code is based on the view_test iPhone example given with the sources on 
> Github, so we can discuss my problem from this exemple.
> 
> I wish to set the background of the OSG Viewer transparent, so we can see the 
> UIView behind (which contains the iPad camera preview layer in my 
> application, that works well).
> To be clear, say that in the view_test exemple, I change the background color 
> of the view in FlipsideViewController.mm
> 
> 
> Code:
> - (void)viewDidLoad {
> ...
> self.view.backgroundColor = [UIColor redColor];
> ...
> }
> 
>  
> 
> Then, I wish to see this red color as background for my 3D scene (the box) 
> instead of the default blue background.
> My intuition was to change the clearColor to black with the alpha channel set 
> to 0 :
> 
> 
> Code:
> _viewer->getCamera()->setClearColor(osg::vec4(0.0f, 0.0f, 0.0f, 0.0f));
> 
> 
> 
> The background is black as expected, but the alpha value is not considered 
> (as if it was always 1.0f).
> Any ideas?

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to