Help : texturing problem!!!

New Message Reply Date view Thread view Subject view Author view

Ren-Jye Yu (renjye++at++python.tamu.edu)
Thu, 3 Oct 1996 01:06:35 -0700


Hi,
        This is Ren-Jye Yu. I have a question about applying texture. The
follwoing are parts of my code related to texture:

pfVec2 *texcoords;
ushort *listcoord, *listtex, *listcolor;
#######################################################################
texcoords = pfMalloc(sizeof(pfVec2) * 4, pfGetSharedArena());
pfSetVec2(texcoords[0], 0.0f, 0.0f);
pfSetVec2(texcoords[1], 1.0f, 0.0f);
pfSetVec2(texcoords[2], 1.0f, 1.0f);
pfSetVec2(texcoords[3], 0.0f, 1.0f);

tex = pfNewTex(pfGetSharedArena());
tev = pfNewTEnv(pfGetSharedArena());

pfFindFile(texfile, path, R_OK);
if(pfLoadTexFile(tex, path) == NULL)
{
        printf("Unable to open texture file\n");
        fclose(infile);
        pfExit();
        exit(-1);
}

listtex = pfMalloc(sizeof(ushort) * numcoord, pfGetSharedArena());
listtex[0] = 0;
listtex[1] = 1;
listtex[2] = 2;
listtex[3] = 3;
for(i=4;i<numcoord;i++)
        listtex[i] = listtex[i-4];

pfGStateAttr(gstate, PFSTATE_TEXENV, tev);
pfGStateAttr(gstate, PFSTATE_TEXTURE, tex);

pfGSetAttr(gset, PFGS_TEXCOORD2, PFGS_PER_VERTEX, texcoords, listtex);

#######################################################################

I use these code to put texture on three squares. Only the first square show
the texture correctly. The texture of the second square look fuzzy. The third
square only show a dark color. If i increase the "texcoords" and put NULL
instead of "listtex", I will get the correct texture on these three squares. I
checked the value of listtex[i]. There have no mistake. If any of you have same
problem before? Have you seen any mistakes in my code? If you have any solution
or suggestion, please tell me. I need your help. Thanks.

-- 
================================================================================
Ren-Jye Yu                           
Graduate Student                     
Department of Aerospace Engineering  
Texas A&M University                 
College Station 77843                
phone(O) : (409) 845-0729            
phone(H) : (409) 691-8570           
e-mail : renjye++at++python.tamu.edu      
================================================================================
=======================================================================
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:53:42 PDT

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