pfGetShadeModel man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



pfShadeModel(3pf)	      OpenGL Performer 3.2.2 libpr C++ Reference Pages

NAME
     pfShadeModel, pfGetShadeModel - Set and get the shading model

FUNCTION SPECIFICATION
     #include <Performer/pr.h>

     void   pfShadeModel(int model);

     int    pfGetShadeModel(void);

PARAMETERS
     model  is a symbolic constant and is one of:

	    PFSM_FLAT		Use flat shading,

	    PFSM_GOURAUD	Use Gouraud shading.

DESCRIPTION
     pfShadeModel sets the shading model to model.  When flat shading is
     enabled, the last vertex in a geometric primitive defines the color of
     the entire geometric primitive.  When Gouraud shading, vertex colors are
     interpolated across the primitive.

     The following example shows how data equivalent to OpenGL immediate mode
     graphics commands would be interpreted in both PFSM_FLAT and PFSM_GOURAUD
     shade models.

     Example 1:

	  /*
	   * Draw a three-primitive triangle strip in OpenGL
	   */
	  glColor3f(0, 0, 0);	  /****************************************/
	  glBegin(GL__TRIANGLE_STRIP);/*   Actual Rendered Triangle Colors    */
	  glVertex3v(v0);	       /* ------------------------------------ */
	  glVertex3v(v1);	       /* Tri  PFSM_FLAT       PFSM_GOURAUD    */
	  glColor3f(1, 0, 0);	  /* ------------------------------------ */
	  glVertex3v(v2);	       /*  0   red	       black/black/red */
	  glColor3f(0, 1, 0);	  /*					  */
	  glVertex3v(v3);	       /*  1   green	       black/red/green */
	  glColor3f(0, 0, 1);	  /*					  */
	  glVertex3v(v4);	       /*  2   blue	       red/green/blue  */
	  glEnd();	     /****************************************/

     Consequently, strips (triangle PFGS_TRISTRIPS or line PFGS_LINESTRIPS)
     which are composed of different colored primitives must have flat shading
     enabled in order to be rendered properly.	The pfGeoSet primitive types
     of PFGS_FLAT_TRISTRIPS and PFGS_FLAT_LINESTRIPS ensure that flat shading
     will be enabled when the pfGeoSet is drawn.

									Page 1

pfShadeModel(3pf)	      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     Another subtlety of the shading model is related to the current lighting
     model.  If the lighting model is local due to either the pfLightModel (-
     pfLightModel::setLocal) or if any pfLights are local (pfLight::setPos),
     then Gouraud shading must be enabled since lighting effects should be
     different at each vertex.	This means that even if a triangle has a
     constant color and normal, it should still be drawn with Gouraud shading
     so the effects of the local lighting can be seen.	The exception to this
     rule are the flat strips discussed above.

     The shading model state element is identified by the PFSTATE_SHADEMODEL
     token.  Use this token with pfGeoState::setMode to set the shading model
     of a pfGeoState and with pfOverride to override subsequent shading model
     changes.

     Example 2:

	  /* Set up flat shaded pfGeoState. */
	  gstate->setMode(PFSTATE_SHADEMODEL, PFSM_FLAT);

	  /* Attach gstate to gset */
	  gset->setGState(gstate);

	  /* Draw flat shaded gset */
	  gset->draw();

     Example 3:

	  /* Alternative way to draw flat-shaded pfGeoSet */
	  gset->setDrawMode(PFGS_FLATSHADE, PF_ON);
	  gset->draw();

     Example 4:

	  /*
	   * Draw flat-shaded triangle strip pfGeoSet.	PFGS_FLATSHADE
	   * and pfShadeModel are not required.
	   */
	  gset->setPrimType(PFGS_FLAT_TRISTRIPS);
	  gset->draw();

     Example 5:

	  pfShadeModel(PFSM_FLAT);

	  /* Override shading model to PFSM_FLAT */
	  pfOverride(PFSTATE_SHADEMODEL, PF_ON);

									Page 2

pfShadeModel(3pf)	      OpenGL Performer 3.2.2 libpr C++ Reference Pages

     pfShadeModel is a display-listable command.  If a pfDispList has been
     opened by pfDispList::open, pfShadeModel will not have immediate effect
     but will be captured by the pfDispList and will only have effect when
     that pfDispList is later drawn with pfDispList::draw.

     The selection of which shading model a pfGeoSet uses is based upon the
     following decision hierarchy:

	  1.   Use flat shading if pfGeoSet is PFGS_FLAT_TRISTRIPS or
	       PFGS_FLAT_LINESTRIPS or if PFGS_FLATSHADE is enabled through
	       pfGeoSet::setDrawMode.

	  2.   Use the shading model set by the attached pfGeoState, if any
	       (see pfGeoSet::setGState).

	  3.   Use the shading model set by pfShadeModel.

     The default shading model is Gouraud.

     pfGetShadeModel returns the current shading model.

NOTES
     Overriding the shading model to PFSM_FLAT can be a useful debugging aid
     since it reveals the facets of a normally smooth surface.

SEE ALSO
     pfGSetGState, pfGeoSet, pfGeoState, pfLModelLocal, pfLightPos, pfState

									Page 3

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net