Textures and Lighting

New Message Reply Date view Thread view Subject view Author view

Martin Roth (roth++at++ifi.unizh.ch)
Thu, 5 Jan 1995 19:42:02 +0100


Hi,

it's me again. This time I got a fairly easy question (I hope):

I`ve got a global material, lighting and texture environment:

        /* create an infinitly far away light source */
        lt = pfNewLight(arena);
        pfLightPos(lt, 0.0f, -0.5f, -1.0f, 0.0f);
        pfLightOn(lt);

        /* create global light model */
        lm = pfNewLModel(arena);
        pfLModelAmbient(lm, 0.5f, 0.5f, 0.5f);
        pfApplyLModel(lm);

        /* create global material */
         mt = pfNewMtl(arena);
        pfMtlColor(mt, PFMTL_AMBIENT, 0.3f, 0.3f, 0.3f);
        pfMtlColor(mt, PFMTL_DIFFUSE, 0.8f, 0.8f, 0.8f);
        pfMtlColorMode(mt, PFMTL_FRONT, PFMTL_CMODE_AD);
        pfApplyMtl(mt);

         /* create global texture environment */
        te = pfNewTEnv(arena);
        pfTEnvMode(te, PFTE_DECAL); // opaque texture (3 components)
        pfTEnvComponent(te, PFTE_COMP_OFF); // no component selection
        pfApplyTEnv(te); // set global texture environment

Finally when setting

        pfEnable(PFEN_LIGHTING);
        pfDisable(PFEN_TEXTURE);
        pfOverride(PFSTATE_ENTEXTURE, PF_ON);

I get shaded geometries. The geometries themselves got local geostates defining
nothing but the texture function. This way, when overriding texturing off, my
geometries are shaded. But when I globally enable texturing through

        pfEnable(PFEN_TEXTURE);
        pfOverride(PFSTATE_ENTEXTURE, PF_OFF);

I only get texture but no lighting. Why? Can this behaviour be changed? If yes,
how?

Thanks for all suggestions

Martin

_______________________________________________________________________________
 /| /|) S. H. Martin Roth
/ |/ |\OTH Student in Computer Science

ETHZ, Swiss Federal Institute of Technology Zuerich email: sroth++at++iiic.ethz.ch
UniZh, University of Zuerich email: roth++at++ifi.unizh.ch


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:49 PDT

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