$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r51231 - in sandbox-branches/andreo/guigl: boost/guigl boost/guigl/platform/impl libs/guigl/build/vc8ide libs/guigl/example
From: andreytorba_at_[hidden]
Date: 2009-02-12 15:50:52
Author: andreo
Date: 2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
New Revision: 51231
URL: http://svn.boost.org/trac/boost/changeset/51231
Log:
light
Added:
   sandbox-branches/andreo/guigl/boost/guigl/platform/impl/light.hpp   (contents, props changed)
Text files modified: 
   sandbox-branches/andreo/guigl/boost/guigl/gl.hpp                     |     1 +                                       
   sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/build.vcproj   |     4 ++++                                    
   sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj |     3 ++-                                     
   sandbox-branches/andreo/guigl/libs/guigl/example/two_spheres.cpp     |    19 +++++++++++++++++--                     
   sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp  |     5 ++---                                   
   5 files changed, 26 insertions(+), 6 deletions(-)
Modified: sandbox-branches/andreo/guigl/boost/guigl/gl.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/boost/guigl/gl.hpp	(original)
+++ sandbox-branches/andreo/guigl/boost/guigl/gl.hpp	2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
@@ -137,6 +137,7 @@
 #include "platform/impl/color.hpp"
 #include "platform/impl/rect.hpp"
 #include "platform/impl/transform.hpp"
+#include "platform/impl/light.hpp"
 #include "platform/impl/glut.hpp"
 
 #endif BOOST__GUIGL__GL_HPP
