WIP: Une erreur de segmentation (dans le fonction create_arrow(), je suppose)
This commit is contained in:
parent
d2ad9649c7
commit
04cff04b1e
|
@ -488,9 +488,8 @@ static void show_user_choices(GLuint *arrows, int arrows_nb,
|
|||
static void show_user_action(GLuint *arrows, int arrows_nb, int address, int requested_weight,
|
||||
int current_weight, int site, int x, int y, int z)
|
||||
{
|
||||
if (address == -1 && requested_weight > 0) {printf("no such arrow found (%d,%d,%d,%d)\n\
|
||||
requested weight == %d => CREATE",\
|
||||
arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], requested_weight); return;}
|
||||
if (address == -1 && requested_weight > 0) {printf("no such arrow found (address == -1)\n\
|
||||
requested weight == %d => CREATE", requested_weight); return;}
|
||||
|
||||
if (address >= 0 && requested_weight == 0) {printf("arrow (%d,%d,%d,%d) found at address %d; current_weight = %d;\n\
|
||||
requested weight == %d => ERASE",\
|
||||
|
@ -500,14 +499,12 @@ static void show_user_action(GLuint *arrows, int arrows_nb, int address, int req
|
|||
requested weight != current weight => MODIFY",\
|
||||
arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5, current_weight); return;}
|
||||
|
||||
if (address >= 0 && current_weight == requested_weight){
|
||||
printf("arrow (%d,%d,%d,%d) found at address %d;\n\
|
||||
if (address >= 0 && current_weight == requested_weight){printf("arrow (%d,%d,%d,%d) found at address %d;\n\
|
||||
requested_weight == current_weight => END",\
|
||||
arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4], address/5); return;}
|
||||
|
||||
if (address == -1 && requested_weight == 0) {printf("no such arrow found (%d,%d,%d,%d)\n\
|
||||
requested weight == 0 => END",\
|
||||
arrows[address + 1], arrows[address + 2], arrows[address + 3], arrows[address + 4]); return;}
|
||||
if (address == -1 && requested_weight == 0) {printf("no such arrow found (address == -1)\n\
|
||||
requested weight == 0 => END"); return;}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -558,7 +555,9 @@ static int rewrite_arrow (GLuint *arrows, int arrows_nb, int address, int weight
|
|||
*/
|
||||
static int create_arrow (GLuint *arrows, int arrows_nb, int weight, int site, int x, int y, int z)
|
||||
{
|
||||
buffer_lines_origin = g_realloc(buffer_lines_origin, buffer_lines_size * sizeof(GLuint));
|
||||
// buffer_lines_size += 14;
|
||||
|
||||
buffer_lines_origin = g_realloc(buffer_lines_origin, buffer_lines_size * 2 * sizeof(GLuint));
|
||||
|
||||
assert (buffer_lines_origin); assert (buffer_lines_size);
|
||||
|
||||
|
@ -657,14 +656,14 @@ void main_test_graphics (void)
|
|||
// assert : no more than one arrow per address TODO NOT checked before init
|
||||
// notify : weights are replaced, NOT added (could be !) TODO
|
||||
|
||||
int space_X = 4, space_Y = 1, space_Z = 1;
|
||||
int space_X = 3, space_Y = 3, space_Z = 3;
|
||||
int pref_show_grids = 0; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc
|
||||
// xyz, 0, x, y, z, xy, xz, yz, xyz
|
||||
GLuint arrows[] = {
|
||||
1, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0,
|
||||
1, 0, 2, 0, 0,
|
||||
1, 1, 3, 0, 0,
|
||||
1, 2, 2, 0, 0,
|
||||
1, 3, 0, 2, 0,
|
||||
// load, site, x, y, z
|
||||
};
|
||||
int arrows_nb = sizeof(arrows) / sizeof(arrows[0]) / 5;
|
||||
|
@ -683,10 +682,11 @@ void main_test_graphics (void)
|
|||
* are always defined (whether arrows are drawn or not). */
|
||||
arrows_write_terminations (space_X, space_Y, space_Z);
|
||||
|
||||
arrows_nb = set_arrow (arrows, arrows_nb, 0, 0, 0, 0, 0);
|
||||
arrows_nb = set_arrow (arrows, arrows_nb, 0, 0, 2, 0, 0);
|
||||
arrows_nb = set_arrow (arrows, arrows_nb, 0, 1, 1, 0, 0);
|
||||
arrows_nb = set_arrow (arrows, arrows_nb, 0, 1, 3, 0, 0);
|
||||
arrows_nb = set_arrow (arrows, arrows_nb, 1, 1, 2, 2, 0);
|
||||
arrows_nb = set_arrow (arrows, arrows_nb, 1, 3, 0, 2, 0);
|
||||
|
||||
int weight = 0, site = 0,
|
||||
stx = space_Z * space_Y, sty = space_Z, stz = 1, arrow_offset = 0;
|
||||
|
|
|
@ -31,20 +31,15 @@
|
|||
#define VERTEX_SHADER_FILE "src/shaders/shader.vert"
|
||||
#define FRAG_SHADER_FILE "src/shaders/shader.frag"
|
||||
|
||||
|
||||
// Que fait l'instruction suivante (ligne 397 de graphics.c)
|
||||
// dans "bool graphics_init(const char *gl_area)" ?
|
||||
//
|
||||
// if (!graphics_init_shaders(gl_area)) return false;
|
||||
|
||||
|
||||
static volatile int buffer_vertex_size = 0;
|
||||
static volatile int buffer_lines_size = 0;
|
||||
static volatile int buffer_colors_size = 0;
|
||||
static volatile int buffer_plans_size = 0;
|
||||
|
||||
/*
|
||||
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
||||
*/
|
||||
//
|
||||
// Et comment et pourquoi cette structure "gl_area_array" ?
|
||||
// (Dynamic array of ptrs to dynamically allocated gl_area_entry)
|
||||
//
|
||||
// struct gl_area_entry **gl_area_array = NULL;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue