Movie Textures

New Message Reply Date view Thread view Subject view Author view

B. Alex Kekesi (akekesi++at++vlasov.gsfc.nasa.gov)
Fri, 25 Jul 1997 17:46:59 -0400


Hi Performers,

I have a problem, and I was wondering if someone out there in Performer Land
might be able to help me. I have a modified version of perfly I'm trying to
run on a Onyx2 iR (64 MB Texture Mem). What I'm trying to do is place "movie
textures" on an arbitrarily loaded object. For simplicities sake, the single
loaded object will only have one texture already specifed on it when loaded. I
attempt to strip off the currently loaded texture and replace it with a
sequence of textures that form a movie. My coding is far from complete, but
I've already hit a snag that I can't get past, and I'm hoping someone out there
can help.

I believe that my texture list is being created/loaded properly, but when I get
to the point where I am to apply the first frame of this new texture list, the
program bombs. Here's what I get:

monet 47% perfly -W640,480 -Tscriptfile2.txt
PF Info: All 4 processors available on this machine.
Loading Script File...
Loading tex flip_simpearthgrid.0000.rgb as frame 0
components: 3 xsize: 1024 ysize: 512 zsize: 1
Loading tex flip_surf_image.0000.rgb as frame 1
components: 3 xsize: 1024 ysize: 512 zsize: 1
Movie List Length: 2
PF Fatal/SysErr: _pfDirtCheck: pfRealloc of 0 bytes returned
NULL.

I'm attaching the part of my source code where the problem seems to be
occurring. I'm also attaching a hardware inventory for those of you who like
to know what kind of system I'm working with.

Any help on this will be greatly appreciated! I will even take recommendations
on where else I might be able to look for more information on movie/video
texturing. -Or if anyone out there has already done something like this,
PLEASE let me know. I'm aware of sample codes movietex and texlist, but
haven't been able to find anything closer to what I'm trying to do.

Thanks in Advance!!

Alex Kekesi email: B.A.Kekesi.1++at++gsfc.nasa.gov
Hughes STX Corp.
NASA Goddard Space Flight Center
Code 935, Bldg. 28, Rm. S121
Greenbelt, MD 20771

HARDWARE:

monet 2% hinv
FPU: MIPS R10010 Floating Point Chip Revision: 0.0
CPU: MIPS R10000 Processor Chip Revision: 2.6
4 195 MHZ IP27 Processors
Main memory size: 1024 Mbytes
Instruction cache size: 32 Kbytes
Data cache size: 32 Kbytes
Secondary unified instruction/data cache size: 4 Mbytes
Integral SCSI controller 0: Version QL1040B
  Disk drive: unit 1 on SCSI controller 0
  CDROM: unit 6 on SCSI controller 0
Integral SCSI controller 1: Version QL1040B
IOC3 serial port: tty1
IOC3 serial port: tty2
IOC3 serial port: tty3
IOC3 serial port: tty4
IOC3 parallel port: plp1
Graphics board: InfiniteReality2
Integral Fast Ethernet: ef0, version 1
Iris Audio Processor: version RAD revision 7.0, number 1
IOC3 external interrupts: 1

SOURCE:

/*============= GLOBALS =============*/
struct _FrameInfo {
   char prefix[NORMSTR];
   int start, end;
   char postfix[MINSTR];
} FrameInfo;

struct _EventInfo {
   int time, event;
   struct _FrameInfo *frame;
   struct _EventInfo *next;
} EventInfo;

struct _EventInfo *EventHead, *EventTail;

/* Load texture sequence */
void
loadMovieFiles()
{
 int count=0, framecnt=0, comp, xsize, ysize, zsize;
 struct _EventInfo *currevent=NULL;
 char texname[NORMSTR];
 unsigned int *image;

 /* NOTE: ViewState->tex is of type (pfTexture *) and
          ViewState->texList is of type (pfList *) */

 currevent = EventHead;
 pfDelete(ViewState->texList); /* Annihilate anything that might already be */
 ViewState->tex = pfNewTex(NULL);
 pfTexList(ViewState->tex, pfNewList(sizeof(pfTexture*), 16,
pfGetArena(ViewState->tex)));
 ViewState->texList = pfGetTexList(ViewState->tex);
 pfTexLoadMode(ViewState->tex, PFTEX_LOAD_LIST, PFTEX_LIST_AUTO_SUBLOAD);

 while(currevent!=NULL)
    {

     if(((currevent->event)==FREEZEMOVIE) || ((currevent->event)==PLAYMOVIE))
        {

         for(count=currevent->frame->start; count<=currevent->frame->end;
count++)
            {
             strcpy(texname, BLANK);

             /* Rebuild the texture name */
             if(count<10)
                sprintf(texname, "%s.000%d.%s", currevent->frame->prefix,
count,
                                             currevent->frame->postfix);
             else if(count<100)
                sprintf(texname, "%s.00%d.%s", currevent->frame->prefix, count,
                                             currevent->frame->postfix);
             else if(count<1000)
                sprintf(texname, "%s.0%d.%s", currevent->frame->prefix, count,
                                             currevent->frame->postfix);
             else
                sprintf(texname, "%s.%d.%s", currevent->frame->prefix, count,
                                             currevent->frame->postfix);

             fprintf(stderr, "Loading tex %s as frame %d\n", texname,
framecnt++);

             ViewState->tex = pfNewTex(NULL);
             pfLoadTexFile(ViewState->tex, texname);

             pfGetTexImage(ViewState->tex, &image, &comp, &xsize, &ysize,
&zsize);
             fprintf(stderr, "components: %d xsize: %d ysize: %d zsize:
%d\n",
                     comp, xsize, ysize, zsize);

             pfTexFormat(ViewState->tex, PFTEX_FAST_DEFINE, 1);
             pfTexFilter(ViewState->tex, PFTEX_MINFILTER, PFTEX_BILINEAR);
             pfAdd(ViewState->texList, ViewState->tex);
            }

        }

     currevent = currevent->next;
    }

fprintf(stderr, "Movie List Length: %d\n", pfGetNum(ViewState->texList));
pfEnable(PFEN_TEXTURE);

/********************************************************************/
/* I believe the below 2 lines are where the problem is occurring! */
/********************************************************************/
pfApplyTex(ViewState->tex);
pfApplyTEnv(pfNewTEnv(NULL));
}

/* Initialize the visual database */
void
InitScene(void)
{
    int loaded = 0;
    pfScene *scene = NULL;
    pfTexEnv *tenv = NULL;
    double startTime = 0.0f;
    double elapsedTime = 0.0f;

    /* Read in any databases specified on cmd line */
    ViewState->scene = scene = pfNewScene();

    startTime = pfGetTime();

    /* Read in script file specified on command line */
    if(ViewState->ScriptFile!=NULL)
       {
        loadScriptFile(); /* Load user inputted script file */
        loadMovieFiles(); /* Load textures listed in script file */
       }

    /* Get/Create objects for viewing */
    loaded = initSceneGraph(scene);

    /* Set up scene graph for collisions */
    if (loaded)
       pfuCollideSetup(scene, PFUCOLLIDE_STATIC, 0xffffffff);

    /* Initialize EarthSky, fog, and sun model */
    initEnvironment();

    elapsedTime = pfGetTime() - startTime;

    if (loaded)
    {
        pfNotify(PFNFY_INFO, PFNFY_PRINT, "Total scene-graph statistics");
        pfdPrintSceneGraphStats((pfNode *)scene, elapsedTime);
    }
    else
    {
            pfSphere bsphere;

        pfNotify(PFNFY_INFO, PFNFY_PRINT, "No Databases loaded");
        pfNotify(PFNFY_INFO, PFNFY_MORE, NULL);

        /* Set a default bounding sphere */
        pfSetVec3(bsphere.center, 0.0f, 0.0f, 0.0f);
        bsphere.radius = BOUND;
        pfNodeBSphere(scene, &bsphere, PFBOUND_DYNAMIC);
    }

    /* Write out nodes in scene (for debugging) */
    if (WriteFile)
    {
        if (!strstr(WriteFile, ".out") && pfdInitConverter(WriteFile))
        {
            /* it's a valid extension, go for it */
            if (!pfdStoreFile((pfNode *)scene, WriteFile))
                pfNotify(PFNFY_WARN, PFNFY_RESOURCE,
                         "No store function available for %s\n", WriteFile);
        }
        else
        {
            /* write the file as ASCII */
            FILE *fp;
            if (fp = fopen(WriteFile, "w"))
            {
                pfPrint(scene, PFTRAV_SELF|PFTRAV_DESCEND, PFPRINT_VB_OFF, fp);
                fclose(fp);
            }
            else
                pfNotify(PFNFY_WARN, PFNFY_RESOURCE,
                         "Could not open scene.out for debug printing.");
        }
    }

    /* Set initial view position and angles */
    initView(scene);
}
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


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:55:39 PDT

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