--- /dev/null
+#include "opengl.h"
+#include "material.h"
+
+Material::Material()
+ : diffuse(1.0f, 1.0f, 1.0f)
+{
+ shininess = 0.0f;
+ alpha = 1.0f;
+}
+
+void Material::setup() const
+{
+ float kd[] = {diffuse.x, diffuse.y, diffuse.z, alpha};
+ float ks[] = {specular.x, specular.y, specular.z, 1.0f};
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, kd);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, ks);
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
+}