remove useless code

This commit is contained in:
Mylloon 2022-05-17 21:05:03 +02:00
parent 56503dcc18
commit e9fdf2697f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 10 additions and 21 deletions

View file

@ -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);

View file

@ -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.;
}
}