Prof Avery's weblog
the beckoning aperture of dismay


CSU Fullerton Perl Powered Python vi Hacker

Geek News

del.icio.us bookmarks


Wed, May 10, 2006

Is this normal behavior?
Have you noticed that the lighting calculations don't seem to be affecting your windshield the same way they affect the rest of the car?

I wonder which part of the illumination equation isn't being evaluated normally.

/var/spool/courses/csuf/2006/spring/cpsc465 #

Material Colors
Here's a function to set the current drawing color, whether or not lighting is enabled:

    void color(double r, double g, double b)
        float color[4] = { r, g, b, 1.0 };

        if (glIsEnabled(GL_LIGHTING)) {
            glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
        } else {
            glColor3f(r, g, b);
Note that although the color can be set for GL_AMBIENT and GL_DIFFUSE separately, you'll usually want them to be the same.

Alternatively, you could try reading about GL_COLOR_MATERIAL.

/var/spool/courses/csuf/2006/spring/cpsc465 #



February 2018
Sun Mon Tue Wed Thu Fri Sat