light help

New Message Reply Date view Thread view Subject view Author view

renee++at++pat.mdc.com
Thu, 3 Feb 94 12:19:45 CST


What am I doing wrong here? I'm running Performer 1.0 on a PI. I modified
the light code from simple.c.

My lights, Sun1 and Sun2, only show up if the fourth argument is 1.0. I thought
that would make them local lights. And the position doesn't seem to matter
one bit. Both lights seem to be coming from the same spot so the colors are
blending together. I've tried normalizing the position vector and it didn't
make any difference. I tried using the exact light code that's in simple.c
and the sun only showed up when I set the fourth argument to 1.0.

Thanks
Renee Strong
renee++at++pat.mdc.com

void *arena;

static void
OpenPipeline (pfPipe *p)
{
pfLight *Sun1, *Sun2;
pfLightModel *lmodel;

    /* negotiate with window-manager */
    foreground();
    prefposition(100,500,100,500);
    winopen("IRIS Performer");

    /* negotiate with GL */
    pfInitGfx(p);

    arena = pfGetSharedArena();

    /* create light sources */
    Sun1 = pfNewLight(arena);
    //pfLightPos(Sun1, -0.979367, 0.202079, -0.001943, 1.0f);
    pfLightPos(Sun1, -151.209320, 31.200001, -0.300000, 1.0f);
    pfLightColor(Sun1, 0.0, 1.0, 0.0);
    pfLightAmbient(Sun1, 0.0, 0.0, 0.0);

    Sun2 = pfNewLight(arena);
    //pfLightPos(Sun2, 0.001904, -0.013963, -0.999901, 1.0f);
    pfLightPos(Sun2, 0.300000, -2.200000, -157.548874, 1.0f);
    pfLightColor(Sun2, 1.0, 0.0, 0.0);
    pfLightAmbient(Sun2, 0.0, 0.0, 0.0);

    /* create a default lighting model */
    lmodel = pfNewLModel(arena);
    pfLModelAmbient(lmodel, 0.2, 0.2, 0.2);
    pfApplyLModel(lmodel);

    pfLightOn(Sun1);
    pfLightOn(Sun2);

    cout << "curently active lights: " << pfGetCurLights(lights) << "\n";

    pfCullFace(PFCF_BACK);

}


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

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