3d textures in performer - try two...

New Message Reply Date view Thread view Subject view Author view

ken sartor (sartor++at++bur.visidyne.com)
Sat, 19 Apr 1997 11:38:11 -0500


Hi -

I have been trying to get 3d texuring to work in the Performer
environment. However, i cannot get the PF_R coordinate to
do anything. Below is a code fragment that works when i use
PF_S and PF_T (it just puts a checkerboard texture on the geometry).
BUT when i try to set maxz (the coordinate that is used by PF_R)
to some number (say 4) no texturing takes place...

Am i doing something wrong? Or does Performer 2.0.2 not allow
me to use the PF_R coordinate? Is using 3d textures possible in
Performer?

BTW - i am running IRIX 6.2 on a 1 RM4 RE2 w/ Performer 2.0.2.

Thanks for any help you can provide!

ken

Code fragment for 3d texturing...
-------------------------------------------------------------------------
// texture experiment...
    int maxx=4, maxy=4, maxz=1, kjs;
    // Make a checkerboard texture.
    for (int iz=0; iz<maxz; iz++) {
    for (int iy=0; iy<maxy; iy++) {
    for (int ix=0; ix<maxx; ix++) {
          kjs = iz*maxx*maxy + iy*maxx + ix;
          // printf(" kjs = %d ix = %d iy = %d iz = %d \n", kjs, ix, iy, iz);
          // rbga colors are loaded here.
          if ( iz%2 == 0)
          {
            if ( iy%2 == 0)
            {
              if ( kjs%2 == 0 )
                tex_image[kjs] = 0x0000ffff;
              else
                tex_image[kjs] = 0x000000ff;
            }
            else
            {
              if ( kjs%2 == 0 )
                tex_image[kjs] = 0x000000ff;
              else
                tex_image[kjs] = 0x0000ffff;
            }
          }
          else
          {
            if ( iy%2 == 0)
            {
              if ( kjs%2 != 0 )
                tex_image[kjs] = 0x0000ffff;
              else
                tex_image[kjs] = 0x000000ff;
            }
            else
            {
              if ( kjs%2 != 0 )
                tex_image[kjs] = 0x000000ff;
              else
                tex_image[kjs] = 0x0000ffff;
            }
          }
    }
    }
    }

        // Set up the texturing stuff...
        pfGStateMode(gstate2, PFSTATE_ENTEXTURE, PF_ON);
        pfGStateAttr(gstate2, PFSTATE_TEXTURE, tex );
        pfGStateAttr(gstate2, PFSTATE_TEXENV, tev);
        pfGStateMode(gstate2, PFSTATE_ENTEXGEN, PF_ON);
        pfGStateAttr(gstate2, PFSTATE_TEXGEN, tgen );

        pfTEnvMode(tev, PFTE_DECAL);

        pfTGenPlane(tgen, PF_S, 1.0e-2, 0.0, 0.0, 0.0);
        pfTGenPlane(tgen, PF_T, 0.0, 0.0, 1.0e-2, 0.0);
        pfTGenPlane(tgen, PF_R, 0.0, 1.0e-2, 0.0, 0.0);
        pfTGenMode(tgen, PF_S, PFTG_OBJECT_LINEAR);
        pfTGenMode(tgen, PF_T, PFTG_OBJECT_LINEAR);
        pfTGenMode(tgen, PF_R, PFTG_OBJECT_LINEAR);
        pfTexRepeat(tex, PFTEX_WRAP_S, PFTEX_REPEAT);
        pfTexRepeat(tex, PFTEX_WRAP_T, PFTEX_REPEAT);
        pfTexRepeat(tex, PFTEX_WRAP_R, PFTEX_REPEAT);
        pfTexImage(tex, tex_image, 4, maxx, maxy, maxz);

// End texture experiment...
-------------------------------------------------------------------------

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com

=======================================================================
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:06 PDT

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