WIP: cleaning, simplifying, organizing #include graph_stack : shaders, buffer, draw missing

This commit is contained in:
Jean Sirmai 2024-06-06 10:01:19 +02:00
parent 68c5c445b4
commit 21d76d69f4
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 58 additions and 80 deletions

93
(notes)
View File

@ -1,65 +1,50 @@
jean@Project:~/01/Gtk4/Getting_Started_with_GTK [env] $ grep -r "//////////////////////////"
jean@Project:~/01/Gtk4/Getting_Started_with_GTK [env] $ grep -r "////...////"
contain.c: (136) gtk_box_append (middle_box, GTK_WIDGET (get_GLArea()));
graph_area.h: (177) static inline GLuint create_shader(const int stack_id, int type, const char *src) {...}
graph_area.c: (153) graphics_draw (stack_index[i].stack_id);
graph_area.c: (233) g_signal_connect (adj, "value-changed", G_CALLBACK(on_axis_value_change), (gpointer) label);
graph_area.c: (289) g_signal_connect(GTK_GL_AREA(gl_area), "render", G_CALLBACK(on_glarea_render), NULL);
graph_area.c: g_signal_connect(gl_area, "realize", G_CALLBACK(on_glarea_realize), NULL);
graph_area.c: g_signal_connect(gl_area, "unrealize", G_CALLBACK(on_glarea_unrealize), NULL);
graph_area.c:////////////////////////// stack_index[i].stack_id = graphics_init(&error_buffer);
graph_area.c:////////////////////////// if (graphics_shutdown(stack_index[i].stack_id,
graph_area.c:////////////////////////// &error_buffer) == false) {
graph_area.c:////////////////////////// return false;
graph_area.c:////////////////////////// }
graph_area.c:////////////////////////// graphics_draw(stack_index[i].stack_id);
graph_area.c:////////////////////////// graphic_stack[stack_index[i].stack_id].rotation_angles[axis] = value;
graph_area.c:////////////////////////// graphics_shutdown(stack_index[i].stack_id, NULL);
graph_area.c:////////////////////////// g_signal_connect(adj, "value-changed",
graph_area.c:////////////////////////// G_CALLBACK(on_axis_value_change),
graph_area.c:////////////////////////// (gpointer) label);
graph_area.c:////////////////////////// g_signal_connect(GTK_GL_AREA(gl_area),
graph_area.c:////////////////////////// "render",
graph_area.c:////////////////////////// G_CALLBACK(on_glarea_render), NULL);
graph_area.c:////////////////////////// g_signal_connect(gl_area,
graph_area.c:////////////////////////// "realize",
graph_area.c:////////////////////////// G_CALLBACK(on_glarea_realize), NULL);
graph_area.c:////////////////////////// g_signal_connect(gl_area,
graph_area.c:////////////////////////// "unrealize",
graph_area.c:////////////////////////// G_CALLBACK(on_glarea_unrealize), NULL);
init.c.todo: (98) vertex = create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
init.c.todo: (110) fragment = create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);
graph_stack.c:////////////////////////// glEnable(GL_DEBUG_OUTPUT);
graph_stack.c:////////////////////////// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
graph_stack.c:////////////////////////// glEnable(GL_MULTISAMPLE);
graph_stack.c:////////////////////////// if (!graphics_init_shaders(cur_id)) return -1;
graph_stack.c:////////////////////////// graphics_init_buffers(cur_id);
graph_stack.c:////////////////////////// glDebugMessageCallback(graphics_debug_callback, NULL);
graph_stack.c:////////////////////////// dimension = model_get_dim();
graph_stack.c:////////////////////////// space_Z = model_get_dim_value("z");
graph_stack.c:////////////////////////// space_Y = model_get_dim_value("y");
graph_stack.c:////////////////////////// space_X = model_get_dim_value("x");
graph_stack.c:////////////////////////// multiplicity = model_get_multiplicity();
graph_stack.c:////////////////////////// g_print("[GRAPH DEBUG] site_multiplicity = %ld\n", multiplicity);
graph_stack.c:////////////////////////// draw_space_ridges_vertex (stack_id, stack->buffer_vertex_size, space_X, space_Y, space_Z);
graph_stack.c:////////////////////////// draw_space_ridges_lines (stack_id);
graph_stack.c:////////////////////////// draw_grids_on_space_faces_vertex (stack_id, space_X, space_Y, space_Z);
graph_stack.c:////////////////////////// draw_grids_on_space_faces_lines (stack_id, stack->buffer_lines_size, space_X, space_Y, space_Z);
graph_stack.c:////////////////////////// assert(model_get_next_state(&state_id));
graph_stack.c:////////////////////////// announced_arrows_nb = model_get_state_arrows_count(state_id);
graph_stack.c:////////////////////////// g_print("[GRAPH DEBUG] announced_arrows_nb is = %ld\n", announced_arrows_nb);
graph_stack.c:////////////////////////// while (model_get_next_arrow(&arrow, &state_id, dimension)) {
graph_stack.c:////////////////////////// g_print("[GRAPH DEBUG] cur arrow has x = %d\n", arrow.x);
graph_stack.c:////////////////////////// stack->arrows_nb =
graph_stack.c:////////////////////////// set_arrow (stack_id, stack->arrows_nb, space_X, space_Y, space_Z,
graph_stack.c:////////////////////////// arrow.load, // load
graph_stack.c:////////////////////////// arrow.site, // site
graph_stack.c:////////////////////////// arrow.x, // x
graph_stack.c:////////////////////////// arrow.y, // y
graph_stack.c:////////////////////////// arrow.z); // z
graph_stack.c:////////////////////////// }
graph_stack.c:////////////////////////// if (stack->arrows_nb != announced_arrows_nb)
graph_stack.c:////////////////////////// g_printerr("ARGH : all the arrows have not been parsed !\n");
init.c.todo:////////////////////////// vertex = create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
init.c.todo:////////////////////////// fragment = create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);
graph_stack.c:////...//// glEnable(GL_DEBUG_OUTPUT);
graph_stack.c:////...//// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
graph_stack.c:////...//// glEnable(GL_MULTISAMPLE);
graph_stack.c:////...//// if (!graphics_init_shaders(cur_id)) return -1;
graph_stack.c:////...//// graphics_init_buffers(cur_id);
graph_stack.c:////...//// glDebugMessageCallback(graphics_debug_callback, NULL);
graph_stack.c:////...//// dimension = model_get_dim();
graph_stack.c:////...//// space_Z = model_get_dim_value("z");
graph_stack.c:////...//// space_Y = model_get_dim_value("y");
graph_stack.c:////...//// space_X = model_get_dim_value("x");
graph_stack.c:////...//// multiplicity = model_get_multiplicity();
graph_stack.c:////...//// g_print("[GRAPH DEBUG] site_multiplicity = %ld\n", multiplicity);
graph_stack.c:////...//// draw_space_ridges_vertex (stack_id, stack->buffer_vertex_size, space_X, space_Y, space_Z);
graph_stack.c:////...//// draw_space_ridges_lines (stack_id);
graph_stack.c:////...//// draw_grids_on_space_faces_vertex (stack_id, space_X, space_Y, space_Z);
graph_stack.c:////...//// draw_grids_on_space_faces_lines (stack_id, stack->buffer_lines_size, space_X, space_Y, space_Z);
graph_stack.c:////...//// assert(model_get_next_state(&state_id));
graph_stack.c:////...//// announced_arrows_nb = model_get_state_arrows_count(state_id);
graph_stack.c:////...//// g_print("[GRAPH DEBUG] announced_arrows_nb is = %ld\n", announced_arrows_nb);
graph_stack.c:////...//// while (model_get_next_arrow(&arrow, &state_id, dimension)) {
graph_stack.c:////...//// g_print("[GRAPH DEBUG] cur arrow has x = %d\n", arrow.x);
graph_stack.c:////...//// stack->arrows_nb =
graph_stack.c:////...//// set_arrow (stack_id, stack->arrows_nb, space_X, space_Y, space_Z,
graph_stack.c:////...//// arrow.load, // load
graph_stack.c:////...//// arrow.site, // site
graph_stack.c:////...//// arrow.x, // x
graph_stack.c:////...//// arrow.y, // y
graph_stack.c:////...//// arrow.z); // z
graph_stack.c:////...//// }
graph_stack.c:////...//// if (stack->arrows_nb != announced_arrows_nb)
graph_stack.c:////...//// g_printerr("ARGH : all the arrows have not been parsed !\n");
--------------------------------------------------------------------------------
https://docs.gtk.org/gtk4/visual_index.html widgets gallery
https://forge.a-lec.org/gem-graph/gem-graph-client/src/branch/devel/Makefile

