Re: Problem with pfMergeBuffer

New Message Reply Date view Thread view Subject view Author view

AnitaKishore (kishore++at++electrogig.com)
Fri, 19 Jan 1996 10:45:32 -0800


Yes, I checked this with a sample program (as attached) and it crashes
if I create a geode before a group in the DBASE process, the geode is a child
of the group in the graph. Runs fine if group is created before geode.

My sample program doesn't read any database so you won't see any geometry
on the window. It will be blank. I tested this on Performer2.0, a151.
Is there a bug?

-anita

On Jan 19, 1:53pm, Keith Babarovich wrote:
> Subject: Problem with pfMergeBuffer
>
> I have been attempting to create a separate DBASE function that creates
> some geometry and adds it to the scene. However I have found that the
> order in which I create the nodes is critical. For example if I create a
> pfGroup and then create a pfGeode and attach the geode to the group the
> pfMergeBuffer in my separate DBASE function works. If however I create
> the pfGeode and then create the pfGroup the pfMergeBuffer crashes at the
> following location.
> dbx) where
> > 0 pfGroup::nb_clean(int)(0x182f2c04, 0x0, 0x18041274, 0x1831f670,
0xfbe0008)
> ["../../../lib/libpf/pfGroup.C":144, 0x5d127344]
> 1 pfBuffer::pf_prepareNewUpdatables(int)(0x182f2c04, 0x1, 0x18041274,
0x1831f670, 0x182f2bb0)
> ["../../../lib/libpf/pfBuffer.C":752, 0x5d182504]
> 2 pfBuffer::merge(0x182f2c04, 0x1, 0x18041274, 0x1831f670, 0x0)
> ["../../../lib/libpf/pfBuffer.C":556, 0x5d181410]
> 3 pfMergeBuffer(0x182f2c04, 0x1, 0x18041274, 0x1831f670, 0x0)
> ["../../../lib/libpf/cBuffer.C":63, 0x5d1b2534]
> 4 pageDBase(0x18265e10, 0x1, 0x18041274, 0x1831f670, 0x1)
> ["../ladbm.c":65, 0x40a610]
> 5 mpDBase()(0x18265e10, 0x1, 0x18041274, 0x1831f670, 0x0)
> ["../../../lib/libpf/pfProcess.C":3093, 0x5d1cda7c]
> 6 pfConfig(0x18265e10, 0x1, 0x18041274, 0x1831f670, 0x0)
> ["../../../lib/libpf/pfProcess.C":1705, 0x5d15a9a0]
> 7 main(0x18265e10, 0x1, 0x18041274, 0x1831f670, 0x1000f360)
> ["../../common/main.c":100, 0x415b98]
>
>
> An initial work around is to create them in the same top down order that
> they will appear in the scene graph, but this is difficult for some of
> the code I want to execute in the DBASE function.
>
> ------------------------------------------------------------------------------
> Keith Babarovich |Diversion contrary to U.S law is prohibited.This
> keithb++at++wormald.com.au |email may not be transfered,transshipped or re-
> Wormald Technology |exported on a noncontinuous voyage, or otherwise
> Advanced Systems Engineering|be disposed of by any unauthorised person
without
> Ph: +61 2 981 0611 |proper written approval of my mum. EL792126
 +
>
>-- End of excerpt from Keith Babarovich

// Demo program to check if the order of creating nodes causes any
// problems

#include <stdlib.h>
#include <Performer/pf.h>

void *arena = NULL;
pfScene **scene;
pfGroup *root;
int *dbaseDone;

void pageDBase(void *data);

