On Wed, 2005-12-21 at 16:55 +0100, Marwan Badawi wrote:
> Braden McDaniel wrote:
> > On Tue, 2005-12-20 at 13:33 +0100, Marwan Badawi wrote:
> >>Hello all,
> >>I have an application that uses OpenGL to do some pretty low level stuff
> >>for manipulating geometries (I will pass the details). I would like to
> >>use an openvrml::gl::browser (or another alternative) to draw vrml
> >>objects into the already established OpenGL context, using it's
> >>lighting, viewport, projection and modelview matrices.
> >>What would be the best way to do so?
> > Presumably you mean openvrml::gl::viewer.
> > As far as an OpenGL renderer is concerned, openvrml::gl::viewer is all
> > that OpenVRML gives you. I suspect you could get the functionality you
> > need by inheriting it and selectively overriding its methods.
> > In the worst case (i.e., if you find openvrml::gl::viewer working
> > against you too much), you can create your own renderer from scratch by
> > inheriting openvrml::viewer just like openvrml::gl::viewer does.
> Yes, you are right. It is actually a openvrml::gl::viewer that I would
> have to use to draw the contents of a openvrml::gl::browser.
> With that
> said, I can't seem to find a way to pass the current OpenGL context to
> the viewer. Is that even possible? Or does the viewer create it's own
No; management of the context is relegated to the application.
OpenGL calls apply to the "current" context. How your context becomes
the current one is an application detail; and generally this part is
particular to the windowing subsystem. Most APIs I've seen have some
sort of "make_current" function that takes the GL context as an
argument. See, for example, the expose_event function in
> My problem is, since that I draw other types of objects in my scene (not
> only VRML), all camera viewpoints, zoom, frustum and lighting settings
> are already taken care of. All I want to do is draw a vrml object into
> the alreday existing scene using the already existing context. If the
> viewer/browser combination allows me to do so, it would be a lot of help.
> On a small note, I need to render completely static scenes, so no
> animations. Also support for script nodes is completely unnecessary. I
> only need to draw the geometry, and nothing else. Don't know if this
> makes the problem easier to solve.
Again, I believe this is possible. However, note that OpenVRML is a
runtime library; so certain parts of it may work against you. I don't
think there's anything insurmountable, though.
Braden McDaniel e-mail: <braden@...>
<http://endoframe.com> Jabber: <braden@...>