--- /dev/null
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_COLOR_H_
+#define MSP_GL_COLOR_H_
+
+#include <GL/gl.h>
+
+namespace Msp {
+namespace GL {
+
+struct Color
+{
+ float r, g, b, a;
+
+ Color(): r(1), g(1), b(1), a(1) { }
+ Color(float v): r(v), g(v), b(v), a(1) { }
+ Color(float r_, float g_, float b_): r(r_), g(g_), b(b_), a(1) { }
+ Color(float r_, float g_, float b_, float a_): r(r_), g(g_), b(b_), a(a_) { }
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif
--- /dev/null
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "material.h"
+
+namespace Msp {
+namespace GL {
+
+Material::Material():
+ ambient(0.2),
+ diffuse(0.8),
+ specular(0),
+ emission(0),
+ shininess(0)
+{ }
+
+void Material::set_ambient(const Color &a)
+{
+ ambient=a;
+}
+
+void Material::set_diffuse(const Color &d)
+{
+ diffuse=d;
+}
+
+void Material::set_specular(const Color &s)
+{
+ specular=s;
+}
+
+void Material::set_emission(const Color &e)
+{
+ emission=e;
+}
+
+void Material::set_shininess(float s)
+{
+ shininess=s;
+}
+
+void Material::apply()
+{
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
+}
+
+} // namespace GL
+} // namespace Msp
--- /dev/null
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_MATERIAL_H_
+#define MSP_GL_MATERIAL_H_
+
+#include "color.h"
+
+namespace Msp {
+namespace GL {
+
+class Material
+{
+private:
+ Color ambient;
+ Color diffuse;
+ Color specular;
+ Color emission;
+ float shininess;
+
+public:
+ Material();
+ void set_ambient(const Color &a);
+ void set_diffuse(const Color &d);
+ void set_specular(const Color &s);
+ void set_emission(const Color &e);
+ void set_shininess(float s);
+ void apply();
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
#include "matrix.h"
namespace Msp {