diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index e1d7089..50193d3 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -177,6 +177,9 @@ void graphics_write_line (GLuint a, GLuint b) buffer_lines_origin[buffer_lines_size + 0] = a; buffer_lines_origin[buffer_lines_size + 1] = b; + if (1) printf("In graphics_write_line() buffer_lines_size = %2d > %2d\n",\ + buffer_lines_size, buffer_lines_size + 2); + buffer_lines_size += 2; } @@ -683,8 +686,8 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) int arbitrary = 3; int space_X = 2,// + rand() % arbitrary, - space_Y = 2,// + rand() % arbitrary, - space_Z = 2;// + rand() % arbitrary; + space_Y = 1,// + rand() % arbitrary, + space_Z = 1;// + rand() % arbitrary; int density_max = space_X * space_Y * space_Z; int max = fmax(space_X, space_Y); max = fmax(max, space_Z); @@ -735,15 +738,15 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) if (1) printf("buffer_vertex_size before writing_space_ridges_vertex : %d (x 3 = %d)\n", buffer_vertex_size, buffer_vertex_size * 3); - buffer_vertex_size += write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z); - buffer_colors_size = buffer_vertex_size; + write_space_ridges_vertex (buffer_vertex_size, space_X, space_Y, space_Z); + /* buffer_colors_size = buffer_vertex_size; */ if (1) printf("buffer_vertex_size after writing_space_ridges_vertex : %d (x 3 = %d)\n\n", buffer_vertex_size, buffer_vertex_size * 3); - /* buffer_vertex_size += write_grids_on_space_faces_vertex (space_X, space_Y, space_Z); */ + write_grids_on_space_faces_vertex (space_X, space_Y, space_Z); /* buffer_colors_size = buffer_vertex_size; */ - /* if (1) printf("buffer_vertex_size after writing_space_faces_vertex = %4d - 8 = %3d (x 3 = %4d)\n\n", buffer_vertex_size, buffer_vertex_size - 8, (buffer_vertex_size - 8) * 3); */ + if (1) printf("buffer_vertex_size after writing_space_faces_vertex = %4d - 8 = %3d (x 3 = %4d)\n\n", buffer_vertex_size, buffer_vertex_size - 8, (buffer_vertex_size - 8) * 3); /* if (0) printf("(space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4 = %3d (x 3 = %4d)\n\n",\ */ /* (space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4, ((space_X - 1) * 4 + (space_Y - 1) * 4 + (space_Z - 1) * 4) * 3); */ @@ -774,15 +777,17 @@ void __attribute__((optimize("no-unroll-loops"))) main_test_graphics (void) /* S P A C E */ - printf("Un problème, là : D'où vient l'accroissement inattendu de buffer_vertex_size ?\n\ - write_space_ridges_vertex() renvoie 8; write_space_ridges_lines() renvoie 12\n"); - buffer_vertex_size += write_space_ridges_lines (); - if (1) printf("buffer_vertex_size after writing_space_ridges_lines : %d (x 3 = %d)\n\n", buffer_vertex_size, buffer_vertex_size * 3); + if (1) printf("buffer_lines_size before writing 12 space_ridges_lines : %d (x 2 = %d)\n", buffer_lines_size, buffer_lines_size * 2); + write_space_ridges_lines (); + if (1) printf("buffer_lines_size after writing 12 space_ridges_lines : %d (x 2 = %d)\n\n", buffer_lines_size, buffer_lines_size * 2); - /* int offset_test = 14; // 10 */ - /* // */ - /* buffer_vertex_size += write_grids_on_space_faces_lines (offset_test, space_X, space_Y, space_Z); */ - /* if (1) printf("buffer_vertex_size after writing_space_faces_lines : %d (x 3 = %d)\n\n", buffer_vertex_size, buffer_vertex_size * 3); */ + if (1) printf("buffer_lines_size before writing_space_faces_lines : %d (x 2 = %d)\n", buffer_lines_size, buffer_lines_size * 2); + /* write_grids_on_space_faces_lines (buffer_lines_size, space_X, space_Y, space_Z); */ + graphics_write_line (8, 9); + graphics_write_line (9, 10); + graphics_write_line (10, 11); + graphics_write_line (11, 8); + if (1) printf("buffer_lines_size after writing_space_faces_lines : %d (x 2 = %d)\n\n", buffer_lines_size, buffer_lines_size * 2); /* A R R O W S */ diff --git a/src/graphics/grid.c b/src/graphics/grid.c index 1bb01a7..e23a5fa 100644 --- a/src/graphics/grid.c +++ b/src/graphics/grid.c @@ -70,7 +70,7 @@ long write_grids_on_space_faces_vertex (long x, long y, long z) { float i, max = fmax(x, y); max = fmax(max, z); - for (i = 0; i < x; i++) { + for (i = 1; i < x; i++) { graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, - z / max); graphics_write_vertex ((2 * i / x - 1) * x / max, - y / max, z / max);