From: Alexandre Naaman (naaman++at++laplace.engr.sgi.com)
Date: 09/12/2002 10:52:49
> Hey,
>
> Why does the program below prints MTL2 equal to MTL1. Shouldn't this
> materials be considered different?
>
> Thank you for your attention,
>
> Goncalo
>
> #include <Performer/pf.h>
> #include <Performer/pr/pfMaterial.h>
>
> int main( )
> {
> pfInit( );
> pfMultiprocess( PFMP_DEFAULT );
>
> pfConfig( );
>
> pfMaterial* mtl1 = new pfMaterial;
> mtl1->setColor( PFMTL_AMBIENT, 0.0f, 0.0f, 0.0f );
> mtl1->setColor( PFMTL_DIFFUSE, 0.0f, 0.0f, 0.0f );
> mtl1->setColor( PFMTL_SPECULAR, 0.0f, 0.0f, 0.0f );
> mtl1->setShininess( 0.0f );
> mtl1->setAlpha( 0.0f );
>
> pfMaterial* mtl2 = new pfMaterial;
> mtl2->setColor( PFMTL_AMBIENT, 1.0f, 1.0f, 1.0f );
> mtl2->setColor( PFMTL_DIFFUSE, 1.0f, 1.0f, 1.0f );
> mtl2->setColor( PFMTL_SPECULAR, 0.0f, 0.0f, 0.0f );
> mtl2->setShininess( 0.0f );
> mtl2->setAlpha( 0.0f );
>
> if( !mtl2->compare( mtl1 ) )
> pfNotify( PFNFY_NOTICE, PFNFY_PRINT, "MTL1 equal to MTL2" );
> else
> pfNotify( PFNFY_NOTICE, PFNFY_PRINT, "MTL1 different of MTL2" );
>
> pfExit( );
> }
The individual components of the color (ambient, difficuse, emissive &
specular) only get compared when the side is set. This is not strictly
correct but it must remain this way so as to ensure backward
compatibility.
To make this code work just add:
mtl->setSide(PFMTL_FRONT);
mtl2->setSide(PFMTL_FRONT);
A+,
Alex.
This archive was generated by hypermail 2b29 : Thu Sep 12 2002 - 10:52:55 PDT