Added: sandbox-branches/andreo/guigl/boost/guigl/platform/impl/light.hpp
==============================================================================
--- (empty file)
+++ sandbox-branches/andreo/guigl/boost/guigl/platform/impl/light.hpp	2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
@@ -0,0 +1,220 @@
+#ifndef BOOST__GUIGL__GL__LIGHT_HPP
+#define BOOST__GUIGL__GL__LIGHT_HPP
+
+namespace boost{ namespace guigl { namespace gl {
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    inline void light(GLenum i_light, GLenum pname, T param);
+
+    template<>
+    inline void light<GLfloat>(GLenum i_light, GLenum pname, GLfloat param)
+    {
+        glLightf(i_light, pname, param);
+    }
+
+    template<>
+    inline void light<GLint>(GLenum i_light, GLenum pname, GLint param)
+    {
+        glLighti(i_light, pname, param);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    inline void light(GLenum i_light, GLenum pname, T const* param);
+
+    template<>
+    inline void light<GLfloat>(GLenum i_light, GLenum pname, GLfloat const* params)
+    {
+        glLightfv(i_light, pname, params);
+    }
+
+    template<>
+    inline void light<GLint>(GLenum i_light, GLenum pname, GLint const* params)
+    {
+        glLightiv(i_light, pname, params);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    inline void light_position(GLenum i_light, T x, T y, T z, T w);
+
+    template<>
+    inline void light_position<GLfloat>(
+        GLenum i_light,
+        GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+    {
+        GLfloat const position[] = {x, y, z, w};
+        light(i_light, GL_POSITION, position);
+    }
+
+    template<>
+    inline void light_position<GLint>(
+        GLenum i_light,
+        GLint x, GLint y, GLint z, GLint w)
+    {
+        GLint const position[] = {x, y, z, w};
+        light(i_light, GL_POSITION, position);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_constant_ambient(GLenum i_light, T value);
+
+    template<>
+    inline void light_constant_ambient<GLfloat>(GLenum i_light, GLfloat value)
+    {
+        light(i_light, GL_CONSTANT_ATTENUATION, value);
+    }
+
+    template<>
+    inline void light_constant_ambient<GLint>(GLenum i_light, GLint value)
+    {
+        light(i_light, GL_CONSTANT_ATTENUATION, value);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_linear_attenuation(GLenum i_light, T value);
+
+    template<>
+    inline void light_linear_attenuation<GLfloat>(GLenum i_light, GLfloat value)
+    {
+        light(i_light, GL_LINEAR_ATTENUATION, value);
+    }
+
+    template<>
+    inline void light_linear_attenuation<GLint>(GLenum i_light, GLint value)
+    {
+        light(i_light, GL_LINEAR_ATTENUATION, value);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_quadratic_attenuation(GLenum i_light, T value);
+
+    template<>
+    inline void light_quadratic_attenuation<GLfloat>(GLenum i_light, GLfloat value)
+    {
+        light(i_light, GL_QUADRATIC_ATTENUATION, value);
+    }
+
+    template<>
+    inline void light_quadratic_attenuation<GLint>(GLenum i_light, GLint value)
+    {
+        light(i_light, GL_QUADRATIC_ATTENUATION, value);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_spot_cutoff(GLenum i_light, T value);
+
+    template<>
+    inline void light_spot_cutoff<GLfloat>(GLenum i_light, GLfloat value)
+    {
+        light(i_light, GL_SPOT_CUTOFF, value);
+    }
+
+    template<>
+    inline void light_spot_cutoff<GLint>(GLenum i_light, GLint value)
+    {
+        light(i_light, GL_SPOT_CUTOFF, value);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_spot_exponent(GLenum i_light, T value);
+
+    template<>
+    inline void light_spot_exponent<GLfloat>(GLenum i_light, GLfloat value)
+    {
+        light(i_light, GL_SPOT_EXPONENT, value);
+    }
+
+    template<>
+    inline void light_spot_exponent<GLint>(GLenum i_light, GLint value)
+    {
+        light(i_light, GL_SPOT_EXPONENT, value);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_spot_direction(GLenum i_light, T x, T y, T z);
+
+    template<>
+    inline void light_spot_direction<GLfloat>(GLenum i_light, GLfloat x, GLfloat y, GLfloat z)
+    {
+        GLfloat const direction[] = {x, y, z};
+        light(i_light, GL_SPOT_DIRECTION, direction);
+    }
+
+    template<>
+    inline void light_spot_direction<GLint>(GLenum i_light, GLint x, GLint y, GLint z)
+    {
+        GLint const direction[] = {x, y, z};
+        light(i_light, GL_SPOT_DIRECTION, direction);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_specular(GLenum i_light, T r, T g, T b, T a);
+
+    template<>
+    inline void light_specular<GLfloat>(GLenum i_light,
+        GLfloat r, GLfloat g, GLfloat b, GLfloat a)
+    {
+        GLfloat const specular_color[] = {r, g, b, a};
+        light(i_light, GL_SPECULAR, specular_color);
+    }
+
+    template<>
+    inline void light_specular<GLint>(GLenum i_light,
+        GLint r, GLint g, GLint b, GLint a)
+    {
+        GLint const specular_color[] = {r, g, b, a};
+        light(i_light, GL_SPECULAR, specular_color);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_diffuse(GLenum i_light, T r, T g, T b, T a);
+
+    template<>
+    inline void light_diffuse<GLfloat>(GLenum i_light,
+        GLfloat r, GLfloat g, GLfloat b, GLfloat a)
+    {
+        GLfloat const diffuse_color[] = {r, g, b, a};
+        light(i_light, GL_DIFFUSE, diffuse_color);
+    }
+
+    template<>
+    inline void light_diffuse<GLint>(GLenum i_light,
+        GLint r, GLint g, GLint b, GLint a)
+    {
+        GLint const diffuse_color[] = {r, g, b, a};
+        light(i_light, GL_DIFFUSE, diffuse_color);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    template<class T>
+    void light_ambient(GLenum i_light, T r, T g, T b, T a);
+
+    template<>
+    inline void light_ambient<GLfloat>(GLenum i_light,
+        GLfloat r, GLfloat g, GLfloat b, GLfloat a)
+    {
+        GLfloat const ambient_color[] = {r, g, b, a};
+        light(i_light, GL_AMBIENT, ambient_color);
+    }
+
+    template<>
+    inline void light_ambient<GLint>(GLenum i_light,
+        GLint r, GLint g, GLint b, GLint a)
+    {
+        GLint const ambient_color[] = {r, g, b, a};
+        light(i_light, GL_AMBIENT, ambient_color);
+    }
+
+}}}
+
+#endif BOOST__GUIGL__GL__LIGHT_HPP
Modified: sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/build.vcproj
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/build.vcproj	(original)
+++ sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/build.vcproj	2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
@@ -131,6 +131,10 @@
 						>
                                         </File>
                                         <File
+						RelativePath="..\..\..\..\boost\guigl\platform\impl\light.hpp"
+						>
+					</File>
+					<File
                                                 RelativePath="..\..\..\..\boost\guigl\platform\impl\rect.hpp"
 						>
                                         </File>
Modified: sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj	(original)
+++ sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj	2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
         ProjectType="Visual C++"
-	Version="8.00"
+	Version="8,00"
         Name="example"
         ProjectGUID="{9E866DB0-47D4-4A21-BFBD-2877DE504697}"
+	RootNamespace="example"
 	>
         <Platforms>
                 <Platform
Modified: sandbox-branches/andreo/guigl/libs/guigl/example/two_spheres.cpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/two_spheres.cpp	(original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/two_spheres.cpp	2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
@@ -22,12 +22,27 @@
 void two_spheres::draw_prologue()
 {
     using namespace boost::guigl::gl;
-
     base_type::draw_prologue();
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
 
-    wire_sphere(20, 20, 20);
+    //glEnable(GL_DEPTH_TEST);
+    //glEnable(GL_COLOR_MATERIAL);
+    glEnable(GL_LIGHTING);
+    glEnable(GL_LIGHT1);
+
+    light_ambient(GL_LIGHT1, 0.6f, 0.6f, 0.6f, 1.0f);
+    light_diffuse(GL_LIGHT1, 1.0f, 1.0f, 1.0f, 1.0f);
+    light_specular(GL_LIGHT1, 1.0f, 1.0f, 1.0f, 1.0f);
+    light_position(GL_LIGHT1, 100, 40, 40, 1);
+    light_spot_direction(GL_LIGHT1, -100, -40, -40);
+    light_constant_ambient(GL_LIGHT1, 1.5f);
+    light_linear_attenuation(GL_LIGHT1, 0.5f);
+    light_quadratic_attenuation(GL_LIGHT1, 0.2f);
+    light_spot_cutoff(GL_LIGHT1, 180.0f);
+    light_spot_exponent(GL_LIGHT1, 2.0f);
+
+    solid_sphere(50, 10, 10);
     glLoadIdentity();
     translate(50.f, 50.f, 50.f);
     wire_sphere(20, 20, 20);
Modified: sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp	(original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/window_example.cpp	2009-02-12 15:50:51 EST (Thu, 12 Feb 2009)
@@ -23,12 +23,11 @@
 
 #include <iostream>
 
-
 using namespace boost::guigl;
 
-color_type make_grey(float value)
+color_type make_grey(double value)
 {
-    return color_type(value, value, value);
+    return color_type((float)value, (float)value, (float)value);
 }
 
 void idle()