Re: how to make two sides geoset

New Message Reply Date view Thread view Subject view Author view

Marcin Romaszewicz (marcin++at++asmodean.engr.sgi.com)
Tue, 8 Jun 1999 19:08:17 -0700 (PDT)


Hi Yonglin,

You need to enable two sided lighting. In OpenGL, this is accomplished with the
glLightModel* functions. The performer call which maps to this OpenGL call is
pfLightModel::setTwoSide.

Here's what you do:

pfLightModel *lm = new pfLightModel();
lm->setTwoSide(PF_ON);
gstate->setAttr(PFSTATE_LIGHTMODEL, lm);

-- Marcin

>
> Hi, performers,
> I use the code below constructing a geoset of a retangle. But I can
> only make it a single side retangle, this means that I can only see the
> plane when the normals at the four vertices are facing me, as I rotate
> the view, The plane will lose when the normals are against me. So I need
> to make the plane two sides so that I can see the back of the plane. I
> must define the normals at the vertices because I have many this kind of
> polygons, they must be connected smoothly. So any body knows how to do
[5~~> can give me some suggestion.
>
> Thanks.
>
> Rgs. Yonglin
>
> // My code for a rectangle.
>
> Coords = (pfVec3 *) pfMalloc(4*sizeof(pfVec3), pfGetSharedArena());
> Norms = (pfVec3 *) pfMalloc(4*sizeof(pfVec3), pfGetSharedArena());
> Cindex = (ushort *) pfMalloc(4*SIZEOF_USHORT, pfGetSharedArena());
>
> Coords[0].set(-100.0, 0.0, -100.0);
> Coords[1].set( 100.0, 0.0, -100.0);
> Coords[2].set( 100.0, 0.0, 100.0);
> Coords[3].set(-100.0, 0.0, 100.0);
>
> Norms[0].set( 0.0, -1.0, 0.0);
> Norms[1].set( 0.0, -1.0, 0.0);
> Norms[2].set( 0.0, -1.0, 0.0);
> Norms[3].set( 0.0, -1.0, 0.0);
>
> Cindex[0] = 0;
> Cindex[1] = 1;
> Cindex[2] = 2;
> Cindex[3] = 3;
>
> gset = new pfGeoSet;
>
> gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, Coords, Cindex);
> gset->setAttr(PFGS_NORMAL3, PFGS_PER_VERTEX, Norms, Cindex);
> gset->setPrimType(PFGS_QUADS);
> gset->setNumPrims(1);
>
> gstate = new pfGeoState;
> redMtl = new pfMaterial();
> redMtl->setColor(PFMTL_DIFFUSE, 1.0f, 0.9f, 0.6f);
> redMtl->setColorMode(PFMTL_FRONT, PFMTL_CMODE_OFF);
>
> gstate->setMode(PFSTATE_ENLIGHTING, PF_ON);
> gstate->setMode(PFSTATE_TRANSPARENCY, PFTR_ON);
> gstate->setAttr(PFSTATE_FRONTMTL, redMtl);
> gstate->setMode(PFSTATE_CULLFACE, PFCF_OFF);
>
> gset->setGState(gstate);
> geonode->addGSet (gset);
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/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 Tue Jun 08 1999 - 19:08:24 PDT

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