Lew Hitchner (hitchner++at++netcom.com)
Wed, 27 Jul 1994 16:40:03 -0700
Here's a summary of what I'm trying to do and how I've tried to implement it.
0. I'm running version 2.0 on IRIX 5.2 with 4 CPU R3000 SkyWriter and
RE graphics on each pipeline
1. I create eight pfGeoStates that are set as the attributes of my
geoSets with pfGSetGState (there are typically several hundreds or
thousands of geoSets).
2. I want to switch rendering modes and coloring modes interactively for
all the geoSets, i.e., all geoSets use the same global mode:
wireframe w/ solid color,
wireframe w/ indexed vertex colors,
Gouraud shaded w/ solid color that's unique to each geoState,
Gouraud shaded w/ indexed vertex colors
(all this was working fine in my pf version 1.0 code)
3. My geoSets are created with indexed colors:
pfGSetAttr(geoSet, PFGS_COLOR4, PFGS_PER_VERTEX, (void *)NULL, colIndices);
4. My geoStates are created as follows:
new->geoStates[i] = pfNewGState(pfGetSharedArena());
material = pfNewMtl(pfGetSharedArena());
pfMtlSide(material, PFMTL_FRONT);
pfMtlColor(material, PFMTL_AMBIENT, r[i], g[i], b[i]);
pfMtlColor(material, PFMTL_DIFFUSE, r[i], g[i], b[i]);
pfMtlColorMode(material, PFMTL_FRONT, PFMTL_CMODE_AD);
pfMtlColorMode(material, PFMTL_BACK, PFMTL_CMODE_COLOR);
pfGStateAttr(new->geoStates[i], PFSTATE_FRONTMTL, material);
pfGStateMode(new->geoStates[i], PFSTATE_ENLIGHTING, PF_ON);
pfGStateMode(new->geoStates[i], PFSTATE_CULLFACE, PFCF_OFF);
I have also experimented by including these two stmts (which appear to
have no effect on my results):
pfGStateMode(new->geoStates[i], PFSTATE_ENCOLORTABLE, PF_ON);
pfGStateAttr(new->geoStates[i], PFSTATE_COLORTABLE,
(void *)new->cMaps->pfColorTab);
5. I enable/disable indexed color mode as follows:
in APP process:
---------------
material = pfGetGStateAttr(patch->geoStates[i], PFSTATE_FRONTMTL);
pfMtlColorMode(material, PFMTL_FRONT,
(enableCtab) ? PFMTL_CMODE_COLOR : PFMTL_CMODE_AD);
pfGStateAttr(patch->geoStates[i], PFSTATE_FRONTMTL, material); /* is this
necessary ??? */
in channel draw callback fn of DRAW process:
--------------------------------------------
if (enableCtab && ! ctabApplied) {
pfEnable(PFEN_COLORTABLE);
pfApplyCtab(chanDrawData->viewAttr->pfColorTab);
pfOverride(PFSTATE_COLORTABLE|PFSTATE_ENCOLORTABLE, PF_ON);
ctabApplied = True;
}
else if ( ! enableCtab && ctabApplied) {
pfOverride(PFSTATE_COLORTABLE|PFSTATE_ENCOLORTABLE, PF_OFF);
pfDisable(PFEN_COLORTABLE);
ctabApplied = False;
}
I've verified with dbx that the pfEnable/pfDisable stmts. are
getting executed when they should be and that my pfColorTable has
valid values.
6. The results I get are that I NEVER see any indexed vertex colors and
I ALWAYS see the colors associated with each geoState, i.e., all
primitives within each geoSet are displayed with the constant color
of its associated geoState: r[i], g[i], b[i].
7. The Performer documentation doesn't appear to be very helpful on
this subject:
a. There isn't even an entry for "color" in the IRIS Performer
Programming Guide Index
b. The IRIS Performer Programming Guide description of Color Tables
in the section on Graphics State in Chapt. 10 (pg 258) talks
about version 1.0 functions that no longer exist in version 2.0.
c. ReleaseNotes1.2 only says the following:
6.3.18 Changed_Color_Table_API pfGSetCtabMode() has been replaced by:
void pfApplyCtab(pfColortable *ctab);
void pfEnable(PFEN_COLORTABLE);
d. I am confused by the examples in the pfColorTables man page.
Example 1 shows how to set up a geoState using pfGStateAttr and
pfGStateMode. Example 2 shows use of pfEnable, pfApplyCtab, and
pfOverride. Are these examples independent? If one uses the method
in ex. 2 must one set up the geoState in a special way? What about
the material defn. and color table mode for the geoState? I'm also
confused about how to use pfOverride, since use in perfly and pickfly
seem to conflict with the use of pfOverride as shown on the
pfColorTable and pfOverride man pages. I.e.,
perfly.c:
if (ViewState->texture) {
pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE, 0);
pfEnable(PFEN_TEXTURE);
} else {
pfDisable(PFEN_TEXTURE);
pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE, 1);
}
pfColorTable man page:
pfEnable(PFEN_COLORTABLE);
pfApplyCtab(ctab);
pfOverride(PFSTATE_COLORTABLE | PFSTATE_ENCOLORTABLE, PF_ON);
Lew Hitchner
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:25 PDT