Colortables and gsets

New Message Reply Date view Thread view Subject view Author view

wrvo (WRVO++at++chevron.com)
Fri, 24 Apr 1998 15:57:35 -0700


I would like to use a colortable when drawing some triangles. I want smooth
shading across all triangles.
I'm having trouble figuring out how the colortable is connected to be
vertex. Does the per vertex value in the attribute array now become a color
index? I've implemented it this way but it doesn't seem to be working. Any
suggestion on why it's not would be helpful?

I have pseudo code as follows on how I think it should work:

float *verts = (float*) pfMalloc(sizeof(float)*ntriangle*9,arena);
pfVec4 *colors = (pfVec4*) pfMalloc(sizeof(pfVec4)*ntriangle*3,arena);
... fill in verts
...set colors to appropriate index. in my case the z value of the triangle
scaled to be between 0 and 255.
gset->setAttr(PFGS_COORD3,PFGS_PER_VERTEX,verts,0);
gset->setAttr(PFGS_COLOR4,PFGS_PER_VERTEX,colors,0);
...
gstate = new(arena) pfGeoState();
pfColortable *ctab = new(arena) pfColortable(256);
...set color values
gstate->setMode(PFSTATE_ENCOLORTABLE,PF_ON);
gstate->setAttr(PFSTATE_COLORTABLE,ctab);
gset->setGState(gstate);
geode->addGSet(gset);
...->addChild(geode);

Am I missing any overrides, of other settings somewhere else? Anyone see
anything else wrong with
the above? Does this need to be applied or something?

Thanks,
Bill Volz

=======================================================================
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:57:18 PDT

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