Re: DIGITAL_MEDIA_PBUFFER and Performer

New Message Reply Date view Thread view Subject view Author view

Software Development & Support. (brainval++at++ehome.encis.es)
Tue, 02 Feb 1999 12:50:11 -0500


Juan Pablo Di Lelle wrote:

> Software Development & Support. wrote:
>
> > static void OpenPbuf(pfPipeWindow *pw)
> > {
> > pfPipe *p;
> > pfWSDrawable gxw;
> > pfWSConnection dsp;
> > int xs=0, ys=0, wxs, wys, num, screen, ret;
> ^^^^^^^^^^^^^^
>
> I just changed this by xs=640,ys=480 and it works.
> I mean, I don't get the X Error of failed request.
> ( I do have this error with the zero values )
>
> try it.
>

It's already checked and doesn't work.

I send the pbuffer.c with a small modification. Only for use my pbuffer
with attribs.
This program gives me as result:

Num matching FBConfigs on display 0x100212f8=:0.0 screen 0 is 2 VisID:36
pbuffer size: 640 480
X Error of failed request: BadAlloc (insufficient resources for
operation)
  Major opcode of failed request: 141 (GLX)
  Minor opcode of failed request: 5 (X_GLXMakeCurrent)
  Serial number of failed request: 0

If you can check it in another machine and it works, then we will know
that the problem
is anywhere else.

Thanks in advance.

Hector Viguer.

--
Brainstorm Multimedia.
Software  development.

e_mail: brainval++at++ehome.encis.es

Juan Pablo Di Lelle wrote:

Software Development & Support. wrote:

> static void OpenPbuf(pfPipeWindow *pw)
> {
>     pfPipe *p;
>     pfWSDrawable gxw;
>     pfWSConnection dsp;
>     int xs=0, ys=0, wxs, wys, num, screen, ret;
         ^^^^^^^^^^^^^^

I just changed this by xs=640,ys=480 and it works.
I mean, I don't get the X Error of failed request.
( I do have this error with the zero values )

try it.
 

It's already checked and doesn't work.

I send the pbuffer.c with a small modification. Only for use my pbuffer with attribs.
This program gives me as result:

Num matching FBConfigs on display 0x100212f8=:0.0 screen 0 is 2 VisID:36
pbuffer size: 640 480
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  141 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  0
 

If you can check it in another machine and it works, then we will know that the problem
is anywhere else.

Thanks in advance.
 

Hector Viguer.

-- 
Brainstorm Multimedia.  
Software  development.

e_mail: brainval++at++ehome.encis.es
  /* * Copyright 1995, Silicon Graphics, Inc. * ALL RIGHTS RESERVED * * UNPUBLISHED -- Rights reserved under the copyright laws of the United * States. Use of a copyright notice is precautionary only and does not * imply publication or disclosure. * * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: * Use, duplication or disclosure by the Government is subject to restrictions * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or * in similar or successor clauses in the FAR, or the DOD or NASA FAR * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that (i) the above copyright notices and this * permission notice appear in all copies of the software and related * documentation, and (ii) the name of Silicon Graphics may not be * used in any advertising or publicity relating to the software * without the specific, prior written permission of Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, * INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY * THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. * * pbuffer.c * * IRIS Performer pfPipeWindow example showing use of pbuffers. * * $Revision: 1.12 $ * $Date: 1997/12/11 12:14:03 $ * * Command line options: * 'b' : noborder window * 'F' : run X input in forked process * 'm procsplit' : multiprocess mode * * * Run-time controls: * ESC-key: exits * F1-key: profile * Left-mouse: advance * Middle-mouse: stop * Right-mouse: retreat * C-key : close window (will auto-reopen in 3 secs). * s-key : toggle window between gfx and fill-stats windows */ #include #include #include #include /* for sigset for forked X event handler process */ #include /* for cmdline handler */ #include #include #include #include #define WIN_SIZE 400 #define WIN_X_SIZE 640 #define WIN_Y_SIZE 480 /* * structure that resides in shared memory so that the * application, cull, and draw processes can access it. */ typedef struct { pfPipeWindow *pwCopy; pfPipeWindow *pwPbuf; int exitFlag; int inWindow, reset; float mouseX, mouseY; int winSizeX, winSizeY; int mouseButtons; pfCoord view, viewOrig; float sceneSize; int drawStats; } SharedData; #ifndef IRISGL static int FBAttrs[] = { GLX_DRAWABLE_TYPE_SGIX, GLX_WINDOW_BIT_SGIX | GLX_PBUFFER_BIT_SGIX, GLX_RENDER_TYPE_SGIX, GLX_RGBA_BIT_SGIX, PFFB_RED_SIZE, 5, PFFB_BLUE_SIZE, 5, PFFB_GREEN_SIZE, 5, PFFB_ALPHA_SIZE, 1, GLX_DEPTH_SIZE, 24, None, }; #endif static SharedData *Shared; /* * APP process variables */ /* for configuring multi-process */ static int ProcSplit = PFMP_DEFAULT; /* write out scene upon read-in - uses pfDebugPrint */ static int WinType = PFPWIN_TYPE_X; char ProgName[PF_MAXSTRING]; /* light source created and updated in DRAW-process */ static pfLight *Sun=NULL; static void CullChannel(pfChannel *chan, void *data); static void DrawCopy(pfChannel *chan, void *data); static void DrawPbuf(pfChannel *chan, void *data); static void OpenPbuf(pfPipeWindow *pw); static void OpenCopy(pfPipeWindow *pw); static void Usage(void); /* * Usage() -- print usage advice and exit. This procedure * is executed in the application process. */ static void Usage (void) { pfNotify(PFNFY_FATAL, PFNFY_USAGE, "Usage: %s [-m procSplit] [file.ext ...]\n", ProgName); exit(1); } /* * docmdline() -- use getopt to get command-line arguments, * executed at the start of the application process. */ static int docmdline(int argc, char *argv[]) { int opt; strcpy(ProgName, argv[0]); /* process command-line arguments */ while ((opt = getopt(argc, argv, "Fm:Rp:?")) != -1) { switch (opt) { case 'm': case 'p': ProcSplit = atoi(optarg); break; case '?': Usage(); } } return optind; } /* * main() -- program entry point. this procedure * is executed in the application process. */ int main (int argc, char *argv[]) { int arg; int found; pfNode *root; pfChannel *chanPbuf, *chanCopy; pfScene *scene; pfPipe *p; pfPipeWindow *pw; pfEarthSky *eSky; pfFrameStats *fstats; pfSphere bsphere; float far = 10000.0f; double ct; pfWSConnection dsp=NULL; #ifdef IRISGL pfNotify(PFNFY_NOTICE,PFNFY_PRINT,"Sorry, pfbuffers are only supported under OpenGL."); exit(0); #endif arg = docmdline(argc, argv); pfInit(); /* configure multi-process selection */ pfMultiprocess(ProcSplit); /* allocate shared before fork()'ing parallel processes */ Shared = (SharedData*)pfCalloc(1, sizeof(SharedData), pfGetSharedArena()); Shared->inWindow = 0; Shared->reset = 0; Shared->exitFlag = 0; Shared->drawStats = 0; /* Load all loader DSO's before pfConfig() forks */ for (found = arg; found < argc; found++) pfdInitConverter(argv[found]); /* initiate multi-processing mode set in pfMultiprocess call * FORKs for Performer processes, CULL and DRAW, etc. happen here. */ pfConfig(); /* configure pipes and windows */ p = pfGetPipe(0); pfPipeScreen(p, 0); Shared->pwPbuf = pfNewPWin(p); Shared->pwCopy = pfNewPWin(p); /* make copy 2nd so pbuf is drawn first */ pfPWinShare(Shared->pwPbuf, PFWIN_SHARE_FBCONFIG | PFWIN_SHARE_STATE | PFWIN_SHARE_GL_OBJS); pfPWinType(Shared->pwPbuf, PFPWIN_TYPE_SHARE); pfPWinType(Shared->pwCopy, PFPWIN_TYPE_SHARE); pfPWinOriginSize(Shared->pwPbuf, 0, 0, WIN_X_SIZE, WIN_Y_SIZE); pfPWinOriginSize(Shared->pwCopy, 0, 0, WIN_X_SIZE, WIN_Y_SIZE); pfPWinName(Shared->pwPbuf, "PBuffer"); pfPWinType(Shared->pwPbuf, WinType | PFWIN_TYPE_PBUFFER); /* Open and configure the GL window. */ pfPWinConfigFunc(Shared->pwPbuf, OpenPbuf); pfConfigPWin(Shared->pwPbuf); pfPWinName(Shared->pwCopy, "Copy"); pfPWinType(Shared->pwCopy, WinType); /* Open and configure the GL window. */ pfPWinConfigFunc(Shared->pwCopy, OpenCopy); pfConfigPWin(Shared->pwCopy); /* specify directories where geometry and textures exist */ if (!(getenv("PFPATH"))) pfFilePath( "." ":./data" ":../data" ":../../data" ":../../../../data" ":/usr/share/Performer/data" ); pfNotify(PFNFY_INFO, PFNFY_PRINT,"FilePath: %s\n", pfGetFilePath()); /* load files named by command line arguments */ scene = pfNewScene(); for (found = 0; arg < argc; arg++) { if ((root = pfdLoadFile(argv[arg])) != NULL) { pfAddChild(scene, root); found++; } } /* if no files successfully loaded, terminate program */ #if 0 if (!found) Usage(); #endif pfFrameRate(30.0f); pfPhase(PFPHASE_FREE_RUN); chanPbuf = pfNewChan(p); pfAddChan(Shared->pwPbuf, chanPbuf); pfChanTravFunc(chanPbuf, PFTRAV_CULL, CullChannel); pfChanTravFunc(chanPbuf, PFTRAV_DRAW, DrawPbuf); pfChanScene(chanPbuf, scene); pfChanNearFar(chanPbuf, 0.1f, far); /* Create an earth/sky model that draws sky/ground/horizon */ eSky = pfNewESky(); pfESkyMode(eSky, PFES_BUFFER_CLEAR, PFES_SKY_GRND); pfESkyAttr(eSky, PFES_GRND_HT, -10.0f); pfChanESky(chanPbuf, eSky); /* vertical FOV is matched to window aspect ratio */ pfChanFOV(chanPbuf, 45.0f, -1.0f); if (found) { pfGetNodeBSphere (scene, &bsphere); Shared->sceneSize = bsphere.radius; } else { pfSetVec3(Shared->view.xyz, 0.0f, 0.0f, 100.0f); PFSET_VEC3(bsphere.center, 0.0, 0.0, 0.0); bsphere.radius = Shared->sceneSize = 10000.0f; } pfSetVec3(Shared->view.hpr, 0.0f, 0.0f, 0.0f); pfChanView(chanPbuf, Shared->view.xyz, Shared->view.hpr); PFCOPY_VEC3(Shared->viewOrig.xyz, Shared->view.xyz); PFCOPY_VEC3(Shared->viewOrig.hpr, Shared->view.hpr); chanCopy = pfNewChan(p); pfMakeOrthoChan(chanCopy, 0, WIN_X_SIZE, 0, WIN_Y_SIZE); pfChanNearFar(chanCopy, -1, 100); pfChanTravFunc(chanCopy, PFTRAV_DRAW, DrawCopy); pfAddChan(Shared->pwCopy, chanCopy); pfChanScene(chanCopy, pfNewScene()); pfFrame(); /* main simulation loop */ while (!Shared->exitFlag) { double t; float s, c; /* wait until next frame boundary */ pfSync(); pfFrame(); /* Compute new view position. */ t = pfGetTime(); pfSinCos(45.0f*t, &s, &c); pfSetVec3(Shared->view.hpr, 45.0f*t, -10.0f, 0); pfSetVec3(Shared->view.xyz, 2.0f * bsphere.radius * s, -2.0f * bsphere.radius *c, 0.5f * bsphere.radius); pfChanView(chanPbuf, Shared->view.xyz, Shared->view.hpr); /* initiate traversal using current state */ } /* terminate cull and draw processes (if they exist) */ pfExit(); /* exit to operating system */ return 0; } /* * CullChannel() -- traverse the scene graph and generate a * display list for the draw process. This procedure is * executed in the CULL process. */ static void CullChannel(pfChannel *channel, void *data) { /* * pfDrawGeoSet or other display listable Performer routines * could be invoked before or after pfCull() */ (channel, data); pfCull(); } /* * OpenPipeWin() -- create a win: setup the GL and IRIS Performer. * This procedure is executed in the DRAW process * (when there is a separate draw process). */ static void OpenPbuf(pfPipeWindow *pw) { pfPipe *p; pfWSDrawable gxw; int attribs [] = { #define USE_DMEDIA_PBUFFER #ifdef USE_DMEDIA_PBUFFER GLX_DIGITAL_MEDIA_PBUFFER_SGIX, True, GLX_PRESERVED_CONTENTS_SGIX, True, #endif (int) None }; pfWSConnection dsp; int xs=0, ys=0, wxs, wys, num, screen, ret; Window pbuf; #ifndef IRISGL GLXFBConfigSGIX *fbc; XVisualInfo * vis; #endif dsp = pfGetCurWSConnection(); screen = pfGetPWinScreen(pw); if (screen < 0) { screen = DefaultScreen(dsp); pfPWinScreen(pw, screen); } #ifndef IRISGL { fbc = glXChooseFBConfigSGIX(dsp, 0, FBAttrs, &num); vis = glXGetVisualFromFBConfigSGIX(dsp, *fbc); printf("Num matching FBConfigs on display 0x%p=%s screen %d is %d VisID:%X \n", dsp, XDisplayString(dsp), screen, num, vis->visualid); /* just use first FBConfig found */ #if 0 glXGetFBConfigAttribSGIX(dsp, *fbc, GLX_OPTIMAL_PBUFFER_WIDTH_SGIX, &xs); glXGetFBConfigAttribSGIX(dsp, *fbc, GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX, &ys); pfNotify(PFNFY_NOTICE,PFNFY_PRINT, "Optimal pbuffer size: %d %d", xs, ys); #endif /* note that since we are drawing to the pbuffer, if the pbuffer * is bigger, the visual window will only show the lower-left * corner of the scene */ pfGetPWinSize(pw, &wxs, &wys); if (!xs) { xs = wxs; ys = wys; } else if (xs < wxs || ys < wys) pfPWinSize(Shared->pwCopy, xs, ys); pfPWinSize(pw, xs, ys); pfPWinFBConfig(pw, *fbc); printf("pbuffer size: %d %d\n", xs, ys); gxw = glXCreateGLXPbufferSGIX( dsp, * fbc, xs, ys, attribs); pfPWinWSDrawable(pw, dsp, gxw); } #endif pfOpenPWin(pw); pbuf = pfGetPWinWSDrawable(pw); pfNotify(PFNFY_NOTICE,PFNFY_PRINT,"PBuf is 0x%x", pbuf); /* create a light source in the "south-west" (QIII) */ Sun = pfNewLight(NULL); pfLightPos(Sun, -0.3f, -0.3f, 1.0f, 0.0f); pfNotify(PFNFY_NOTICE,PFNFY_PRINT,"PBuf is OPEN"); } static void OpenCopy(pfPipeWindow *pw) { pfOpenPWin(pw); pfNotify(PFNFY_NOTICE,PFNFY_PRINT,"Main window is OPEN"); } /* * DrawPbuf() -- draw the scene graph into the pbuffer window * procedure is executed in the draw process (when there is a * separate draw process). */ static void DrawPbuf (pfChannel *channel, void *data) { /* rebind light so it stays fixed in position */ pfLightOn(Sun); /* erase framebuffer and draw Earth-Sky model */ pfClearChan(channel); /* invoke Performer draw-processing for this frame */ pfDraw(); /* draw Performer throughput statistics */ pfDrawChanStats(channel); } /* * DrawCopy() -- copy the pbuffer window the visible window */ static void DrawCopy (pfChannel *channel, void *data) { pfWSDrawable draw, read; pfGLContext ctx; int width, height; pfWSConnection dsp; pfGetPWinSize(Shared->pwCopy, &width, &height); dsp = pfGetCurWSConnection(); read = pfGetPWinWSDrawable(Shared->pwPbuf); draw = pfGetPWinWSDrawable(Shared->pwCopy); ctx = pfGetPWinGLCxt(Shared->pwCopy); #ifndef IRISGL #if 0 if (!read) return; #endif glXMakeCurrentReadSGI(dsp, draw, read, ctx); pfPushIdentMatrix(); glRasterPos2i(1, 1); glCopyPixels(0, 0, width, height, GL_COLOR); pfPopMatrix(); { int err; if ((err = glGetError()) != GL_NO_ERROR) pfNotify(PFNFY_NOTICE,PFNFY_USAGE,"OpenGL Error 0x%x - %s",err, gluErrorString(err)); } #endif }

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Feb 02 1999 - 03:44:10 PST

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