[info-performer] Problem with frame buffer configuration

Date view Thread view Subject view Author view

From: Mike Pfauth (MPFAUTH++at++colsa.com)
Date: 06/04/2003 10:29:42


I am writing a viewer which uses Performer to render smooth-shaded models and
Motif for the GUI.

After studying the source in src/lib/libpfx and src/pguide/libpfx, I have
something which almost works.

The problem is that I can't seem to get a frame buffer configuration which will
allow smooth shaded rendering -- I only get flat shaded rendering.

I have some other viewers which use only Performer (no X/Motif) which work fine.
Using xwininfo, I get the following for the Performer-only viewer:
  Depth: 24
  Visual id: 0x37
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x7000001 (not installed)

For my Motif viewer I get:
  Depth: 24
  Visual id: 0x37
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x6400037 (installed)

  findvis output:
  0x37, RGBA 12/12/12/0, db, Z 24, S 8, accum 16/16/16/16

The only difference seems to be in installed vs uninstalled color maps.

My inclination is to try to uninstall the colormap on the graphics window (wish
me luck!) but maybe I am just missing something.

Any help will be welcome.

Hardware/OS/Performer: Octane, IRIX 6.5, 2.5.3

Relevant source code:

Lines commented out are approaches which failed.

    1 myMotifViewer::myMotifViewer(Widget parent_widget)
    2 {
    3
    4 isRunning = exitSim = false;
    5
    6
    7 pipe = pfGetPipe(0);
    8
    9 pipeWindow = new pfPipeWindow(pipe);
   10 pipeWindow->setWinType(PFPWIN_TYPE_X);
   11
   12 xDisplay = XtDisplay(topLevel);
   13 pipeWindow->setWSWindow(xDisplay, XtWindow(topLevel));
   14
   15 int fbAttrs[]
   16 = {GLX_RGBA,
   17 GLX_DOUBLEBUFFER,
   18 GLX_DEPTH_SIZE, 24,
   19 GLX_BUFFER_SIZE, 12,
   20 GLX_STENCIL_SIZE, 8,
   21 GLX_ACCUM_RED_SIZE, 16,
   22 GLX_ACCUM_GREEN_SIZE, 16,
   23 GLX_ACCUM_BLUE_SIZE, 16,
   24 GLX_ACCUM_ALPHA_SIZE, 16,
   25 0};
   26
   27 int sizeAttrs = 0;
   28 int i;
   29
   30 for(i = 0; fbAttrs[i] != 0; i++) {
   31 sizeAttrs += sizeof(int);
   32 }
   33 sizeAttrs += sizeof(int);
   34
   35 int *sharedAttrs = (int *)pfMalloc(sizeAttrs, pfGetSharedArena());
   36 memcpy(sharedAttrs, fbAttrs, sizeAttrs);
   37
   38 //pfFBConfig fbConfig = pipeWindow->chooseFBConfig(sharedAttrs);
   39 //pfFBConfig fbConfig = glXChooseVisual(xDisplay, 0, sharedAttrs);
   40
   41 int config = 0;
   42 pfFBConfig fbConfig = pfChooseFBConfigData((void **)&config,xDisplay,-1,NULL,
   43 pfGetSharedArena());
   44
   45
   46 // pfFBConfig fbConfig =
   47 // pfuChooseFBConfig(xDisplay, -1, fbAttrs, pfGetSharedArena());
   48
   49
   50 printFBInfo(fbConfig);
   51
   52 if(fbConfig == 0)
   53 printf("myMotifViewer::myMotifViewer -- WARNING -- x visual is null\n");
   54
   55
   56 glWidget =
   57 XtVaCreateManagedWidget("glWidget",
   58 glwMDrawingAreaWidgetClass, parent_widget,
   59 GLwNvisualInfo, fbConfig,
   60 // GLwNrgba, True,
   61 // GLwNdoublebuffer, True,
   62 // GLwNdepthSize, 24,
   63 // GLwNbufferSize, 12,
   64 // GLwNstencilSize, 8,
   65 // GLwNaccumRedSize, 16,
   66 // GLwNaccumGreenSize, 16,
   67 // GLwNaccumBlueSize, 16,
   68 // GLwNaccumAlphaSize, 16,
   69 XmNleftAttachment, XmATTACH_FORM,
   70 XmNrightAttachment, XmATTACH_FORM,
   71 XmNtopAttachment, XmATTACH_FORM,
   72 XmNbottomAttachment, XmATTACH_FORM,
   73 0);
   74
   75 //XtAddCallback(glWidget, GLwNinputCallback, (XtCallbackProc)inputCB, 0);
   76 // XtAddEventHandler(glWidget,
   77 // ButtonReleaseMask | ButtonPressMask |
   78 // KeyPressMask | KeyReleaseMask,
   79 // False, (XtEventHandler)inputEH, 0);
   80
   81 pfWSDrawable glWin = XtWindow(glWidget);
   82
   83 printf("glWin %x\n", glWin);
   84
   85 pipeWindow->setWSDrawable(xDisplay, glWin);
   86
   87 pipeWindow->open();
   88
   89
   90 pfWSWindow wsWin = pipeWindow->getWSWindow();
   91 // XSelectInput(xDisplay, wsWin, KeyPressMask );
   92 pfuInitInput(pipeWindow, PFUINPUT_X);
   93
   94
   95
   96
   97 scene = new pfScene();
   98
   99 pfLightSource *light = new pfLightSource;
  100 light->setColor(PFLT_DIFFUSE, 1.0f, 1.0f, 1.0f); // white light
  101 light->setColor(PFLT_AMBIENT, .4f, .4f, .6f);
  102 light->setPos(1.0, -1.0, 0.0, 0.0);
  103
  104 scene->addChild(light);
  105
  106 channel = new pfChannel(pipe);
  107 channel->setScene(scene);
  108 channel->setFOV(defaultFOV, 0.0f);
  109 channel->setNearFar(1.0f, 100.0f);
  110
  111 viewPos.set(0.0, 0.0, 0.0);
  112 viewDir.set(0.0, 0.0, 0.0);
  113
  114 channel->setView(viewPos, viewDir);
  115
  116 gNode = 0;
  117
  118 }
  119
  120
  121
  122 int main(int argc, char *argv[]) {
  123
  124
  125 topLevel = XtAppInitialize(&appContext, "", 0, 0, &argc, argv,
  126 0, 0, 0);
  127
  128 Arg al[10];
  129 int ac;
  130
  131 ac = 0;
  132 XtSetArg(al[ac], XmNheight, 800); ac++;
  133 XtSetArg(al[ac], XmNwidth, 800); ac++;
  134 XtSetValues(topLevel, al, ac);
  135
  136 makeGUIPanel();
  137
  138 XtRealizeWidget(topLevel);
  139
  140 pfInit();
  141
  142 pfdInitConverter("pfb");
  143
  144 pfConfig();
  145
  146 viewer = new myMotifViewer(displayForm);
  147
  148
  149 XtAppAddWorkProc(appContext, simFrame, 0);
  150
  151 XtAppMainLoop(appContext);
  152
  153
  154 return 0;
  155
  156 }

The human brain is only used to 10% of capacity.
The rest is overhead for the operating system.


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Jun 04 2003 - 10:32:27 PDT