Echec liaison des shaders (voir init.c graphics_init_shaders() ligne 140
This commit is contained in:
parent
b05510e482
commit
141f3564e6
35
callback.c
35
callback.c
|
@ -186,37 +186,6 @@ void on_toggle_EXEC_EDIT (GtkWidget *btt_XOR_EXEC_EDIT, GtkWidget *btt_MODEL_RUN
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void on_open_STATE (GtkWidget *btt_open_STATE, gpointer user_data) {
|
||||
if (0) printf("on_open_STATE status = %d\n", get_status ());
|
||||
printf("gtk_check_button_get_active > after = %d, %d, %d from callback : on_open_STATE()\n",\
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), // (GTK_CHECK_BUTTON (btt_open_STATE)),
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)),
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // (GTK_CHECK_BUTTON (btt_open_DATA)));
|
||||
|
||||
if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))))
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE())); // window_main_child (main_window, STATE);
|
||||
} // SWITCH_TO (STATE);}
|
||||
|
||||
void on_open_RULES (GtkWidget *btt_open_RULES, gpointer data) {
|
||||
if (0) printf("on_open_RULES status = %d\n", get_status ());
|
||||
if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))))
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_RULES())); // window_main_child (main_window, RULES);
|
||||
}// SWITCH_TO (RULES);}
|
||||
|
||||
void on_open_DATA (GtkWidget *btt_open_DATA, gpointer data) {
|
||||
if (0) printf("on_open_DATA status = %d\n", get_status ());
|
||||
if (! gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis"))))
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA())); // window_main_child (main_window, DATA);
|
||||
}// SWITCH_TO (DATA);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void on_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data) {
|
||||
// https://docs.gtk.org/gtk4/class.ToggleButton.html < f..k ! bad code ++
|
||||
|
||||
|
@ -236,10 +205,6 @@ void on_toggle_STATE_RULES_DATA (GtkWidget *btt, gpointer user_data) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
|
||||
printf ("callback.c (line 201) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
|
||||
|
|
38
contain.c
38
contain.c
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
#include "graph_area.h"
|
||||
#include "callback.h"
|
||||
#include "automaton.h"
|
||||
#include "display.h"
|
||||
|
@ -133,8 +134,9 @@ GtkWidget *get_SPACE_VIEW_box(){
|
|||
gtk_box_append (right_box, GTK_WIDGET (get_ZOOM_box()));
|
||||
|
||||
GtkBox *middle_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||
gtk_box_append (middle_box, GTK_WIDGET (get_image_ALL_SPACE()));
|
||||
////////////////////////// gtk_box_append (middle_box, GTK_WIDGET (get_GLArea()));
|
||||
// gtk_box_append (middle_box, GTK_WIDGET (get_image_ALL_SPACE()));
|
||||
ui_setup_glarea (0, GTK_WIDGET (middle_box));
|
||||
|
||||
gtk_box_append (middle_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_VERTICAL)));
|
||||
gtk_box_append (middle_box, GTK_WIDGET (right_box));
|
||||
return GTK_WIDGET (middle_box);
|
||||
|
@ -176,9 +178,6 @@ void window_header_bar (GtkWindow *window, char *title){
|
|||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));
|
||||
gtk_window_set_titlebar (window, header_bar);
|
||||
|
||||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
||||
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||
|
||||
gpointer no_local_data = NULL;
|
||||
|
||||
GtkButton *btt_MODEL_RUN_STOP = GTK_BUTTON (gtk_button_new_with_label (" run "));
|
||||
|
@ -190,47 +189,22 @@ void window_header_bar (GtkWindow *window, char *title){
|
|||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic");
|
||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), btt_MODEL_RUN_STOP);
|
||||
|
||||
// GtkWidget* separe = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
// gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (separe));
|
||||
GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | "));
|
||||
|
||||
GtkCheckButton *group_STATE_RULES_DATA = GTK_CHECK_BUTTON (gtk_check_button_new ());
|
||||
|
||||
btt_open_STATE = GTK_BUTTON (gtk_check_button_new_with_label ("state"));
|
||||
// g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_open_STATE), no_local_data);
|
||||
g_signal_connect (btt_open_STATE, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_STATE), group_STATE_RULES_DATA);
|
||||
|
||||
btt_open_RULES = GTK_BUTTON (gtk_check_button_new_with_label ("rules"));
|
||||
// g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_open_RULES), no_local_data);
|
||||
g_signal_connect (btt_open_RULES, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_RULES), group_STATE_RULES_DATA);
|
||||
|
||||
btt_open_DATA = GTK_BUTTON (gtk_check_button_new_with_label ("data analysis"));
|
||||
// g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_open_DATA), no_local_data);
|
||||
g_signal_connect (btt_open_DATA, "toggled", G_CALLBACK (on_toggle_STATE_RULES_DATA), no_local_data);
|
||||
gtk_check_button_set_group (GTK_CHECK_BUTTON (btt_open_DATA), group_STATE_RULES_DATA);
|
||||
|
||||
// gtk_check_button_set_label (GTK_CHECK_BUTTON (btt_open_DATA), "any label");
|
||||
if (0) printf("gtk_check_button_get_label(s) = %s, %s, %s\n",\
|
||||
gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_STATE)),
|
||||
gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_RULES)),
|
||||
gtk_check_button_get_label (GTK_CHECK_BUTTON (btt_open_DATA)));
|
||||
|
||||
if (0) printf("gtk_check_button_get_active > before = %d, %d, %d\n",\
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))),
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))),
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis"))));
|
||||
|
||||
// gtk_check_button_set_active (GTK_CHECK_BUTTON (get_GtkButton ("state")), TRUE);
|
||||
|
||||
if (0) printf("gtk_check_button_get_active > after = %d, %d, %d\n",\
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("state"))), // (GTK_CHECK_BUTTON (btt_open_STATE)),
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("rules"))), // (GTK_CHECK_BUTTON (btt_open_RULES)),
|
||||
gtk_check_button_get_active (GTK_CHECK_BUTTON (get_GtkButton ("data analysis")))); // (GTK_CHECK_BUTTON (btt_open_DATA)));
|
||||
|
||||
// on_toggle_STATE_RULES_DATA (, NULL) ;
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_MODEL_RUN_STOP)); // << pas ici ! TODO
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));
|
||||
|
@ -247,8 +221,8 @@ void window_header_bar (GtkWindow *window, char *title){
|
|||
void main_window_design (GtkWindow *main_window){
|
||||
window_header_bar (main_window,
|
||||
"E coli (with permission from David S. Goodsell, 2009)");
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE())); // window_main_child (main_window, STATE);
|
||||
// set_check_button_active (GTK_BUTTON (btt_open_STATE), 1);
|
||||
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE()));
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (btt_open_STATE), TRUE);
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
|
|
26
graph_area.c
26
graph_area.c
|
@ -84,19 +84,19 @@ long ui_is_graphic_stack_ready(void *container_widget)
|
|||
*/
|
||||
bool ui_init_graphic_stack(void *container_widget, GError *error_buffer)
|
||||
{
|
||||
//g_printerr("[debug] ui_init_graphic_stack()\n");
|
||||
g_printerr("[debug] ui_init_graphic_stack()\n");
|
||||
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : target is %p\n", container_widget);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : target is %p\n", container_widget);
|
||||
|
||||
// look for stack_index entry
|
||||
for (int i = 0; i < stack_index_size; i++) {
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : i is %d\n", i);
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : target would be %p\n",
|
||||
//stack_index[i].container_widget);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : i is %d\n", i);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : target would be %p\n",
|
||||
stack_index[i].container_widget);
|
||||
if (stack_index[i].container_widget == (void *)container_widget) {
|
||||
stack_index[i].stack_id = graphics_init(&error_buffer);
|
||||
//g_printerr("[debug] ui_init_graphic_stack() : stack_id is %d\n",
|
||||
//stack_index[i].stack_id);
|
||||
g_printerr("[debug] ui_init_graphic_stack() : stack_id is %ld\n",
|
||||
stack_index[i].stack_id);
|
||||
if (stack_index[i].stack_id >= 0)
|
||||
return true;
|
||||
else
|
||||
|
@ -254,11 +254,11 @@ bool ui_setup_glarea(int target_mode, GtkWidget *target_widget)
|
|||
{
|
||||
GtkWidget *gl_area;
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea()\n");
|
||||
g_printerr("[debug] ui_setup_glarea()\n");
|
||||
|
||||
assert(target_widget);
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea() : target is %p\n", target_widget);
|
||||
g_printerr("[debug] ui_setup_glarea() : target is %p\n", target_widget);
|
||||
|
||||
if (stack_index == NULL) {
|
||||
stack_index = g_malloc(sizeof(struct stack_index_t));
|
||||
|
@ -296,11 +296,11 @@ bool ui_setup_glarea(int target_mode, GtkWidget *target_widget)
|
|||
|
||||
stack_index[stack_index_size-1].gl_area = (void*)gl_area;
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea() : set target to %p\n", target_widget);
|
||||
g_printerr("[debug] ui_setup_glarea() : set target to %p\n", target_widget);
|
||||
|
||||
////g_printerr("[debug] ui_setup_glarea() : stack_index (@0x%p) had %ld elements\n",
|
||||
//stack_index,
|
||||
//stack_index_size);
|
||||
g_printerr("[debug] ui_setup_glarea() : stack_index (@0x%p) had %ld elements\n",
|
||||
stack_index,
|
||||
stack_index_size);
|
||||
|
||||
gtk_box_append (GTK_BOX (target_widget), gl_area);
|
||||
gtk_widget_set_visible (GTK_WIDGET (gl_area), TRUE);
|
||||
|
|
|
@ -34,8 +34,10 @@
|
|||
#include "base.h"
|
||||
//#include "draw.c"
|
||||
|
||||
#define VERTEX_SHADER_FILE "src/graphics/shaders/shader.vert"
|
||||
#define FRAG_SHADER_FILE "src/graphics/shaders/shader.frag"
|
||||
// #define VERTEX_SHADER_FILE "src/graphics/shaders/shader.vert"
|
||||
// #define FRAG_SHADER_FILE "src/graphics/shaders/shader.frag"
|
||||
#define VERTEX_SHADER_FILE "shader.vert"
|
||||
#define FRAG_SHADER_FILE "shader.frag"
|
||||
#define GL_TARGET_MAJOR_VERSION 0
|
||||
#define GL_TARGET_MINOR_VERSION 4
|
||||
|
||||
|
@ -77,6 +79,8 @@ struct graphic_stack_t {
|
|||
long buffer_plans_0_arrow;
|
||||
};
|
||||
|
||||
bool ui_setup_glarea(int target_mode, GtkWidget *target_widget);
|
||||
|
||||
/*
|
||||
* Dynamic array of ptrs to dynamically allocated gl_area_entry
|
||||
*/
|
||||
|
|
|
@ -111,12 +111,12 @@ int graphics_init(void *error_buffer)
|
|||
int cur_id = 0;
|
||||
struct graphic_stack_t *stack;
|
||||
|
||||
/* g_printerr("[debug] graphics_init()\n"); */
|
||||
g_printerr("[debug] graphics_init()\n");
|
||||
|
||||
if (graphic_stack == NULL) {
|
||||
graphic_stack = g_malloc0(sizeof(struct graphic_stack_t));
|
||||
graphic_stack_size = 1;
|
||||
/* g_printerr("[debug] graphics_init(): init graphic_stack @ %p\n", graphic_stack); */
|
||||
g_printerr("[debug] graphics_init(): init graphic_stack @ %p\n", graphic_stack);
|
||||
} else {
|
||||
// Check if there are free slots
|
||||
if (free_stack_slot_size) {
|
||||
|
@ -136,9 +136,9 @@ int graphics_init(void *error_buffer)
|
|||
|
||||
memset(&graphic_stack[cur_id], 0, sizeof(struct graphic_stack_t));
|
||||
|
||||
/* g_printerr("[debug] graphics_init() : graphic_stack (@0x%p) has %ld elements\n", */
|
||||
/* graphic_stack, */
|
||||
/* graphic_stack_size); */
|
||||
g_printerr("[debug] graphics_init() : graphic_stack (@0x%p) has %ld elements\n",
|
||||
graphic_stack,
|
||||
graphic_stack_size);
|
||||
|
||||
stack = &graphic_stack[cur_id];
|
||||
stack->id = cur_id;
|
||||
|
@ -147,11 +147,11 @@ int graphics_init(void *error_buffer)
|
|||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
|
||||
////////////////////////// if (!graphics_init_shaders(cur_id)) return -1;
|
||||
if (!graphics_init_shaders(cur_id)) return -1;
|
||||
|
||||
//print_stack(cur_id);
|
||||
print_stack(cur_id);
|
||||
|
||||
////////////////////////// graphics_init_buffers(cur_id);
|
||||
graphics_init_buffers(cur_id);
|
||||
|
||||
glDebugMessageCallback(graphics_debug_callback, NULL);
|
||||
|
||||
|
|
20
init.c
20
init.c
|
@ -119,12 +119,28 @@ bool graphics_init_shaders(const int stack_id)
|
|||
|
||||
// Link shaders to program
|
||||
program = glCreateProgram();
|
||||
printf("\n------------------------------------------------------------------------------------------\n");
|
||||
printf("[debug] graphics_init_shaders() : program = %d, vertex = %d, fragment = %d\n\
|
||||
exec > ** (myprogram:-----): WARNING ** : --:--:--:---: Linking failure: (address)\n",
|
||||
program, vertex, fragment);
|
||||
|
||||
/* (myprogram:11732): WARNING **: 10:37:34.233: v plusieurs 'run' successifs
|
||||
* (myprogram:11883): WARNING **: 10:38:22.979: glLinkProgram(program); < commenté
|
||||
* (myprogram:11953): WARNING **: 10:38:46.170:
|
||||
* (myprogram:12034): WARNING **: 10:39:14.709:
|
||||
* (myprogram:12182): WARNING **: 10:40:49.788:
|
||||
* > probablement la même adresse dans la librairie 'mesa' d'OpenGL (?) */
|
||||
|
||||
glAttachShader(program, vertex);
|
||||
glAttachShader(program, fragment);
|
||||
|
||||
glLinkProgram(program);
|
||||
printf("Failed to link the graphic stack to widgets ! <> see init.c graphics_init_shaders()\n");
|
||||
printf("the error in not : vertex shader lacks `main' but : failed to link... (comment line 140)\n");
|
||||
// https://registry.khronos.org/OpenGL-Refpages/gl4/html/glLinkProgram.xhtml
|
||||
// glLinkProgram(program); // Linking failure: (address)
|
||||
printf("------------------------------------------------------------------------------------------\n");
|
||||
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &status);
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &status); // Linking failure: (address)
|
||||
|
||||
if(status == GL_FALSE) {
|
||||
int log_len;
|
||||
|
|
Loading…
Reference in New Issue