int main(int argc, char *argv[])
{

        pfPipe *p;
        pfChannel *chan;
        pfCoord view;
        pfPipeWindow *pw;
         
        pfInit();

        arena = pfGetSharedArena();
        scene = (pfScene **) pfMalloc(sizeof(pfScene *), arena);
        dbaseDone = (int *) pfMalloc(sizeof(int), arena);
        *dbaseDone = 0;

        pfMultiprocess(PFMP_APP_CULL_DRAW | PFMP_FORK_DBASE);
        pfConfig();

        printf("APP pid = %d, CULL pid = %d, DRAW pid = %d, DBASE pid = %d\n",
                             (int)pfGetPID(0, PFPROC_APP),
                             (int)pfGetPID(0, PFPROC_CULL),
                             (int)pfGetPID(0, PFPROC_DRAW),
                             (int)pfGetPID(0, PFPROC_DBASE) );

        *scene = pfNewScene();

        p = pfGetPipe(0);
        pw = pfNewPWin(p);
        pfPWinType(pw, PFWIN_TYPE_X);
        pfPWinName(pw, "Dynamic scene Updation");
        pfPWinOriginSize(pw, 100, 100, 720, 486);
        pfOpenPWin(pw);

        chan = pfNewChan(p);
        pfChanScene(chan, *scene);
        pfChanNearFar(chan, 1.0f, 10000.0f);
        pfChanFOV(chan, 140.0f, -1.0f);
        pfSetVec3(view.hpr, 0, 0, 0);
        pfSetVec3(view.xyz, 0.0f, -50.0f, 60.0f);
        pfChanView(chan, view.xyz, view.hpr);

        pfDBaseFunc(pageDBase);

        while (TRUE)
        {
                if (*dbaseDone==1)
                {
                    printf("dbaseDone\n");
                    pfPrint(*scene, NULL, PFPRINT_VB_ON, NULL);
                    *dbaseDone = 0;
                }

                pfSync();
                pfFrame();
        }
        pfExit();
        return 0;

}

void pageDBase(void *data)
{
        static int i = 0;
        static pfBuffer *buf = NULL;
        pfGroup *grp;
        pfGeode *geode;

    if ( i==15 )
    {
        printf("Inserting nodes\n");

        if (buf == NULL)
        {
            buf = pfNewBuffer();
            pfSelectBuffer(buf);
        }

        // change the order of creation to see the crash
        grp = pfNewGroup();
        geode = pfNewGeode();

        pfAddChild(grp, geode);
        pfBufferAddChild(*scene, grp);
        pfMergeBuffer();

        *dbaseDone = 1;
    }
    i++;

    pfDBase();
}

#--
#-- definitions
#--

#-- force Make to use a known shell
SHELL = /bin/sh

#-- provide a list of alternate locations for file searches
UNIQUE = .

#-- alternate locatins for included files
INCLUDE = \
        -I${UNIQUE} \
        -I/usr/include/Performer

#-- some libraries lack .so versions; so use optimized .a's instead

#SRCLIBOPT= _ogl
SRCLIBOPT= _igl

LIBGL1 = -lgl
#LIBGL1 = -lGL

PERFORMER = \
        -lpfdu${SRCLIBOPT} \
        -lpfutil${SRCLIBOPT} \
        -lpf${SRCLIBOPT}

#-- IRIX 4.x uses shared gl {gl_s} library {System-V Make lacks #if tests}
LIBGL2 = ${LIBGL1:.4=_s}
LIBGL = ${LIBGL2:.5=}

# .ptu (Performer Terrain Utility)
# This loader requires linking with the ImageVision Libraries(IL)!
# Shoud you want to use the Performer Terrain Utility loader (.ptu)
# then install the image library and un-comment the following two
# definitions of LIBIL and LIBCIL.
#LIBIL = -lil
#LIBCIL = -lcil

SYSTEM = \
        -lInventor \
        -lmpc \
        -limage \
        -lfm \
        ${LIBGL} \
        -lX11 \
        -lm \
        -lfpe \
        ${LIBIL} \
        ${LIBCIL} \
        -lC

LIBRARIES = \
        ${PERFORMER} ${SYSTEM}

#-- select c-compiler options
CFLAGS = -xansi -g -D__STDC__ ${INCLUDE} ${COPT} -Xcpluscomm \
                 -DPF_C_API=1 -DPF_CPLUSPLUS_API=0 \
                 -DIRISGL \
                 -DPF_MAJOR_VERSION=2

#-DIRISGL

#-- base name of program
TARGET = dbase

#-- dummy assignment in case pmake is used
EXT=
LIBOPT=
MAJOR=

#-- object files from which target built {some are in the common directory}
OBJECTS = \
        dbase.o

${TARGET}: ${OBJECTS}
        ${CC} ${CFLAGS} -o $++at++ ${OBJECTS} ${LIBRARIES}

#-- objects are built from either unique or common files
dbase.o: ${UNIQUE}/dbase.c
        ${CC} ${CFLAGS} -c $?


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:16 PDT

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