From d26b9b1f96237d29e14cc9311226e85a3c637695 Mon Sep 17 00:00:00 2001 From: Theo Date: Mon, 9 Sep 2024 13:34:11 +0200 Subject: [PATCH] =?UTF-8?q?Petite=20couleur=20pour=20diff=C3=A9rencier=20q?= =?UTF-8?q?uand=20superpos=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C'est des niveaux de gris :° 😎 --- main.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 1574cb8..477bc78 100644 --- a/main.c +++ b/main.c @@ -93,7 +93,13 @@ void ligne(int index, float hgx, float hgy, float bdx, float bdy) glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0); - glColor3f(1.0,1.0,1.0); + + float color = 1.0; + if(mode_affichage == SUPERPOSER) + color = map(0, nc, index, 0.5, 1.0); + + glColor3f(color, color, color); + glBegin(GL_LINE_STRIP); unsigned int size = (unsigned int)courbe[index][0]; @@ -158,7 +164,13 @@ void histo(int index, float hgx, float hgy, float bdx, float bdy) glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0); - glColor3f(1.0,1.0,1.0); + + float color = 1.0; + if(mode_affichage == SUPERPOSER) + color = map(0, nc, index, 0.5, 1.0); + + glColor3f(color, color, color); + //glBegin(GL_POLYGON); unsigned int size = (unsigned int)courbe[index][0]; @@ -431,8 +443,8 @@ int main(int argc, char* argv[]) printCourbeTerminal(); - type_dessin = LIGNE_AXES; - mode_affichage = VERTICAL; + type_dessin = HISTOGRAMME; + mode_affichage = HORIZONTAL; int window = initWindow(argc, argv, afficher); glutMainLoop();