eqemu

view src/material.cc @ 3:f9274bebe55e

adding 3d graphics stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Jul 2014 02:35:19 +0300
parents
children 3d3656360a82
line source
1 #include <GL/glew.h>
2 #include "material.h"
4 Material::Material()
5 : color(1, 1, 1), specular(0, 0, 0)
6 {
7 shininess = 1.0;
8 alpha = 1.0;
9 }
11 void Material::setup() const
12 {
13 float col[] = {color.x, color.y, color.z, alpha};
14 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, col);
16 float spec[] = {specular.x, specular.y, specular.z, 1.0};
17 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
19 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess > 128 ? 128 : shininess);
20 }