line rendering in performer (part 3)

New Message Reply Date view Thread view Subject view Author view

Rudy Darken (darken++at++enews.nrl.navy.mil)
Tue, 7 Jun 94 14:20:49 -0400


Summary:
What I want to do is the following:
1. Create a geode
2. Create a material
3. Set the material colors (diffuse & ambient)
4. Create line geometry
5. Bind the material to the lines
6. Return the geode for inclusion in the performer rendering database

This is the third pass at this problem. There have been two suggestions
made by Michael Jones and Jim Helman which have been incorporated into
the code stub below. The problem persists. When the only object in view
is the grid, it is drawn in blue (as expected). However, when another
object enters the view, the grid loses its color and goes dark. I have
this code written into smallfly so it is the only non-sgi code in the
application. The problem has to be in the way I define the geostate for
the grid.

>It would seem that this should be a common thing to want to do. Obviously,
>I want the material properties of the lines to remain constant throughout
>the process. I don't want them inheriting state from other geometry. In
>fact, since line rendering does not benefit greatly by a lighting model,
>I don't even care if they are lighted, provided other objects in my scene
>still can be. I have tried all suggestions so far with the same results.
>Hasn't anyone rendered lines before? How do you get line geometry to keep
>its state without inheriting?

   void *arena;
   pfGeode *geode;
   pfMaterial *material;
   pfGeoState *geostate;
   pfGeoSet *gset;
   pfVec3 *vertices;
   pfVec4 *colors;
    
   arena = pfGetSharedArena ();
   geode = pfNewGeode ();

   material = pfNewMtl (arena);
   pfMtlColor (material, PFMTL_AMBIENT, 0.0f, 0.0f, 1.0f);
   pfMtlColor (material, PFMTL_DIFFUSE, 0.0f, 0.0f, 1.0f);
   // Michael Jones had me add this line
   pfMtlColorMode (material, PFMTL_FRONT, LMC_AD);

   geostate = pfNewGState (arena);
   pfGStateAttr (geostate, PFSTATE_FRONTMTL, material);
   pfGStateMode (geostate, PFSTATE_CULLFACE, PFCF_OFF);
   // Jim Helman had me add this line
   pfGStateMode (geostate, PFSTATE_ENTEXTURE, PF_OFF);
     
   gset = pfNewGSet (arena);
   pfGSetPrimType (gset, PFGS_LINES);
   pfGSetGState (gset, geostate);
   // Load geometry here
   pfGSetAttr (gset, PFGS_COORD3, PFGS_PER_VERTEX, vertices, NULL);
   pfGSetAttr (gset, PFGS_COLOR4, PFGS_PER_VERTEX, colors, NULL);
   pfAddGSet (geode, gset);
   return geode;

_______________________________________________________________
Rudy Darken <202> 767-6814
darken++at++enews.nrl.navy.mil The U.S. Naval Research Laboratory
darken++at++seas.gwu.edu The George Washington University
_______________________________________________________________


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:50:19 PDT

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