Louis Bolduc (louis++at++speech.iar.nrc.ca)
Thu, 13 Oct 94 11:43:56 EDT
I have been developping a piece of software that uses MOTIF for its user inter-
face and Performer for graphic rendering. It works great.
Here's how I went about doing it:
There is no "Performer Widget", so you have to work a little harder initially
to get things going. You will do the Performer rendering through a GLX window.
Build your MOTIF interface the way you would normally do it. You must do the
Performer initializations *after* you have realized the interface (after
XtRealizeWidget ( toplevel ); ).
In my application, I make the GLX window a child of a "frame" widget. Further
down is my "open pipeline" callback function.
I then call "pfSync()" and "pfFrame()" from a work proc (in my software,
draw_scene):
XtAppAddWorkProc ( app_context, ( XtWorkProc ) draw_scene, ( XtPointer ) NULL );
Works great!
Good luck.
| Life would be much easier to| Louis Bolduc | === __ |
| understand if mother nature | (613) 998-9780 | \_______| _) |
| gave us the source code. | louis++at++speech.iar.nrc.ca | __ /\ | __ |
| - Graeme MacWilliam | Flight Research | / / \ / \ \ |
| | Laboratory | | /_|_\/\/ | \ | |
| #include <std/disclaimer> | | \ / \/ \ / |
+----- NRC-CNRC - Institute for Aerospace Research -----+- \__/ ------- \__/ -+
//=============================================================================
//
// FUNCTION open_pipeline.
//
// This function sets up IRIS GL and IRIS Performer.
//
//=============================================================================
static void open_pipeline ( pfPipe *p )
{
Display *xDpy = XtDisplay ( glx_parent_widget );
Window xWin = XtWindow ( glx_parent_widget );
Window glWin;
Window overWin;
GLXconfig *config;
if ( getgdesc ( GD_MULTISAMPLE ) > 0 ) {
config = pfuGLXCreateWindow ( ( pfuXDisplay * ) xDpy,
( pfuXWindow ) xWin,
0, 0,
width,
height, 0,
GLX_NORMAL, GLX_DOUBLE, TRUE,
GLX_NORMAL, GLX_RGB, TRUE,
GLX_NORMAL, GLX_ZSIZE, 0,
GLX_NORMAL, GLX_STENSIZE, 0,
GLX_NORMAL, GLX_MSSAMPLE, 8,
GLX_NORMAL, GLX_MSZSIZE, 24,
GLX_NORMAL, GLX_MSSSIZE, 1,
GLX_OVERLAY, GLX_BUFSIZE, 2,
0, 0, 0 );
} else {
config = pfuGLXCreateWindow ( ( pfuXDisplay * ) xDpy,
( pfuXWindow ) xWin,
0, 0,
width,
height, 0,
GLX_NORMAL, GLX_DOUBLE, TRUE,
GLX_NORMAL, GLX_RGB, TRUE,
GLX_NORMAL, GLX_ZSIZE, GLX_NOCONFIG,
GLX_NORMAL, GLX_STENSIZE, 1,
GLX_OVERLAY, GLX_BUFSIZE, 2,
0, 0, 0 );
}
glWin = GLXgetvalue ( config, GLX_NORMAL, GLX_WINDOW ),
overWin = GLXgetvalue ( config, GLX_OVERLAY, GLX_WINDOW ),
free ( config );
pfInitGLXGfx ( p, ( void * ) xDpy, xWin, glWin, overWin, 0UL );
pfApplyMtl ( pfNewMtl ( pfGetSharedArena () ) );
pfApplyLModel ( pfNewLModel ( pfGetSharedArena () ) );
}
//=============================================================================
//
// FUNCTION GLXgetvalue.
//
//
// Used to get a value out of the configuration structure returned by
// GLXgetconfig. Scan through the GLX config structure, and, when we
// find the proper buffer-mode combination, return the argument relevant
// for that buffer type.
//
//=============================================================================
static unsigned long GLXgetvalue ( GLXconfig* conf, int buffer, int mode )
{
int i;
for ( i = 0; conf [ i ].buffer; i++ ) {
if ( conf [ i ].buffer == buffer && conf [ i ].mode == mode ) {
return conf [ i ].arg;
}
}
return 0;
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:36 PDT