Lighting a single object

How can I go about this? I’ve done lots of reading, and I just can’t find anything regarding it… I’m sure it’s just something simple, but it’s a surprisingly hard subject to search for.

Thanks in advance!

EDIT: I guess it’s important to say I’m using PyOpenGL, though it shouldn’t make a large difference.

I’ve also been having some trouble regarding multiple lights, eg:


    glEnable(GL_LIGHT0)
    glLight(GL_LIGHT0, GL_POSITION,  (0, 1, 1, 0))
    glEnable(GL_LIGHT1)
    glLight(GL_LIGHT1, GL_POSITION,  (0, 1, 1, 0))

    glLightfv(GL_LIGHT0, GL_POSITION,  (0, 1.5, 1, 0))
    glLightfv(GL_LIGHT1, GL_POSITION,  (0, 1.5, 1, 0))

As you can see, the code is EXACTLY the same, but with only GL_LIGHT1 and the GL_LIGHT0 blocks commented out, no light appears. Is it necessary to enable 0 before 1 is accessible?

Just enable lighting before drawing your object, and disable it, just after, that’s all and enough :slight_smile:

So something like this:


drawUnlitObjets();
glEnable (GL_LIGHTING);
glenable (GL_LIGHT{X});
drawLitObjects();
glDisable (GL_LIGHT{X});
glDisable (GL_LIGHTING);
...

I had actually tried that, so I suppose that links into my second problem… any help?

Is it supposed to be a directional or point light?

That was actually just me testing; in the end, I wanted one object to just be fully lit, which I couldn’t find any simple method of doing, except to actually use a light, though I suppose I could also be wrong there.

EDIT: Nevermind… I can’t believe I never thought of it, but just disabling lighting while drawing the object does it… hahaha whoops