Re: [info-performer] Changing texture coordinates

New Message Reply Date view Thread view Subject view Author view

From: Keith Parkins (kparkins++at++cs.rochester.edu)
Date: 10/28/2002 14:56:39


I ended up just fluxing the texture coordinates to do this, but I have a
weird effect now. These are just blocks made with pfdMakeCube (or whatever
the call is), and the textures change as well as the heights and width. I
am working with legacy code, and the width and height are changed by using
pfDCSScale. With the fluxed texture coordinates, the textures change okay,
but the width and height seem to be stuck in an earlier state. Is there a
way around this without fluxing the whole geoset? If I call
pfGetFluxWritableData and pfFluxWriteComplete before and after the dcs
scaling, will that work even if I don't actually do anything to the Flux?
My new code for changing textures looks like this:

   for (i = 0; i < NUM_CYLINDERS; i++) {
      texCoords = (pfVec2 *)pfGetFluxWritableData(fluxed_tex[i]);

      if (hapticsVS->cylinderTex[i] == TEX_THIN) {
         copyCoords(texCoords, texcordsthin);
      } else {
         copyCoords(texCoords, texcordsfat);
      }
      pfGSetAttr(phantomVS->objPtrs[i].gSetPtr, PFGS_TEXCOORD2,
            PFGS_PER_VERTEX, texCoords, NULL);
      pfFluxWriteComplete(fluxed_tex[i]);
   }

Thanks,
Keith

On Thu, 24 Oct 2002, Marcin Romaszewicz wrote:

>
> pfGeoSets are not multibuffered objects, meaning that changes like this
> will not happen in a frame synchronous manner. You will basically get
> unpredictable behavior. What you need to do is use "fluxed" texture
> coordinates or a fluxed pfGeoSet. Take a look at the pfGeoSet man page and
> read about fluxed attributes; this is what you want to use.
>
> -- Marcin
>
> On Thu, 24 Oct 2002, Keith Parkins wrote:
>
> > Hi,
> >
> > I am trying to change the repeat rate of textures on an object on the fly.
> > Right now, I set two pfVec2*, (texcordsfat, texcordsthin) and then try to
> > change the associated objects PFGS_TEXCOORD2 geoset attribute:
> >
> >
> > for (i = 0; i < NUM_BLOCKS; i++) {
> >
> > if (hapticsVS->cylinderTex[i] == TEX_THIN) {
> > pfGSetAttr(phantomVS->objPtrs[i].gSetPtr, PFGS_TEXCOORD2,
> > PFGS_PER_VERTEX, texcordsthin, NULL);
> > } else {
> > pfGSetAttr(phantomVS->objPtrs[i].gSetPtr, PFGS_TEXCOORD2,
> > PFGS_PER_VERTEX, texcordsfat, NULL);
> > }
> > }
> >
> > This doesn't work, but I'm not sure why. Is there a way to do this? These
> > blocks change from thick to thin patterns periodically, but right now they
> > just stay how they were initially set. I have verified that these
> > statements are being reached, and the pfVec2 arrays are malloced from the
> > shared arena.
> >
> > Thanks,
> > Keith
> >
> > Keith Parkins U of R Computer Science
> > kparkins++at++cs.rochester.edu Computer Science Building, Room 606
> > (585) 275-1118
> >
> > -----------------------------------------------------------------------
> > List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> > Open Development Project: http://oss.sgi.com/projects/performer/
> > Submissions: info-performer++at++sgi.com
> > Admin. requests: info-performer-request++at++sgi.com
> > -----------------------------------------------------------------------
> >
>
>

Keith Parkins U of R Computer Science
kparkins++at++cs.rochester.edu Computer Science Building, Room 606
(585) 275-1118


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Oct 28 2002 - 14:56:50 PST

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