From e9fdf2697f8147b2f19050b8545a5373a812a79c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 17 May 2022 21:05:03 +0200 Subject: [PATCH] remove useless code --- src/cube.c | 21 +++++---------------- src/voronoi.c | 10 +++++----- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/cube.c b/src/cube.c index 0d64357..c089c9c 100644 --- a/src/cube.c +++ b/src/cube.c @@ -9,7 +9,7 @@ void cube(int etat) { switch(etat) { case GL4DH_INIT: for(int i = 0; i < 3; ++i) { - rgb[i] = rand() / (float)RAND_MAX; + rgb[i] = gl4dmURand(); } cube = gl4dgGenCubef(); @@ -19,21 +19,6 @@ void cube(int etat) { gl4duGenMatrix(GL_FLOAT, "view"); gl4duGenMatrix(GL_FLOAT, "proj"); - gl4duBindMatrix("proj"); - - gl4duLoadIdentityf(); - - gl4duFrustumf(-1, 1, -1, 1, 1, 1000); - - // resize - GLfloat ratio_inverse; - int fenetre_largeur = dimensions[0], fenetre_hauteur = dimensions[1]; - glViewport(0, 0, fenetre_largeur, fenetre_hauteur); - ratio_inverse = fenetre_hauteur / (GLfloat)fenetre_largeur; - gl4duBindMatrix("proj"); - gl4duLoadIdentityf(); - gl4duFrustumf(-1.f, 1.f, -1.f * ratio_inverse, 1.f * ratio_inverse, 1.f, 1000.f); - glEnable(GL_DEPTH_TEST); break; @@ -46,6 +31,10 @@ void cube(int etat) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(proc_id); + gl4duBindMatrix("proj"); + gl4duLoadIdentityf(); + gl4duFrustumf(-1.f, 1.f, -.57f, .57f, 1.f, 1000.f); + gl4duBindMatrix("view"); gl4duLoadIdentityf(); gl4duLookAtf(0, 0, 5, 0, 0, 0, 0, 1, 0); diff --git a/src/voronoi.c b/src/voronoi.c index 20915a4..8b6f840 100644 --- a/src/voronoi.c +++ b/src/voronoi.c @@ -65,12 +65,12 @@ void diag_init(int n, GLfloat **coords, GLfloat **colors) { assert(*colors); for(int i = 0; i < n; ++i) { - (*coords)[i * 2] = (gl4dmSURand() + 1) / 2; - (*coords)[i * 2 + 1] = (gl4dmSURand() + 1) / 2; + (*coords)[i * 2] = gl4dmURand(); + (*coords)[i * 2 + 1] = gl4dmURand(); - (*colors)[i * 4] = (rand() % 256) / 255.f; - (*colors)[i * 4 + 1] = (rand() % 256) / 255.f; - (*colors)[i * 4 + 2] = (rand() % 256) / 255.f; + (*colors)[i * 4] = gl4dmURand(); + (*colors)[i * 4 + 1] = gl4dmURand(); + (*colors)[i * 4 + 2] = gl4dmURand(); (*colors)[i * 4 + 3] = 1.; } }