[osg-users] OSG rendering inside OpenGL application

Javier Taibo jtaibo at udc.es
Tue Oct 16 14:41:18 PDT 2007


  Thank you very much, Paul, for the quick response. 

  Finally, after some adjustments (creating it with the maximum viewport
size and changing the viewport every frame with an osg::Viewport
attached to the scene root) it is working OK. I think it is doing more
work than I needed as I only needed to draw graphics primitives with
their states, because when calling Viewer::frame() the buffer is clear
and the viewport and modelview and projection matrices set. But the
performance seems to be quite good anyway. I suppose it is not worth the
effort and time it would take to me to dive into the internals of OSG
rendering to optimize it.

  Thank you again.



El sáb, 13-10-2007 a las 10:29 -0600, Paul Martz escribió:
> 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
> > 
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-- 
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





More information about the osg-users mailing list