Re: texture on node

New Message Reply Date view Thread view Subject view Author view

Garrett Williams (gwilliams++at++etcflorida.com)
Thu, 30 Oct 1997 06:28:46 -0800


Stephane GUILLAUDEUX wrote:
>
> Hi,
> I am trying to apply a global texture on a node that represents a terrain
> surface.
> Surface is described by a set of triangles but I don't find any way to apply
> a texture on the overall surface.
>
> any suggestions?
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

The following is a verry simple demo and there are many other options
that can be included but this should get you started...

/* create texture enviorment */
Tev = pfNewTEnv(NULL);
/* set it to show through back ground color */
pfTEnvMode(Tev,PFTE_MODULATE);
        /*PFTE_DECAL = texture color only and not effected by timeofday */
/* create texture and load */
texture = pfNewTex(NULL);
pfLoadTexFile(texture,"grass.rgb");
/* create state */
State = pfNewGState(NULL);
/* main key to one texture over large area of polies */
/* create texture generation this maps the texture to polies for you */
Tgen = pfNewTGen(NULL);
pfGStateMode(State,PFSTATE_ENTEXTURE, PF_ON); /* enable textures */
pfGStateAttr(State,PFSTATE_TEXTURE,texture); /* set texture to node */
pfGStateAttr(State, PFSTATE_TEXENV,Tev); /* set texture enviorment */
pfGStateMode(State,PFSTATE_ENTEXGEN, PF_ON);/* use TGen for texture
maping */
pfGStateAttr(State,PFSTATE_TEXGEN,Tgen); /* set what TGen to use */
pfTGenPlane(Tgen,PF_S,1.0f,0.0f,0.0f,0.0f); /* repeate in x smaller=more
repeats */
pfTGenPlane(Tgen,PF_T,0.0f,1.0f,0.0f,0.0f); /* repeate in y */
pfTGenMode(Tgen,PF_S,PFTG_OBJECT_LINEAR); /* set repeate in x */
pfTGenMode(Tgen,PF_T,PFTG_OBJECT_LINEAR); /* set repeate in y */

/* put it to your node */
Set = pfNewGSet(NULL);
pfGSetGState(Set,State);

if any one sees any errors in my discription or coding pleas fell free
to let us know..

        from garrett
=======================================================================
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:56:09 PDT

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