diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index f0cada6..4010469 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -41,15 +41,15 @@ GLfloat *buffer_colors_origin = NULL; GLuint *buffer_lines_origin = NULL; GLuint *buffer_plans_origin = NULL; -volatile int buffer_vertex_size = 0; -volatile int buffer_lines_size = 0; -volatile int buffer_colors_size = 0; -volatile int buffer_plans_size = 0; +volatile long buffer_vertex_size = 0; +volatile long buffer_lines_size = 0; +volatile long buffer_colors_size = 0; +volatile long buffer_plans_size = 0; -volatile int buffer_vertex_0_arrow = 0; -volatile int buffer_lines_0_arrow = 0; -volatile int buffer_colors_0_arrow = 0; -volatile int buffer_plans_0_arrow = 0; +volatile long buffer_vertex_0_arrow = 0; +volatile long buffer_lines_0_arrow = 0; +volatile long buffer_colors_0_arrow = 0; +volatile long buffer_plans_0_arrow = 0; #define TEST 0 @@ -673,8 +673,8 @@ static inline int erase_arrow (int arrows_nb, int address, int site, int x, int y, int z, int console) { - arrows_nb --; assert (arrows_nb); + arrows_nb --; int mem = arrows_ptr[address].site; @@ -689,15 +689,13 @@ static inline int erase_arrow (int arrows_nb, int address, : arrows_ptr[%d].site = %d >> %d (%d is last arrow.site)\n",\ arrows_nb + 1, arrows_nb, address, address, site, mem, arrows_ptr[address].site, arrows_ptr[arrows_nb].site); - // Attention : lors de la création des vertex des flèches, tous les vertex centraux sont redondants (au maximum 6) + for (long i = 0 + address * 6; i < 6 + address * 6; i++) + buffer_vertex_origin [buffer_vertex_0_arrow + i] + = buffer_vertex_origin [buffer_vertex_size - 6 + i]; - for (int i = 0 + address * 6; i < 6 + address * 6; i++) - buffer_vertex_origin [(long) buffer_vertex_0_arrow + i] - = buffer_vertex_origin [(long) buffer_vertex_size - 6 + i]; - - for (int i = 0; i < 6; i++) - buffer_colors_origin [(long) buffer_colors_0_arrow + (address + 4) * 6 + i] - = buffer_colors_origin [(long) buffer_colors_size - 6 + i]; + for (long i = 0; i < 6; i++) + buffer_colors_origin [buffer_colors_0_arrow + (address + 4) * 6 + i] + = buffer_colors_origin [buffer_colors_size - 6 + i]; void *new_arrows_vertex_ptr = g_realloc(buffer_vertex_origin, buffer_vertex_size * sizeof(GLfloat)); if (new_arrows_vertex_ptr) buffer_vertex_origin = new_arrows_vertex_ptr; @@ -708,9 +706,9 @@ static inline int erase_arrow (int arrows_nb, int address, else perror("In graphics.erase_arrow(), can't re_allocate for arrows colors buffer.\n"); - /* buffer_vertex_size -= 6; <<< ceci est fait dans : graphics_write_vertex() */ - /* buffer_colors_size -= 6; <<< ceci est fait dans : graphics_write_colors() */ - /* buffer_lines_size -= 2; <<< ceci est fait dans : graphics_write_line() */ + /* buffer_vertex_size -= 6; // <<< ceci est fait dans : graphics_write_vertex() */ + /* buffer_colors_size -= 6; // <<< ceci est fait dans : graphics_write_colors() */ + /* buffer_lines_size -= 2; // <<< ceci est fait dans : graphics_write_line() */ /* Il ne faut pas réécrire ce qui suit: ces lignes dessinent maintenant à partir d'autres vertex */ /* void *new_arrows_lines_ptr = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLfloat)); */