[osg-users] OSG rendering inside OpenGL application

Paul Martz pmartz at skew-matrix.com
Sat Oct 13 09:29:40 PDT 2007


If you've already created a context and made it current, then you should
just be able to use osgViewer::Viewer::setUpViewerAsEmbeddedInWindow. The
osgviewerGLUT example does this -- GLUT creates the context and makes it
current, just as you're doing in your own app.

Hope this helps,
   -Paul


> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org 
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf 
> Of Javier Taibo
> Sent: Saturday, October 13, 2007 4:14 AM
> To: OpenSceneGraph Users
> Subject: [osg-users] OSG rendering inside OpenGL application
> 
>   Hi,
> 
>   I am trying to use OSG for rendering a scenegraph to 
> texture for its use in an OpenGL application.
> 
>   The application binds an FBO with a texture attached to it 
> and establishes the Viewport where the render should be done, 
> so I have a valid and active OpenGL context configured to 
> just draw the primitives.
> Then, a virtual method of an abstract class is called to do 
> the render.
> I want to make an implementation of this class based on OSG 
> to render complex scenes and load them from any file format 
> supported by OSG.
> 
>   What is the best way to do it? I am wondering about using a 
> SceneView object or doing it at a lower level (building the 
> CullVisitor, RenderStage, StateGraph, etc). 
> 
>   As the second choice considerably more difficult, I'm 
> trying first using SceneView. I am initializing with
> 
>     _sceneView = new osgUtil::SceneView();
>     _sceneView->setDefaults();
>     _sceneView->setSceneData( _escena.get() );
> 
>   and then every frame, after placing the camera I do the traversals
> 
>     _sceneView->update();
>     _sceneView->cull();
>     _sceneView->draw();
> 
>   but I am getting this message continuously:
> 
>   Warning: detected OpenGL error 'invalid operation' after
> RenderBin::draw(,)
> 
> 
>   I would like to know the experts suggestions, just in case 
> I am doing it the wrong way.
> 
>   Is there any example/tutorial/source code doing something 
> similar that I can take a look at?
> 
>   Thanks in advance.
> 
> 
> --
> Javier Taibo
> VideaLAB. Grupo de Visualización en Ingeniería, Arquitectura 
> y Urbanismo E.T.S.I. de Caminos, Canales y Puertos 
> Universidade da Coruña Campus de Elviña, s/n
> 15071 - A Coruña (Spain)
> +34-981-167000 (ext. 5444)
> http://videalab.udc.es
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce
negraph.org
> 




More information about the osg-users mailing list