Re: glwMDrawingAreaWidgetClass creation

New Message Reply Date view Thread view Subject view Author view

Rob Jenkins (robj++at++sgi.com)
Thu, 19 Nov 1998 02:05:21 -0800


Ken

If you use pfChooseFBConfig then Performer will try to do some sensible
default things if it fails to get exactly what you asked for ( defaults
are shown in the man page ), for example any fbconfig I think would have
some zbuffer. If you do the CreateManagedWidget thing with attrs set 'by
hand' and don't specify some depth bits explicitly then
XtCreateManagedWidget is free to select a visual without depth bits (
use findvis or glxinfo to see the list of potential visuals on your
machine ). I would suggest that you always put GLwNdepthSize or 1, if
you read man glxchoosevisual you'll see that putting a value of 1 means
'give me the visual that satisfies all my other criteria, and has the
biggest depth buffer (. This will also avoid the other danger of
'hardwiring' values, in the case of depth bits esp, you might get 24
bits depth OK on all machines, then run on an iR which has a max of 23
bits zbuffer ( incidently, due to some HW compression jiggery pokery
this is a good as the old 32 bit zbuffer on RE2 ), asking for 24 bits
depth on iR will mean you'll fail to get anything....

Basically, never assume you got what you asked for, check the visual
with glGet/GLXget etc to se that you got the things you need. Another
tip: to see the visual you got while the app is running do:

xwininfo -tree

click the mouse in the app window as prompted, this will list the
heirachy of windows for the app, then do:

xwininfo -id <a hex id number from the tree listing>

you'll have to experiment a little if you have a deep tree of windows (
overlays etc ) to get the main performer window, anyway, you'll then
which visual Id it's using and can look it up with findfis or glxinfo.

Cheers
Rob

Tanaka, Ken wrote:
>
> I have a basic question about mixing Performer (OpenGL) with X windows.
>
> Can you tell me if initializing the graphics widget in code snippet A is
> equivalent to code snippet B? Primarily of interest is the creation of
> glwidget by Xt[Va]CreateManagedWidget--is "GLwNrgba..GLwNdepthSize" an
> acceptable substitute for "GLwNvisualInfo" returned by pfChooseFBConfig()?
>
> If so, my application can be setup as in snippet A, with pfInit() following
> widget creation. I've noticed that leaving out "GLwNdepthSize, 24," as in
> some
> examples I've encountered (pfview/Viewer.C, a Performer and RapidApp
> example),
> don't zbuffer correctly, yielding inside-out looking geometry.
>
> Thanks,
> Ken Tanaka
> Air Force Research Laboratory Phone: 602 988 9773 x 413
> Raytheon/Boeing/Lockheed-Martin Fax: 602 988 3556
> Email: ken.tanaka++at++williams.af.mil
>
> A ---------------------------- (from output of BX Pro, C++/ViewKit mode)
> // ":" indicates one or more delete lines
> struct SharedData
> {
> pfPipeWindow *pw;
> pfChannel *chan;
> pfScene *scene;
> :
> };
>
> typedef struct MotifData_t {
> Window xWin, gXWin;
> XtWorkProcId work_id;
> }MotifData_t;
>
> // Inter-process communication structures
> static SharedData *Shared;
> MotifData_t *Motif;
>
> :
> // frame is the parent widget of class xmFrameWidgetClass
> ac = 0;
> XtSetArg(args[ac], GLwNrgba, True); ac++;
> XtSetArg(args[ac], GLwNstencilSize, 4); ac++;
> XtSetArg(args[ac], GLwNdoublebuffer, True); ac++;
> XtSetArg(args[ac], GLwNdepthSize, 24); ac++;
> XtSetArg(args[ac], XmNwidth, 600); ac++;
> XtSetArg(args[ac], XmNheight, 400); ac++;
> glwidget = XtCreateManagedWidget("glwidget",
> glwMDrawingAreaWidgetClass,
> frame,
> args,
> ac);
> :
> // Performer Initialization
> pfInit();
>
> // Malloc into Performer Shared Memory the Shared Arena
> Shared = (SharedData*)pfMalloc(sizeof(SharedData),
> pfGetSharedArena());
> :
> pfConfig();
> :
> Motif = (MotifData_t*)pfMalloc(sizeof(MotifData_t), pfGetSharedArena());
> :
> // Build initial scene graph
> // Enter Application loop
>
>
> B ---------------------------- (from Performer/src/pguide/libpf/C++/motif.C)
> :
> // Performer Initialization
> pfInit();
>
> // Allocate shared before fork()'ing motif so that all
> // processes see the Shared pointer.
> Shared = (SharedData*)pfCalloc(1, sizeof(SharedData),
> pfGetSharedArena());
> :
> Motif = (MotifData_t*)pfCalloc(1, sizeof(MotifData_t),
> pfGetSharedArena());
> :
> // initiate multi-processing mode set in pfMultiprocess call
> pfConfig();
> :
> // Create Performer Window
> // Build initial scene graph
> :
> // MOTIF PART
> // frame is the parent widget of class xmFrameWidgetClass
> XVisualInfo *vinfo;
> Display *xdpy;
>
> xdpy = XtDisplay( toplevel );
> vinfo = pfChooseFBConfig(xdpy, -1, NULL);
> glwidget = XtVaCreateManagedWidget ( "glwidget",
> glwMDrawingAreaWidgetClass,
> frame,
> GLwNvisualInfo, vinfo,
> XmNwidth, 600,
> XmNheight, 400,
> (XtPointer) NULL );
> :
> // Enter Application loop
>
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
________________________________________________________________
Rob Jenkins	Silicon Graphics 	mailto:robj++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Thu Nov 19 1998 - 02:50:53 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.