View File

@ -142,9 +142,9 @@ int graphics_init(void *error_buffer)
stack = &graphic_stack[cur_id];
stack->id = cur_id;
////////////////////////// glEnable(GL_DEBUG_OUTPUT);
////////////////////////// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
////////////////////////// glEnable(GL_MULTISAMPLE);
glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glEnable(GL_MULTISAMPLE);
////////////////////////// if (!graphics_init_shaders(cur_id)) return -1;
@ -152,7 +152,7 @@ int graphics_init(void *error_buffer)
////////////////////////// graphics_init_buffers(cur_id);
////////////////////////// glDebugMessageCallback(graphics_debug_callback, NULL);
glDebugMessageCallback(graphics_debug_callback, NULL);
//print_stack(cur_id);
@ -242,8 +242,7 @@ void graphics_model_setup (const int stack_id)
int density_max;
char multiplicity;
////////////////////////// dimension = model_get_dim();
dimension = 1; // AD HOC (2024-06-04)
dimension = model_get_dim();
g_print("[GRAPH DEBUG] dim = %d\n", dimension);
@ -253,16 +252,16 @@ dimension = 1; // AD HOC (2024-06-04)
switch(dimension) {
case 3:
////////////////////////// space_Z = model_get_dim_value("z");
space_Z = model_get_dim_value("z");
;
case 2:
////////////////////////// space_Y = model_get_dim_value("y");
space_Y = model_get_dim_value("y");
;
// even in 1D, we must be able to see a grid (or not !)
if (!space_Y)
space_Y = 1;
case 1:
////////////////////////// space_X = model_get_dim_value("x");
space_X = model_get_dim_value("x");
;
if (!space_X)
space_X = 1;
@ -277,8 +276,8 @@ dimension = 1; // AD HOC (2024-06-04)
density_max = space_X * space_Y * space_Z;
stack->arrows_nb = 0;
////////////////////////// multiplicity = model_get_multiplicity();
////////////////////////// g_print("[GRAPH DEBUG] site_multiplicity = %ld\n", multiplicity);
multiplicity = model_get_multiplicity();
g_print("[GRAPH DEBUG] site_multiplicity = %ld\n", multiplicity);
/*------------------------------------------------------------------------*/
@ -304,26 +303,20 @@ dimension = 1; // AD HOC (2024-06-04)
char state_id[30] = {0};
struct arrow_t arrow = {0};
////////////////////////// assert(model_get_next_state(&state_id));
assert(model_get_next_state(&state_id));
g_print("[GRAPH DEBUG] first state is = %s\n", state_id);
////////////////////////// announced_arrows_nb = model_get_state_arrows_count(state_id);
announced_arrows_nb = model_get_state_arrows_count(state_id);
////////////////////////// g_print("[GRAPH DEBUG] announced_arrows_nb is = %ld\n", announced_arrows_nb);
g_print("[GRAPH DEBUG] announced_arrows_nb is = %ld\n", announced_arrows_nb);
////////////////////////// while (model_get_next_arrow(&arrow, &state_id, dimension)) {
////////////////////////// g_print("[GRAPH DEBUG] cur arrow has x = %d\n", arrow.x);
////////////////////////// stack->arrows_nb =
////////////////////////// set_arrow (stack_id, stack->arrows_nb, space_X, space_Y, space_Z,
////////////////////////// arrow.load, // load
////////////////////////// arrow.site, // site
////////////////////////// arrow.x, // x
////////////////////////// arrow.y, // y
////////////////////////// arrow.z); // z
////////////////////////// }
while (model_get_next_arrow(&arrow, &state_id, dimension)) {
g_print("[GRAPH DEBUG] cur arrow has x = %d\n", arrow.x);
////////////////////////// stack->arrows_nb = set_arrow (stack_id, stack->arrows_nb, space_X, space_Y, space_Z, arrow.load, arrow.site, arrow.x, arrow.y, arrow.z);
}
////////////////////////// if (stack->arrows_nb != announced_arrows_nb)
////////////////////////// g_printerr("ARGH : all the arrows have not been parsed !\n");
if (stack->arrows_nb != announced_arrows_nb)
g_printerr("ARGH : all the arrows have not been parsed !\n");
}