Re: [osg-users] using osg::node in glut renderer
Thank you! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: Friday, June 20, 2008 10:01 AM To: OpenSceneGraph Users Subject: Re: [osg-users] using osg::node in glut renderer On Fri, Jun 20, 2008 at 4:44 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC <[EMAIL PROTECTED]> wrote: > So what do the arguments do that are passed into the > setUpViewerAsEmbeddedInWindow() do? Are they used internally to OSG? The window position and dimensions are passed in so it can calibrate the viewport, the projection matrix and event handling. > Also you made mention that you need to protect OpenGL rendering from OSG > rendering. Are you suggesting that there's a way of doing this without > having two separate contexts, one for OSG and one for OpenGL? It would be > cool to ditch the overhead of context switching in a GLUT app... glPushAttrib()/glPopAttrib() are you friend here. You'll need it for your own code as well as the OSGs, do it at the top level so that each stage is protected from affect the other. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] using osg::node in glut renderer
On Fri, Jun 20, 2008 at 4:44 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC <[EMAIL PROTECTED]> wrote: > So what do the arguments do that are passed into the > setUpViewerAsEmbeddedInWindow() do? Are they used internally to OSG? The window position and dimensions are passed in so it can calibrate the viewport, the projection matrix and event handling. > Also you made mention that you need to protect OpenGL rendering from OSG > rendering. Are you suggesting that there's a way of doing this without > having two separate contexts, one for OSG and one for OpenGL? It would be > cool to ditch the overhead of context switching in a GLUT app... glPushAttrib()/glPopAttrib() are you friend here. You'll need it for your own code as well as the OSGs, do it at the top level so that each stage is protected from affect the other. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] using osg::node in glut renderer
Robert, The setViewport seems to do the trick. Thanks for the help. So what do the arguments do that are passed into the setUpViewerAsEmbeddedInWindow() do? Are they used internally to OSG? Also you made mention that you need to protect OpenGL rendering from OSG rendering. Are you suggesting that there's a way of doing this without having two separate contexts, one for OSG and one for OpenGL? It would be cool to ditch the overhead of context switching in a GLUT app... Thanks, -Shayne -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: Friday, June 20, 2008 9:14 AM To: OpenSceneGraph Users Subject: Re: [osg-users] using osg::node in glut renderer Hi Shane, After the setUpViewerASEmbeddedInWindow try setting the viewer's Camera's Viewport to the size you wish. ie.. viewer.getCamera()->getViewport()->setViewport(50,50, 200,200); Robert. On Fri, Jun 20, 2008 at 4:08 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC <[EMAIL PROTECTED]> wrote: > Regarding the osgviewerGLUT example, is there any way to make the embedded > window from the GraphicsWindowEmbedded feature smaller in size than the glut > window? > > I bring this up because when I change the extents on the > viewer->setUpViewerAsEmbeddedInWindow() it has no effect. It always uses the > size of the GLUT window from glutInitWindowSize(). > > -Shayne > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Robert > Osfield > Sent: Friday, June 20, 2008 2:21 AM > To: OpenSceneGraph Users > Subject: Re: [osg-users] using osg::node in glut renderer > > Hi Mark, > > The GraphicsWindowEmbedded feature of osgViewer allows osgviewerGLUT > to just use an existing context, it does realize anything, so can fit > right inside your own code. > > More of an issue is keeping OpenGL in sync between the two sets of > rendering - you'll need to protect the OSG rendering from your OpenGL > state changes, and visa versa. There's been lots written about this > on osg-users so have a look through the archives. > > Finally I have to say bolting together two different scene graph side > by side may well be possible, but it's unlikely to provide the great > overall solution, it'll be a hack at best. The OSG itself has support > for threading, multiple graphics context etc, and as such is very > flexible and scalable, if you're bolting the OSG into an existing > framework you can kiss goodbye to much of what makes the OSG powerful. > > Robert. > > On Thu, Jun 19, 2008 at 8:39 PM, Mark Henderson <[EMAIL PROTECTED]> > wrote: >> Hi, >> >> I have looked at that file, it doesn't really align with what I'm trying > to >> do. It is still using most of osg, with a very light glut wrapper around >> it. >> >> I already have a fairly comprehensive system, with its own camera, >> mouse/keyboard handler, scenegraph, and so forth. I don't actually want > to >> use the scenegraph part of osg if I can avoid it, as I'm trying to keep > the >> application lightweight. >> >> I would like to use some parts of osg, like the 3d models and the terrain >> system. Towards that end, I've been trying to find a way to draw > osg::node >> classes without having an osg::viewer realized >> >> >> Thanks for your help, >> -Mark >> >> On Thu, Jun 19, 2008 at 11:30 AM, Robert Osfield > <[EMAIL PROTECTED]> >> wrote: >>> >>> Hi Mark, >>> >>> Please look at the osgviewerGLUT example. >>> >>> On Thu, Jun 19, 2008 at 3:47 PM, Mark Henderson <[EMAIL PROTECTED]> >>> wrote: >>> > I want to use the terrain and model systems from OSG, but all of my >>> > rendering is done in OpenGL and GLUT. It's not feasible >>> > to change the entire project to OSG rendering, so I'd like to know if >>> > there is any way to render osg::node or osg::drawable objects when not >>> > using osg::viewer and osg::renderer. >>> > >>> > The code I'd like to have would look something like this: >>> > >>> > glBegin(GL_LINES); >>> > blah >>> > blah >>> > glEnd(); >>> > >>> > osg::node* tempNode = myDatabase->getModelNodes(); >>> > >>> > for( int i = 0; i < myDatabase->getModelNodeCount(); i++) >>> > tempNode[i].draw(); >>> > >>> > glBegin(GL_LINES); >>> > blah >>> > blah >>> > glEnd(); >>> > >>&g
Re: [osg-users] using osg::node in glut renderer
Hi Shane, After the setUpViewerASEmbeddedInWindow try setting the viewer's Camera's Viewport to the size you wish. ie.. viewer.getCamera()->getViewport()->setViewport(50,50, 200,200); Robert. On Fri, Jun 20, 2008 at 4:08 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC <[EMAIL PROTECTED]> wrote: > Regarding the osgviewerGLUT example, is there any way to make the embedded > window from the GraphicsWindowEmbedded feature smaller in size than the glut > window? > > I bring this up because when I change the extents on the > viewer->setUpViewerAsEmbeddedInWindow() it has no effect. It always uses the > size of the GLUT window from glutInitWindowSize(). > > -Shayne > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Robert > Osfield > Sent: Friday, June 20, 2008 2:21 AM > To: OpenSceneGraph Users > Subject: Re: [osg-users] using osg::node in glut renderer > > Hi Mark, > > The GraphicsWindowEmbedded feature of osgViewer allows osgviewerGLUT > to just use an existing context, it does realize anything, so can fit > right inside your own code. > > More of an issue is keeping OpenGL in sync between the two sets of > rendering - you'll need to protect the OSG rendering from your OpenGL > state changes, and visa versa. There's been lots written about this > on osg-users so have a look through the archives. > > Finally I have to say bolting together two different scene graph side > by side may well be possible, but it's unlikely to provide the great > overall solution, it'll be a hack at best. The OSG itself has support > for threading, multiple graphics context etc, and as such is very > flexible and scalable, if you're bolting the OSG into an existing > framework you can kiss goodbye to much of what makes the OSG powerful. > > Robert. > > On Thu, Jun 19, 2008 at 8:39 PM, Mark Henderson <[EMAIL PROTECTED]> > wrote: >> Hi, >> >> I have looked at that file, it doesn't really align with what I'm trying > to >> do. It is still using most of osg, with a very light glut wrapper around >> it. >> >> I already have a fairly comprehensive system, with its own camera, >> mouse/keyboard handler, scenegraph, and so forth. I don't actually want > to >> use the scenegraph part of osg if I can avoid it, as I'm trying to keep > the >> application lightweight. >> >> I would like to use some parts of osg, like the 3d models and the terrain >> system. Towards that end, I've been trying to find a way to draw > osg::node >> classes without having an osg::viewer realized >> >> >> Thanks for your help, >> -Mark >> >> On Thu, Jun 19, 2008 at 11:30 AM, Robert Osfield > <[EMAIL PROTECTED]> >> wrote: >>> >>> Hi Mark, >>> >>> Please look at the osgviewerGLUT example. >>> >>> On Thu, Jun 19, 2008 at 3:47 PM, Mark Henderson <[EMAIL PROTECTED]> >>> wrote: >>> > I want to use the terrain and model systems from OSG, but all of my >>> > rendering is done in OpenGL and GLUT. It's not feasible >>> > to change the entire project to OSG rendering, so I'd like to know if >>> > there is any way to render osg::node or osg::drawable objects when not >>> > using osg::viewer and osg::renderer. >>> > >>> > The code I'd like to have would look something like this: >>> > >>> > glBegin(GL_LINES); >>> > blah >>> > blah >>> > glEnd(); >>> > >>> > osg::node* tempNode = myDatabase->getModelNodes(); >>> > >>> > for( int i = 0; i < myDatabase->getModelNodeCount(); i++) >>> > tempNode[i].draw(); >>> > >>> > glBegin(GL_LINES); >>> > blah >>> > blah >>> > glEnd(); >>> > >>> > (The code is a little simplified, since I'm keeping track of >>> > transformation matrices for each model, but it gets the point across.) >>> > >>> > I can't seem to find anything like a draw function. I can't even >>> > figure out where in ViewerBase::renderingTraversals() it actually >>> > renders the nodes. >>> > ___ >>> > osg-users mailing list >>> > osg-users@lists.openscenegraph.org >>> > >>> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>> > >>>
Re: [osg-users] using osg::node in glut renderer
Regarding the osgviewerGLUT example, is there any way to make the embedded window from the GraphicsWindowEmbedded feature smaller in size than the glut window? I bring this up because when I change the extents on the viewer->setUpViewerAsEmbeddedInWindow() it has no effect. It always uses the size of the GLUT window from glutInitWindowSize(). -Shayne -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield Sent: Friday, June 20, 2008 2:21 AM To: OpenSceneGraph Users Subject: Re: [osg-users] using osg::node in glut renderer Hi Mark, The GraphicsWindowEmbedded feature of osgViewer allows osgviewerGLUT to just use an existing context, it does realize anything, so can fit right inside your own code. More of an issue is keeping OpenGL in sync between the two sets of rendering - you'll need to protect the OSG rendering from your OpenGL state changes, and visa versa. There's been lots written about this on osg-users so have a look through the archives. Finally I have to say bolting together two different scene graph side by side may well be possible, but it's unlikely to provide the great overall solution, it'll be a hack at best. The OSG itself has support for threading, multiple graphics context etc, and as such is very flexible and scalable, if you're bolting the OSG into an existing framework you can kiss goodbye to much of what makes the OSG powerful. Robert. On Thu, Jun 19, 2008 at 8:39 PM, Mark Henderson <[EMAIL PROTECTED]> wrote: > Hi, > > I have looked at that file, it doesn't really align with what I'm trying to > do. It is still using most of osg, with a very light glut wrapper around > it. > > I already have a fairly comprehensive system, with its own camera, > mouse/keyboard handler, scenegraph, and so forth. I don't actually want to > use the scenegraph part of osg if I can avoid it, as I'm trying to keep the > application lightweight. > > I would like to use some parts of osg, like the 3d models and the terrain > system. Towards that end, I've been trying to find a way to draw osg::node > classes without having an osg::viewer realized > > > Thanks for your help, > -Mark > > On Thu, Jun 19, 2008 at 11:30 AM, Robert Osfield <[EMAIL PROTECTED]> > wrote: >> >> Hi Mark, >> >> Please look at the osgviewerGLUT example. >> >> On Thu, Jun 19, 2008 at 3:47 PM, Mark Henderson <[EMAIL PROTECTED]> >> wrote: >> > I want to use the terrain and model systems from OSG, but all of my >> > rendering is done in OpenGL and GLUT. It's not feasible >> > to change the entire project to OSG rendering, so I'd like to know if >> > there is any way to render osg::node or osg::drawable objects when not >> > using osg::viewer and osg::renderer. >> > >> > The code I'd like to have would look something like this: >> > >> > glBegin(GL_LINES); >> > blah >> > blah >> > glEnd(); >> > >> > osg::node* tempNode = myDatabase->getModelNodes(); >> > >> > for( int i = 0; i < myDatabase->getModelNodeCount(); i++) >> > tempNode[i].draw(); >> > >> > glBegin(GL_LINES); >> > blah >> > blah >> > glEnd(); >> > >> > (The code is a little simplified, since I'm keeping track of >> > transformation matrices for each model, but it gets the point across.) >> > >> > I can't seem to find anything like a draw function. I can't even >> > figure out where in ViewerBase::renderingTraversals() it actually >> > renders the nodes. >> > ___ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] using osg::node in glut renderer
Hi Mark, The GraphicsWindowEmbedded feature of osgViewer allows osgviewerGLUT to just use an existing context, it does realize anything, so can fit right inside your own code. More of an issue is keeping OpenGL in sync between the two sets of rendering - you'll need to protect the OSG rendering from your OpenGL state changes, and visa versa. There's been lots written about this on osg-users so have a look through the archives. Finally I have to say bolting together two different scene graph side by side may well be possible, but it's unlikely to provide the great overall solution, it'll be a hack at best. The OSG itself has support for threading, multiple graphics context etc, and as such is very flexible and scalable, if you're bolting the OSG into an existing framework you can kiss goodbye to much of what makes the OSG powerful. Robert. On Thu, Jun 19, 2008 at 8:39 PM, Mark Henderson <[EMAIL PROTECTED]> wrote: > Hi, > > I have looked at that file, it doesn't really align with what I'm trying to > do. It is still using most of osg, with a very light glut wrapper around > it. > > I already have a fairly comprehensive system, with its own camera, > mouse/keyboard handler, scenegraph, and so forth. I don't actually want to > use the scenegraph part of osg if I can avoid it, as I'm trying to keep the > application lightweight. > > I would like to use some parts of osg, like the 3d models and the terrain > system. Towards that end, I've been trying to find a way to draw osg::node > classes without having an osg::viewer realized > > > Thanks for your help, > -Mark > > On Thu, Jun 19, 2008 at 11:30 AM, Robert Osfield <[EMAIL PROTECTED]> > wrote: >> >> Hi Mark, >> >> Please look at the osgviewerGLUT example. >> >> On Thu, Jun 19, 2008 at 3:47 PM, Mark Henderson <[EMAIL PROTECTED]> >> wrote: >> > I want to use the terrain and model systems from OSG, but all of my >> > rendering is done in OpenGL and GLUT. It's not feasible >> > to change the entire project to OSG rendering, so I'd like to know if >> > there is any way to render osg::node or osg::drawable objects when not >> > using osg::viewer and osg::renderer. >> > >> > The code I'd like to have would look something like this: >> > >> > glBegin(GL_LINES); >> > blah >> > blah >> > glEnd(); >> > >> > osg::node* tempNode = myDatabase->getModelNodes(); >> > >> > for( int i = 0; i < myDatabase->getModelNodeCount(); i++) >> > tempNode[i].draw(); >> > >> > glBegin(GL_LINES); >> > blah >> > blah >> > glEnd(); >> > >> > (The code is a little simplified, since I'm keeping track of >> > transformation matrices for each model, but it gets the point across.) >> > >> > I can't seem to find anything like a draw function. I can't even >> > figure out where in ViewerBase::renderingTraversals() it actually >> > renders the nodes. >> > ___ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] using osg::node in glut renderer
Hi, I have looked at that file, it doesn't really align with what I'm trying to do. It is still using most of osg, with a very light glut wrapper around it. I already have a fairly comprehensive system, with its own camera, mouse/keyboard handler, scenegraph, and so forth. I don't actually want to use the scenegraph part of osg if I can avoid it, as I'm trying to keep the application lightweight. I would like to use some parts of osg, like the 3d models and the terrain system. Towards that end, I've been trying to find a way to draw osg::node classes without having an osg::viewer realized Thanks for your help, -Mark On Thu, Jun 19, 2008 at 11:30 AM, Robert Osfield <[EMAIL PROTECTED]> wrote: > Hi Mark, > > Please look at the osgviewerGLUT example. > > On Thu, Jun 19, 2008 at 3:47 PM, Mark Henderson <[EMAIL PROTECTED]> > wrote: > > I want to use the terrain and model systems from OSG, but all of my > > rendering is done in OpenGL and GLUT. It's not feasible > > to change the entire project to OSG rendering, so I'd like to know if > > there is any way to render osg::node or osg::drawable objects when not > > using osg::viewer and osg::renderer. > > > > The code I'd like to have would look something like this: > > > > glBegin(GL_LINES); > > blah > > blah > > glEnd(); > > > > osg::node* tempNode = myDatabase->getModelNodes(); > > > > for( int i = 0; i < myDatabase->getModelNodeCount(); i++) > > tempNode[i].draw(); > > > > glBegin(GL_LINES); > > blah > > blah > > glEnd(); > > > > (The code is a little simplified, since I'm keeping track of > > transformation matrices for each model, but it gets the point across.) > > > > I can't seem to find anything like a draw function. I can't even > > figure out where in ViewerBase::renderingTraversals() it actually > > renders the nodes. > > ___ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] using osg::node in glut renderer
Hi Mark, Please look at the osgviewerGLUT example. On Thu, Jun 19, 2008 at 3:47 PM, Mark Henderson <[EMAIL PROTECTED]> wrote: > I want to use the terrain and model systems from OSG, but all of my > rendering is done in OpenGL and GLUT. It's not feasible > to change the entire project to OSG rendering, so I'd like to know if > there is any way to render osg::node or osg::drawable objects when not > using osg::viewer and osg::renderer. > > The code I'd like to have would look something like this: > > glBegin(GL_LINES); > blah > blah > glEnd(); > > osg::node* tempNode = myDatabase->getModelNodes(); > > for( int i = 0; i < myDatabase->getModelNodeCount(); i++) > tempNode[i].draw(); > > glBegin(GL_LINES); > blah > blah > glEnd(); > > (The code is a little simplified, since I'm keeping track of > transformation matrices for each model, but it gets the point across.) > > I can't seem to find anything like a draw function. I can't even > figure out where in ViewerBase::renderingTraversals() it actually > renders the nodes. > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] using osg::node in glut renderer
I want to use the terrain and model systems from OSG, but all of my rendering is done in OpenGL and GLUT. It's not feasible to change the entire project to OSG rendering, so I'd like to know if there is any way to render osg::node or osg::drawable objects when not using osg::viewer and osg::renderer. The code I'd like to have would look something like this: glBegin(GL_LINES); blah blah glEnd(); osg::node* tempNode = myDatabase->getModelNodes(); for( int i = 0; i < myDatabase->getModelNodeCount(); i++) tempNode[i].draw(); glBegin(GL_LINES); blah blah glEnd(); (The code is a little simplified, since I'm keeping track of transformation matrices for each model, but it gets the point across.) I can't seem to find anything like a draw function. I can't even figure out where in ViewerBase::renderingTraversals() it actually renders the nodes. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org