remove useless code
This commit is contained in:
parent
56503dcc18
commit
e9fdf2697f
2 changed files with 10 additions and 21 deletions
21
src/cube.c
21
src/cube.c
|
@ -9,7 +9,7 @@ void cube(int etat) {
|
||||||
switch(etat) {
|
switch(etat) {
|
||||||
case GL4DH_INIT:
|
case GL4DH_INIT:
|
||||||
for(int i = 0; i < 3; ++i) {
|
for(int i = 0; i < 3; ++i) {
|
||||||
rgb[i] = rand() / (float)RAND_MAX;
|
rgb[i] = gl4dmURand();
|
||||||
}
|
}
|
||||||
|
|
||||||
cube = gl4dgGenCubef();
|
cube = gl4dgGenCubef();
|
||||||
|
@ -19,21 +19,6 @@ void cube(int etat) {
|
||||||
gl4duGenMatrix(GL_FLOAT, "view");
|
gl4duGenMatrix(GL_FLOAT, "view");
|
||||||
gl4duGenMatrix(GL_FLOAT, "proj");
|
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);
|
glEnable(GL_DEPTH_TEST);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -46,6 +31,10 @@ void cube(int etat) {
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glUseProgram(proc_id);
|
glUseProgram(proc_id);
|
||||||
|
|
||||||
|
gl4duBindMatrix("proj");
|
||||||
|
gl4duLoadIdentityf();
|
||||||
|
gl4duFrustumf(-1.f, 1.f, -.57f, .57f, 1.f, 1000.f);
|
||||||
|
|
||||||
gl4duBindMatrix("view");
|
gl4duBindMatrix("view");
|
||||||
gl4duLoadIdentityf();
|
gl4duLoadIdentityf();
|
||||||
gl4duLookAtf(0, 0, 5, 0, 0, 0, 0, 1, 0);
|
gl4duLookAtf(0, 0, 5, 0, 0, 0, 0, 1, 0);
|
||||||
|
|
|
@ -65,12 +65,12 @@ void diag_init(int n, GLfloat **coords, GLfloat **colors) {
|
||||||
assert(*colors);
|
assert(*colors);
|
||||||
|
|
||||||
for(int i = 0; i < n; ++i) {
|
for(int i = 0; i < n; ++i) {
|
||||||
(*coords)[i * 2] = (gl4dmSURand() + 1) / 2;
|
(*coords)[i * 2] = gl4dmURand();
|
||||||
(*coords)[i * 2 + 1] = (gl4dmSURand() + 1) / 2;
|
(*coords)[i * 2 + 1] = gl4dmURand();
|
||||||
|
|
||||||
(*colors)[i * 4] = (rand() % 256) / 255.f;
|
(*colors)[i * 4] = gl4dmURand();
|
||||||
(*colors)[i * 4 + 1] = (rand() % 256) / 255.f;
|
(*colors)[i * 4 + 1] = gl4dmURand();
|
||||||
(*colors)[i * 4 + 2] = (rand() % 256) / 255.f;
|
(*colors)[i * 4 + 2] = gl4dmURand();
|
||||||
(*colors)[i * 4 + 3] = 1.;
|
(*colors)[i * 4 + 3] = 1.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue