Help texturing

New Message Reply Date view Thread view Subject view Author view

David Ng (davidng++at++netcom.com)
Fri, 14 Apr 1995 09:30:33 -0700 (PDT)


Hi,

Appreciate any help I can get. I'm new to Performer. I'm interested
in putting a tree texture on a billboard and just having the tree
texture while the background blends in with the surroundings.

My understanding is to use alpha blending and set alpha for the background.
While testing with texture.c (an SGI sample texture program) and alpha
blending, I can get just the tree and the blending background on an
Indigo Extreme but it does work on an Onyx (with hardware texture map).

Does anyone have any sample code I can look at ?

Thanks

Dave

/*
 * texture.c: simple Performer program to demonstrate textured poly's.
 *
 * $Revision: 1.2 $ $Date: 1994/11/25 21:15:07 $
 *
 */

    long numGSets;
    long numPrims;
    long primType;
    long* primLengths = NULL;
    pfGeoState* gstate = NULL;
    pfGeoSet* gset = NULL;
    pfTexture *tex;
        pfTexEnv *tev;
    pfVec2 *newTexCoords = NULL;

        gset = pfGetGSet (obj->graphics, i);
        primType = pfGetGSetPrimType (gset);
        numPrims = pfGetGSetNumPrims (gset);
        gstate = pfGetGSetGState (gset);
        pfGStateMode (gstate, PFSTATE_ENTEXTURE, PF_ON);
        tev = pfNewTEnv (_sys->arena);
          pfTEnvMode(tev, PFTE_ALPHA);
        pfGStateAttr (gstate, PFSTATE_TEXENV, tev);
        pfGStateAttr (gstate, PFSTATE_TEXTURE, tex);
        pfGetGSetAttrLists (gset, PFGS_COORD3, (void**) &plist, &pilist);

        .....

        newTexCoords = (pfVec2 *)pfMalloc((uint)(sizeof(pfVec2) * numPrims * 4),arena);

        .....

    pfGSetAttr(gset, PFGS_TEXCOORD2,PFGS_PER_VERTEX, newTexCoords, pilist);


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:51:17 PDT

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