#include #include #include #include "Utils.h" #define MAX 50 static int spm = 0; static int spl = 0; static float dc[MAX][4]; static float ac[MAX][4]; static float sc[MAX][4]; static float ec[MAX][4]; static float sh[MAX]; static int numl[MAX]; int premiereLumiereDisponible(void) { int numl = GL_LIGHT1; while ( glIsEnabled(numl) ) numl++ ; return(numl); } void empileMaterial(void) { glGetMaterialfv(GL_FRONT,GL_DIFFUSE,dc[spm]); glGetMaterialfv(GL_FRONT,GL_AMBIENT,ac[spm]); glGetMaterialfv(GL_FRONT,GL_SPECULAR,sc[spm]); glGetMaterialfv(GL_FRONT,GL_EMISSION,ec[spm]); glGetMaterialfv(GL_FRONT,GL_SHININESS,&sh[spm]); spm++; } void depileMaterial(void) { spm--; glMaterialfv(GL_FRONT,GL_DIFFUSE,dc[spm]); glMaterialfv(GL_FRONT,GL_AMBIENT,ac[spm]); glMaterialfv(GL_FRONT,GL_SPECULAR,sc[spm]); glMaterialfv(GL_FRONT,GL_EMISSION,ec[spm]); glMaterialfv(GL_FRONT,GL_SHININESS,&sh[spm]); } void empileLights(void) { numl[spl] = premiereLumiereDisponible(); spl++; } void depileLights(void) { spl--; int numl2 = premiereLumiereDisponible(); for ( int l = numl[spl] ; l < numl2 ; l++ ) glDisable(l); }