Hi Kevin, Well osgvp is quite large currently, but you can take a look to libosgvp-viewer library and take only what you need. If you feel comfortable with maven, you can try to compile it and use only libosgvp-viewer and libosgvp-core library. Currently trunk compiles against osg 2.8.2, but you can use a trick to compile it against osg trunk just setting the OSG_DIR env var pointing to the osg compiled sdk.
This two libraries allow to create the context using jogl with the first method that Robert commented. You can take libosgvp-viewer and use it and even with a few mods I think you can use without all the libosgvp-core wrappers. The JNI code is inside osgvp/libosgvp/libjni-osgvp/, so you can take a look there and use the code you need. Good luck with your project, Rafa. On Wed, Jan 6, 2010 at 7:05 PM, Robert Osfield <robert.osfi...@gmail.com> wrote: > Hi Kevin, > > I know nothing about Java/JNI so can't comment on the specifics, but > in general I'd suggest that you could use the > osgViewer::GraphicsWindowEmbedded functionality that enables the > standard osgViewer::Viewer/CompositeViewer to handle a single window > without doing any of its own windows/wgl/glx calls - leaving these > entirely up to the calling application. For examples of this in > action have a look at the osgviewerSDL and osgviewerGLUT examples that > come as part of the OSG's example set. Such a embedded window is fine > for most apps that just require a single window and single threading > of the viewer, but isn't a scalable as the native OSG windowing > implementations. > > Another route might be to try and get the underlying window handle of > a window created by java and then pass this to > osgViewer::GraphicsWindowWin32/X11 using it's support for inheriting > windows and adding it's own graphics context. This approach is the > most flexible w.r.t the OSG as it enables the OSG to handle threading > and multiple graphics contexts directly. > > Robert. > > On Wed, Jan 6, 2010 at 5:05 PM, Kevin Tacke <kta...@gmail.com> wrote: >> We currently have an application that is built around the OSG Viewer using a >> glut window. We are interesting in adding a considerable GUI interface to >> the application and we would prefer to use JAVA to implement the GUI. So >> basically I am trying to find a way, probably using JOGL, to create the GUI >> and graphics window on the JAVA side and perform all of the drawing on the >> C++/OSG side. >> >> I think I should be able to create a glContext on the JAVA size, with JOGL, >> and when making a call to C++ with JNI have access to the same context as >> long as it is done within the same thread. Unfortunately, I have not >> figured out how to assign the JAVA created glContex, retrieved with a call >> to wglGetCurrentContext, to the OSG Viewer/Camera. >> >> I know that osgvp has created a JAVA/JOGL/JNI interface to OSG but it looks >> like a lot of effort went into creating the JNI interface and making calls >> into OSG. I would really like to reduce the JNI to little more than init, >> display, keyboard, and mouse functions. >> >> Any help is appreciated. >> >> Thanks, >> Kevin >> >> ------------------ >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=22166#22166 >> >> >> >> >> >> _______________________________________________ >> 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 > -- Rafael Gaitán Linares Instituto de Automática e Informática Industrial http://www.ai2.upv.es Ciudad Politécnica de la Innovación Universidad Politécnica de Valencia _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org