comparison gldragon.cpp @ 49:2e2c3fe311da

Just glEnable(GL_COLOR_MATERIAL) globally.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 06 Dec 2019 01:12:46 +0200
parents 0ae1ff609626
children d4232c89145f
comparison
equal deleted inserted replaced
48:0ae1ff609626 49:2e2c3fe311da
214 glEnable(GL_DEPTH_TEST); 214 glEnable(GL_DEPTH_TEST);
215 215
216 // Enable normal rescaling 216 // Enable normal rescaling
217 glEnable(GL_RESCALE_NORMAL); 217 glEnable(GL_RESCALE_NORMAL);
218 218
219 glEnable(GL_COLOR_MATERIAL);
220
219 // Setup depth buffer 221 // Setup depth buffer
220 glClearDepth(1.0f); 222 glClearDepth(1.0f);
221 223
222 // Set the depth buffer function 224 // Set the depth buffer function
223 glDepthFunc(GL_LEQUAL); 225 glDepthFunc(GL_LEQUAL);
243 glUseProgram(model.id_prog); 245 glUseProgram(model.id_prog);
244 glUniform1i(glGetUniformLocation(model.id_prog, "nlights"), scene.lights.size()); 246 glUniform1i(glGetUniformLocation(model.id_prog, "nlights"), scene.lights.size());
245 } 247 }
246 248
247 // Set the material of the model 249 // Set the material of the model
248 glEnable(GL_COLOR_MATERIAL);
249 glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); 250 glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
250 glMateriali(GL_FRONT, GL_SHININESS, model.material.shininess); 251 glMateriali(GL_FRONT, GL_SHININESS, model.material.shininess);
251 glMaterialfv(GL_FRONT, GL_SPECULAR, model.material.specular.values); 252 glMaterialfv(GL_FRONT, GL_SPECULAR, model.material.specular.values);
252 glColor4fv(model.material.diffuse.values); 253 glColor4fv(model.material.diffuse.values);
253 254