XForms: OpenInventor and forms library

Praveen Bhatia (pbhatia@cair.res.in)
Fri, 12 Dec 1997 11:42:03 -0500

To subscribers of the xforms list from Praveen Bhatia <pbhatia@cair.res.in> :

Hi,
We are trying to solve the following problem. We would
appreciate any help that we can get in this matter.

Thanks

Praveen



##############################################################################
Dr. Praveen Bhatia email: pbhatia@cair.res.in
Scientist D

ROBOTICS Group
Center for A.I. and Robotics
Raj Bhavan Circle,
High Grounds,
Bangalore, India, 560001

##############################################################################





THE PROBLEM:
To integrate Open Inventor with the Motif based Forms library

WHAT WE HAVE DONE:
We have built a GUI based on forms library which has buttons
and a gl_canvas.
We would like to use that GUI with Open Inventor and either
a] Render the scene through Open Inventor in the forms
gl_canvas 0R
b] Render the scene through Open Inventor in the
Inventor canvas, but using our forms library based GUI.

WHERE WE HAVE GOT STUCK:
FORMS gives us (from forms.h):

Window fl_get_canvas_id(FL_OBJECT *);
void fl_remove_canvas_handler(FL_OBJECT *, int,
FL_HANDLE_CANVAS);
void fl_hide_canvas(FL_OBJECT *); /* internal use
only */

/* OpenGL canvases */
FL_OBJECT *fl_create_glcanvas(int, FL_Coord, FL_Coord,
FL_Coord,
FL_Coord, const char *);

FL_OBJECT *fl_add_glcanvas(int, FL_Coord, FL_Coord,
FL_Coord,
FL_Coord, const char *);

void fl_activate_glcanvas(FL_OBJECT *);
XVisualInfo *fl_get_glcanvas_xvisualinfo(FL_OBJECT *);


GLXContext fl_get_glcanvas_context(FL_OBJECT * ob);
Window fl_glwincreate(int *, GLXContext *, int, int);
Window fl_glwinopen(int *, GLXContext *, int, int);



OPEN INVENTOR GIVES:

As shown below, the function void draw_cube() makes
a node cubesep which is the root node. The problem
arises
when this root is to be directed to the Forms gl_canvas.
We need to know how to tell Openinventor to use the
Forms
gl_canvas to render the scenes. The node cubesep is to
be
directed to the forms gl_canvas.



void draw_cube()
{
// This function renders the cube to myWindow.
// How do we send this output to form's gl_canvas ???????

// Initialize Inventor and Xt
Widget myWindow = SoXt::init("Virtualized Scene");
if (myWindow == NULL) exit(1);
SoCube *mycube = new SoCube;
mycube->width= 12.;
mycube->height= 7.5;
mycube->depth= 30;

SoSeparator *cubesep = new SoSeparator;
cubesep->addChild(mycube);

SoXtRenderArea *myRenderArea=new SoXtRenderArea(myWindow);
SbViewportRegion myRegion(myRenderArea->getSize());


myRenderArea->setSceneGraph(cubesep);
myRenderArea->setTitle("Cube");
myRenderArea->show();

SoXt::show(myWindow);
SoXt::mainLoop();


} /* End of draw_cube() */
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/