Пример #1
0
        void display::define_light(const int & light_number, const math::transform & modelview, const math::vector & position,
                                   const color & ambient, const color & diffuse, const color & specular,
                                   const gsgl::real_t & attenuation_constant, const gsgl::real_t & attenuation_linear, const gsgl::real_t & attenuation_quadratic)
        {
            bind();

            glMatrixMode(GL_MODELVIEW);
            glLoadMatrixf(modelview.ptr());

            int gl_light = GL_LIGHT0 + light_number;

            glEnable(gl_light);
            glLightfv(gl_light, GL_AMBIENT, ambient.ptr());
            glLightfv(gl_light, GL_DIFFUSE, diffuse.ptr());
            glLightfv(gl_light, GL_SPECULAR, specular.ptr());
            glLightfv(gl_light, GL_POSITION, position.ptr());

            glLightf(gl_light, GL_CONSTANT_ATTENUATION, attenuation_constant);
            glLightf(gl_light, GL_LINEAR_ATTENUATION, attenuation_linear);
            glLightf(gl_light, GL_QUADRATIC_ATTENUATION, attenuation_quadratic);
        } // display::define_light()
Пример #2
0
        void display::define_ambient_light(const color & ambient)
        {
            bind();

            glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient.ptr());                                CHECK_GL_ERRORS();
        } // display::define_ambient_light()