From df1e16174c84ab5eeed3425fbbc3e6fcac986350 Mon Sep 17 00:00:00 2001 From: arif Date: Tue, 5 May 2009 21:35:33 +0000 Subject: [PATCH] command line bug is fixed, hopefully ubuntu glutinit bug is fixed too --- cmd/smyrna/gltemplate.c | 20 +++++++++++++++++--- cmd/smyrna/main.c | 10 +++++++--- cmd/smyrna/smyrnadefs.h | 2 ++ cmd/smyrna/topfisheyeview.c | 24 ++++++++---------------- cmd/smyrna/viewport.c | 21 +++++++++------------ 5 files changed, 43 insertions(+), 34 deletions(-) diff --git a/cmd/smyrna/gltemplate.c b/cmd/smyrna/gltemplate.c index 44a11d76f..82e4d0607 100755 --- a/cmd/smyrna/gltemplate.c +++ b/cmd/smyrna/gltemplate.c @@ -165,6 +165,8 @@ static void realize(GtkWidget * widget, gpointer data) // glEnable(GL_LINE_SMOOTH); gdk_gl_drawable_gl_end(gldrawable); + + /*** OpenGL END ***/ return; } @@ -207,7 +209,9 @@ static gboolean configure_event(GtkWidget * widget, glMatrixMode(GL_MODELVIEW); gdk_gl_drawable_gl_end(gldrawable); /*** OpenGL END ***/ - return TRUE; + + + return TRUE; } /* @@ -220,12 +224,14 @@ gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, { GdkGLContext *glcontext = gtk_widget_get_gl_context(widget); GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget); + + /*** OpenGL BEGIN ***/ if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext)) return FALSE; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); - glexpose_main(view); //draw all stuff + glexpose_main(view); //draw all stuff /* Swap buffers */ if (gdk_gl_drawable_is_double_buffered(gldrawable)) gdk_gl_drawable_swap_buffers(gldrawable); @@ -233,7 +239,15 @@ gboolean expose_event(GtkWidget * widget, GdkEventExpose * event, glFlush(); gdk_gl_drawable_gl_end(gldrawable); /*** OpenGL END ***/ - return TRUE; + if (view->initFile) + { + view->initFile=0; + if (view->activeGraph == 0) + close_graph(view,0); + add_graph_to_viewport_from_file(view->initFileName); + } + + return TRUE; } #ifdef UNUSED diff --git a/cmd/smyrna/main.c b/cmd/smyrna/main.c index bd5b25222..727175d66 100755 --- a/cmd/smyrna/main.c +++ b/cmd/smyrna/main.c @@ -183,15 +183,19 @@ int main(int argc, char *argv[]) g_signal_connect((gpointer) gladewidget, "destroy", G_CALLBACK(mQuitSlot), NULL); glade_xml_signal_autoconnect(xml); - gtk_gl_init(0, 0); + if (initFileName) + { + view->initFile=1; + view->initFileName=strdup(initFileName); + } + gtk_gl_init(0, 0); /* Configure OpenGL framebuffer. */ glconfig = configure_gl(); gladewidget = glade_xml_get_widget(xml, "vbox2"); create_window(glconfig, gladewidget); - if (initFileName) - add_graph_to_viewport_from_file(initFileName); change_cursor(GDK_TOP_LEFT_ARROW); + glutInit(&argc,&argv); gtk_main(); diff --git a/cmd/smyrna/smyrnadefs.h b/cmd/smyrna/smyrnadefs.h index 09a580c95..c84b67bca 100644 --- a/cmd/smyrna/smyrnadefs.h +++ b/cmd/smyrna/smyrnadefs.h @@ -530,6 +530,8 @@ typedef struct _ViewInfo int visiblenodecount; /*helper variable to know the number of the nodes being rendered, good data to optimize speed*/ md5_byte_t orig_key[16] ; /*md5 result for original graph*/ md5_byte_t final_key[16] ; /*md5 result right before graph is saved*/ + char* initFileName; //file name from command line + int initFile; } ViewInfo; diff --git a/cmd/smyrna/topfisheyeview.c b/cmd/smyrna/topfisheyeview.c index 19bdcbf40..e6e2bcdbd 100644 --- a/cmd/smyrna/topfisheyeview.c +++ b/cmd/smyrna/topfisheyeview.c @@ -37,7 +37,7 @@ static int get_temp_coords(topview* t,int level,int v,double* coord_x,double* co #ifdef UNUSED static int get_temp_coords2(topview* t,int level,int v,double* coord_x,double* coord_y,float *R,float *G,float *B); #endif -static int FLUSH=0; +static int FLUSH=1; static void color_interpolation(glCompColor srcColor,glCompColor tarColor,glCompColor* color,int levelcount,int level) { @@ -518,22 +518,15 @@ void drawtopfishedges(topview * t) void drawtopologicalfisheye(topview * t) { - get_active_frame(t); - drawtopfishnodes(t); -// drawtopologicalfisheyestatic(t); - - drawtopfishedges(t); - if(!t->animate) - drawtopfishnodelabels(t); - - -/* if (FLUSH==1) + if (FLUSH==1) { + get_active_frame(t); + drawtopfishnodes(t); + drawtopfishedges(t); + if(!t->animate) + drawtopfishnodelabels(t); FLUSH=0; - expose_event(view->drawing_area, NULL, NULL); - ; - }*/ - + } } @@ -736,7 +729,6 @@ int get_active_frame(topview* t) { g_timer_stop(view->timer); view->Topview->animate=0; - FLUSH=1; return 0; } diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 9bfe96def..08b2a4bda 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -312,9 +312,8 @@ set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g) //FIXME: I don't think an openGL function can be called before it // is initialized. -#ifdef _WIN32 - glClearColor(view->bgColor.R, view->bgColor.G, view->bgColor.B, view->bgColor.A); //background color -#endif + if (view->graphCount > 0) + glClearColor(view->bgColor.R, view->bgColor.G, view->bgColor.B, view->bgColor.A); //background color } static gboolean gl_main_expose(gpointer data) { @@ -678,7 +677,8 @@ int add_graph_to_viewport_from_file(char *fileName) //returns 1 if successfull else 0 int ind=0; Agraph_t *graph; - graph = loadGraph(fileName); + + graph = loadGraph(fileName); if (graph) { view->graphCount = view->graphCount + 1; view->g = @@ -686,22 +686,19 @@ int add_graph_to_viewport_from_file(char *fileName) sizeof(Agraph_t *) * view->graphCount); view->g[view->graphCount - 1] = graph; view->activeGraph = view->graphCount - 1; - //GUI update , graph combo box on top-right should be updated load_settings_from_graph(view->g[view->activeGraph]); update_graph_from_settings(view->g[view->activeGraph]); set_viewport_settings_from_template(view, view->g[view->activeGraph]); fill_key(view->orig_key,get_md5_key(graph)); - printf ("graph original identification:"); - for (ind=0;ind < 16;ind ++) - { - printf ("%x ",view->orig_key[ind]); - } - + expose_event(view->drawing_area, NULL, NULL); return 1; } else - return 0; + { + return 0; + + } } -- 2.40.0