RE: [info-performer] Subdivision surface not showing up on IRIX

Date view Thread view Subject view Author view

From: Dick Rous (dick++at++sgi.com)
Date: 02/28/2005 23:52:12


To what value do you set pfMultiprocess on Linux? And on Irix?
(If you use the default value, what is the number of processors on your
Linux box?)

Dick.

-----Original Message-----
From: owner-info-performer++at++performer.engr.sgi.com
[mailto:owner-info-performer++at++performer.engr.sgi.com] On Behalf Of Artem
Baguinski
Sent: Monday, February 28, 2005 22:23
To: Info Performer
Cc: evolutie
Subject: [info-performer] Subdivision surface not showing up on IRIX

Hello, dear list.

Me and my collegues are developing an application to run in a virtual
reality environment. We develop on linux and test it once in a while on a
real setup which is:

Onyx4 UltimateVision, it is the IRIX/MIPS model with the ATI graphics cards.
We have a passive stereo I-space, and we use both heads of the ATI cards
(left and right projector, 1 wall per card).

Last week we have implemented a generated kinda fluid environment using
subdivision surfaces random() and sin(). It looked just like the artist
concept we are trying to breath life into and we were curious how it will
look in a cave.

To our utter disapointment it doesn't look like anything at all - we just
see the rest of the virtual stuff floating in the space and no subdivided
environment.

We use OpenGL Performer 3.1 on IRIX and 3.1.1/3.2 on Linux.

This is our first encounter with IRIX, its C compiler and Performer, so we
have no idea where things could possibly go wrong [or rather, we're sure
they could go wrong just about anywhere]. I've created a very stripped
version: no lights, no objects, no cave specific calls and even no fluid
animation of the environment - only its generation and rendering. it's still
215 lines with my main concerns being functions
precompute() (which generates the initial [and in this version final] shape
of the environment) and subdiv_membrane() which uses precomputed vertices to
build the control mesh and then subdivide it:

static void
precompute()
{
   int i,j;

   membrane_verts =
pfMalloc((2*MEMBRANE_RES-1)*MEMBRANE_RES*sizeof(pfVec3),pfGetSharedArena());
   for (i=0;i<MEMBRANE_RES;i++)
     for (j=0;j<MEMBRANE_RES;j++) {
       float
        x = (float)i/(float)MEMBRANE_RES,
        y = (float)j/(float)MEMBRANE_RES,
        a = 1.0 - cos( x * M_PI ),
        b = 1.0 - cos( sqrt(x*x + (y-0.5)*(y-0.5)*4) * M_PI );

       MEMBRANE_VERTS(i,j)[0] = x;
       MEMBRANE_VERTS(i,j)[1] = y;
       MEMBRANE_VERTS(i,j)[2] = 3.0 * ((float)random()/(float)RAND_MAX -
0.5) + 0.7*a + b - 2.5;
       /* mirroring by repeating vertices with the inverse x, i had my
reasons ;-) */
       MEMBRANE_VERTS(-i,j)[0] = -x;
       MEMBRANE_VERTS(-i,j)[1] = y;
       MEMBRANE_VERTS(i,j)[2] = 3.0 * ((float)random()/(float)RAND_MAX -
0.5) + 0.7*a + b - 2.5;
     }
}

static pfNode *
subdiv_membrane(int order, pfGeoState * gs) {
   int i,j;
   pfMesh * membrane_mesh = pfNewMesh(pfGetSharedArena());
   pfSubdivSurface * membrane = pfNewSubdivSurface(pfGetSharedArena());
   pfVec3 * face[4];

   pfMeshFlags(membrane_mesh,PFM_FLAG_TEST_ORIENTATION,1);
   pfMeshFlags(membrane_mesh,PFM_FLAG_CREASES_BETWEEN_PARTS,0);
   for(i=0; i<MEMBRANE_RES-1; i++)
     for(j=0; j<MEMBRANE_RES-1; j++) {
       face[0] = &MEMBRANE_VERTS(i,j);
       face[1] = &MEMBRANE_VERTS(i+1,j);
       face[2] = &MEMBRANE_VERTS(i+1,j+1);
       face[3] = &MEMBRANE_VERTS(i,j+1);
       pfMeshAddFace(membrane_mesh, face, 4, NULL, PART_NUM(i,j), gs);

       face[0] = &MEMBRANE_VERTS(-i,j);
       face[1] = &MEMBRANE_VERTS(-i,j+1);
       face[2] = &MEMBRANE_VERTS(-i-1,j+1);
       face[3] = &MEMBRANE_VERTS(-i-1,j);
       pfMeshAddFace(membrane_mesh, face, 4, NULL, PART_NUM(-i-1,j), gs);
     }
   pfMeshSplitVertices(membrane_mesh);

   pfSubdivSurfaceVal(membrane,PFSB_SUBDIVISION_METHOD,PFSB_CATMULL_CLARK);
   pfSubdivSurfaceVal(membrane,PFSB_SUBDIVISION_LEVEL,order);

   /* XXX The following line makes X on IRIX crash if the 0 is changed to 1
*/
   /*pfSubdivSurfaceFlags(membrane,PFSB_GPU_SUBDIVISION,0);*/

   /* XXX The following line makes application segfault on Linux when 0 is
changed to 1 */
   pfSubdivSurfaceFlags(membrane,PFSB_USE_GEO_ARRAYS,0);
   pfSubdivSurfaceMesh(membrane,membrane_mesh);
   /* it seems i only have to set the line width for the first geoset and
the rest will reuse it */
   pfGSetLineWidth(pfGetGSet((pfGeode*)membrane,0), 1.0f);

   return (pfNode*) membrane;
}

The buildable [i only could test this one on linux, tiny change to Makefile
is required on IRIX which is mentioned in the comments] version of the
stripped of all irrelevant details code is available here:

http://www.artm.org/pub/membrane/

I'd be happy if somebody could spot what exactly I'm doing wrong, unportable
or whatever.

P.S. in the second version i've marked with XXX comments two curious cases -
changing those flags causes a crash of the X server on IRIX in the first
case and of our application on Linux in the second. I wonder if that's
normal. (yes i read that GPU subdivision is slow on Onyx4 but I was
desperate)

-- 
Artem Baguinski:                         http://www.artm.org/
V2_Lab:                                  http://lab.v2.nl/
V2_ Organisation for the Unstable Media: http://www.v2.nl/

----------------------------------------------------------------------- List Archives, Info, FAQ: http://www.sgi.com/software/performer/ Open Development Project: http://oss.sgi.com/projects/performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com -----------------------------------------------------------------------


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Feb 28 2005 - 23:49:27 PST