Re: How can change a texture's image correctly?

New Message Reply Date view Thread view Subject view Author view

From: zhou tian (zhout++at++zjuem.zju.edu.cn)
Date: 03/07/2000 06:03:11


Hi,
I use functions to change texture's image like follows:

         tmpNode = pfGetChild(Shared->MainPageNode, 0);
         tmpset = pfGetGSet(tmpNode, 0);
         if ( tmpset == NULL )
         {
          printf(" Havent get set of Mainpage \n");
          pfFrame();
          return ;
         }
         tmpGState = pfGetGSetGState(tmpset);
         if ( tmpGState == NULL)
         {
          printf(" Havent get gstate of Mainpage \n");
          pfFrame();
          return ;
         }

         tex = pfNewTex(pfGetSharedArena());
         pfLoadTexFile( tex, Shared->AutoNode[Shared->AutoDemoNo].ImagePath);
         pfGetTexImage(tex, &image, &comp, &ns, &nt, &nr);
         pfFreeTexImage( Shared->MainPageTex );
         pfTexImage( Shared->MainPageTex,image,comp,ns,nt,nr );
         pfFrame();
         pfGStateMode( tmpGState, PFSTATE_ENTEXTURE, 1 );
         pfGStateMode( tmpGState, PFSTATE_TRANSPARENCY, PFTR_FAST );
         pfGStateVal( tmpGState, PFSTATE_ALPHAREF, 0.5 );

         pfFreeTexImage(tex);
         pfDelete(tex);
    
I think this mothod is not good, but not know how to do better. And I also change
texture's image like this:
         pfGetTexImage(Shared->MainPageTex,&Shared->resultimage,&comp,&ns,&nt,&nr);
         for(j=0,i=0;j<ns*nt*3;j+=3)
        {
                        Shared->resultimage[j]=Shared->resultimage_now[i];
                        Shared->resultimage[j+1]=Shared->resultimage_now[i+1];
                        Shared->resultimage[j+2]=Shared->resultimage_now[i+2];
                        i+=3;
         }
         pfTexImage( Shared->MainPageTex,Shared->resultimage,comp,ns,nt,nr );
When I run the program, I am sure mothods above make mistakes. What can I
do for this?
        Thank you very much!
        
                                ZhouTian

>
> Hi,
>
> I've looked through the pfTexture code a bit, and it doesn't look like we
> allocate any memory in pfTexture unless you're loading a file. Are you
> sure that it's the performer code which is allocating this memory?
>
> In your explanation, its not clear whether you run out of memory when you
> call pfTexImage of sometime later. Which function triggers the printing of
> this error?
>
> -- Marcin
>
>
> On Mon, 6 Mar 2000, zhou tian wrote:
>


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 06:00:03 PST

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