From 0e3acf499a38dd4e47cc9a9e27ca7476eb934f72 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 8 Nov 2002 18:56:22 +0000 Subject: [PATCH] Introduce OpenGL display lists for drawing meshes. Does not seem to work much faster on my machine, though. --- Common/CommandLine.cpp | 6 +- Common/Context.h | 5 +- Common/DefaultOptions.h | 7 +- Common/Options.cpp | 204 +++++++++++++++++++++++++++++----------- Common/Options.h | 3 +- Fltk/Callbacks.cpp | 4 +- Graphics/Mesh.cpp | 28 ++++-- Graphics/Post.cpp | 8 +- Mesh/Generator.cpp | 6 +- 9 files changed, 194 insertions(+), 77 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 7037d756bf..10eb319395 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.4 2002-11-05 19:52:06 geuzaine Exp $ +// $Id: CommandLine.cpp,v 1.5 2002-11-08 18:56:21 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -475,10 +475,10 @@ void Get_Options (int argc, char *argv[], int *nbfiles) { CTX.db = 0; CTX.geom.highlight = 0; i++; } else if(!strcmp(argv[i]+1, "dl")){ - CTX.display_lists = 1; i++; + CTX.post.display_lists = 1; i++; } else if(!strcmp(argv[i]+1, "nodl")){ - CTX.display_lists = 0; i++; + CTX.post.display_lists = 0; i++; } else if(!strcmp(argv[i]+1, "fontsize")){ i++; diff --git a/Common/Context.h b/Common/Context.h index b525c438b8..72f0b8298a 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -97,7 +97,6 @@ public : int ortho; // orthogonal projection? int fast; // inhibit mesh and postpro drawing when changing r,s,t int command_win; // command window? - int display_lists; // use display lists? int axes, small_axes; // draw axes? int small_axes_pos[2]; // small axes position int threads, threads_lock; // threads?, lock (should be a mutex...) @@ -140,7 +139,7 @@ public : // mesh options struct { - int vis_type; + int vis_type, changed, display_lists; int draw; int points, lines, surfaces, volumes; int points_num, lines_num, surfaces_num, volumes_num; @@ -171,7 +170,7 @@ public : // post processing options struct{ List_T *list ; - int force_num, compute_bb; + int force_num, compute_bb, display_lists; int draw, scales, link ; int smooth, anim_cycle ; double anim_delay ; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 1000da684f..b9143edd51 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -412,8 +412,6 @@ StringXNumber GeneralOptions_Number[] = { { F|O, "DefaultPlugins" , opt_general_default_plugins , 1. , "Load default plugins on startup" }, - { F|O, "DisplayLists" , opt_general_display_lists , 0. , - "Use OpenGL display lists (useful with real time manipulation of 'big' post-processing views)" }, { F|O, "DoubleBuffer" , opt_general_double_buffer , 1. , "Use a double buffered graphic window (on Unix, should be set to 0 when working on a remote host without GLX)" }, @@ -665,6 +663,8 @@ StringXNumber MeshOptions_Number[] = { { F|O, "Degree" , opt_mesh_degree , 1. , "Element order" }, + { F|O, "DisplayLists" , opt_mesh_display_lists , 0. , + "Use OpenGL display lists for drawing meshes" }, { F|O, "Dual" , opt_mesh_dual , 0. , "Display the dual mesh obtained by barycentric subdivision" }, @@ -799,6 +799,9 @@ StringXNumber PostProcessingOptions_Number[] = { { F|O, "AnimationCycle" , opt_post_anim_cycle , 0. , "Cycle through views instead of time steps for the animation" }, + { F|O, "DisplayLists" , opt_post_display_lists , 0. , + "Use OpenGL display lists for drawing post-processing views" }, + { F|O, "Link" , opt_post_link , 0. , "Link post-processing views (0=none, 1,2=changes in visible/all, 3,4=everything in visible/all)" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 8592490bac..49af1a91d3 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.90 2002-11-08 07:27:57 geuzaine Exp $ +// $Id: Options.cpp,v 1.91 2002-11-08 18:56:21 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -1171,20 +1171,6 @@ double opt_general_sphere_subdivisions(OPT_ARGS_NUM){ CTX.sphere_subdivisions = (int)val; return CTX.sphere_subdivisions; } -double opt_general_display_lists(OPT_ARGS_NUM){ - int i; - if(action & GMSH_SET){ - CTX.display_lists = (int)val; - if(CTX.display_lists) - for(i=0 ; i<List_Nbr(CTX.post.list) ; i++) - ((Post_View*)List_Pointer_Test(CTX.post.list, i))->Changed = 1; - } -#ifdef _FLTK - if(WID && (action & GMSH_GUI)) - WID->gen_butt[4]->value(CTX.display_lists); -#endif - return CTX.display_lists; -} double opt_general_double_buffer(OPT_ARGS_NUM){ if(action & GMSH_SET){ CTX.db = (int)val; @@ -1690,8 +1676,10 @@ double opt_mesh_quality(OPT_ARGS_NUM){ return CTX.mesh.quality; } double opt_mesh_normals(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.normals = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[8]->value(CTX.mesh.normals); @@ -1699,8 +1687,10 @@ double opt_mesh_normals(OPT_ARGS_NUM){ return CTX.mesh.normals; } double opt_mesh_tangents(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.tangents = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[13]->value(CTX.mesh.tangents); @@ -1708,8 +1698,10 @@ double opt_mesh_tangents(OPT_ARGS_NUM){ return CTX.mesh.tangents; } double opt_mesh_explode(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.explode = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[9]->value(CTX.mesh.explode); @@ -1744,8 +1736,10 @@ double opt_mesh_rand_factor(OPT_ARGS_NUM){ return CTX.mesh.rand_factor; } double opt_mesh_gamma_inf(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.gamma_inf = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[4]->value(CTX.mesh.gamma_inf); @@ -1753,8 +1747,10 @@ double opt_mesh_gamma_inf(OPT_ARGS_NUM){ return CTX.mesh.gamma_inf; } double opt_mesh_gamma_sup(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.gamma_sup = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[5]->value(CTX.mesh.gamma_sup); @@ -1762,8 +1758,10 @@ double opt_mesh_gamma_sup(OPT_ARGS_NUM){ return CTX.mesh.gamma_sup; } double opt_mesh_radius_inf(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.radius_inf = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[6]->value(CTX.mesh.radius_inf); @@ -1771,8 +1769,10 @@ double opt_mesh_radius_inf(OPT_ARGS_NUM){ return CTX.mesh.radius_inf; } double opt_mesh_radius_sup(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.radius_sup = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[7]->value(CTX.mesh.radius_sup); @@ -1780,8 +1780,10 @@ double opt_mesh_radius_sup(OPT_ARGS_NUM){ return CTX.mesh.radius_sup; } double opt_mesh_points(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.points = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[6]->value(CTX.mesh.points); @@ -1789,8 +1791,10 @@ double opt_mesh_points(OPT_ARGS_NUM){ return CTX.mesh.points; } double opt_mesh_lines(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.lines = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[7]->value(CTX.mesh.lines); @@ -1798,8 +1802,10 @@ double opt_mesh_lines(OPT_ARGS_NUM){ return CTX.mesh.lines; } double opt_mesh_surfaces(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.surfaces = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[8]->value(CTX.mesh.surfaces); @@ -1807,8 +1813,10 @@ double opt_mesh_surfaces(OPT_ARGS_NUM){ return CTX.mesh.surfaces; } double opt_mesh_volumes(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.volumes = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[9]->value(CTX.mesh.volumes); @@ -1816,8 +1824,10 @@ double opt_mesh_volumes(OPT_ARGS_NUM){ return CTX.mesh.volumes; } double opt_mesh_points_num(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.points_num = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[10]->value(CTX.mesh.points_num); @@ -1825,8 +1835,10 @@ double opt_mesh_points_num(OPT_ARGS_NUM){ return CTX.mesh.points_num; } double opt_mesh_lines_num(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.lines_num = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[11]->value(CTX.mesh.lines_num); @@ -1834,8 +1846,10 @@ double opt_mesh_lines_num(OPT_ARGS_NUM){ return CTX.mesh.lines_num; } double opt_mesh_surfaces_num(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.surfaces_num = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[12]->value(CTX.mesh.surfaces_num); @@ -1843,8 +1857,10 @@ double opt_mesh_surfaces_num(OPT_ARGS_NUM){ return CTX.mesh.surfaces_num; } double opt_mesh_volumes_num(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.volumes_num = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[13]->value(CTX.mesh.volumes_num); @@ -1852,8 +1868,10 @@ double opt_mesh_volumes_num(OPT_ARGS_NUM){ return CTX.mesh.volumes_num; } double opt_mesh_point_size(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.point_size = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[10]->value(CTX.mesh.point_size); @@ -1863,6 +1881,7 @@ double opt_mesh_point_size(OPT_ARGS_NUM){ double opt_mesh_point_type(OPT_ARGS_NUM){ if(action & GMSH_SET){ CTX.mesh.point_type = (int)val; + CTX.mesh.changed = 1; } #ifdef _FLTK if(WID && (action & GMSH_GUI)){ @@ -1872,8 +1891,10 @@ double opt_mesh_point_type(OPT_ARGS_NUM){ return CTX.mesh.point_type; } double opt_mesh_line_width(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.line_width = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_value[11]->value(CTX.mesh.line_width); @@ -1887,6 +1908,7 @@ double opt_mesh_aspect(OPT_ARGS_NUM){ case 2 : CTX.mesh.hidden = 1; CTX.mesh.shade = 1; break ; default : CTX.mesh.hidden = CTX.mesh.shade = 0; break ; } + CTX.mesh.changed = 1; } #ifdef _FLTK if(WID && (action & GMSH_GUI)){ @@ -1959,8 +1981,10 @@ double opt_mesh_degree(OPT_ARGS_NUM){ return CTX.mesh.degree; } double opt_mesh_dual(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.dual = (int)val; + CTX.mesh.changed = 1; + } return CTX.mesh.dual; } double opt_mesh_interactive(OPT_ARGS_NUM){ @@ -2021,8 +2045,10 @@ double opt_mesh_color_scheme(OPT_ARGS_NUM){ return CTX.mesh.color_scheme; } double opt_mesh_color_carousel(OPT_ARGS_NUM){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.mesh.color_carousel = (int)val; + CTX.mesh.changed = 1; + } #ifdef _FLTK if(WID && (action & GMSH_GUI)) WID->mesh_butt[17]->value(CTX.mesh.color_carousel); @@ -2069,6 +2095,18 @@ double opt_mesh_cpu_time(OPT_ARGS_NUM){ GetStatistics(s); return s[13]+s[14]+s[15]; } +double opt_mesh_display_lists(OPT_ARGS_NUM){ + int i; + if(action & GMSH_SET){ + CTX.mesh.display_lists = (int)val; + CTX.mesh.changed = 1; + } +#ifdef _FLTK + //if(WID && (action & GMSH_GUI)) + //WID->mesh_butt[??]->value(CTX.mesh.display_lists); +#endif + return CTX.mesh.display_lists; +} double opt_solver_client_server(OPT_ARGS_NUM){ @@ -2122,6 +2160,20 @@ double opt_solver_merge_views2(OPT_ARGS_NUM){ return opt_solver_merge_views(2,ac double opt_solver_merge_views3(OPT_ARGS_NUM){ return opt_solver_merge_views(3,action,val); } double opt_solver_merge_views4(OPT_ARGS_NUM){ return opt_solver_merge_views(4,action,val); } +double opt_post_display_lists(OPT_ARGS_NUM){ + int i; + if(action & GMSH_SET){ + CTX.post.display_lists = (int)val; + if(CTX.post.display_lists) + for(i=0 ; i<List_Nbr(CTX.post.list) ; i++) + ((Post_View*)List_Pointer_Test(CTX.post.list, i))->Changed = 1; + } +#ifdef _FLTK + if(WID && (action & GMSH_GUI)) + WID->gen_butt[4]->value(CTX.post.display_lists); +#endif + return CTX.post.display_lists; +} double opt_post_scales(OPT_ARGS_NUM){ if(action & GMSH_SET) CTX.post.scales = (int)val; @@ -3103,168 +3155,210 @@ unsigned int opt_geometry_color_normals(OPT_ARGS_COL){ return CTX.color.geom.normals; } unsigned int opt_mesh_color_points(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.vertex = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.vertex,WID->mesh_col[0]); #endif return CTX.color.mesh.vertex; } unsigned int opt_mesh_color_points_supp(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.vertex_supp = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.vertex_supp,WID->mesh_col[1]); #endif return CTX.color.mesh.vertex_supp; } unsigned int opt_mesh_color_lines(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.line = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.line,WID->mesh_col[2]); #endif return CTX.color.mesh.line; } unsigned int opt_mesh_color_triangles(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.triangle = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.triangle,WID->mesh_col[3]); #endif return CTX.color.mesh.triangle; } unsigned int opt_mesh_color_quadrangles(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.quadrangle = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.quadrangle,WID->mesh_col[4]); #endif return CTX.color.mesh.quadrangle; } unsigned int opt_mesh_color_tetrahedra(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.tetrahedron = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.tetrahedron,WID->mesh_col[5]); #endif return CTX.color.mesh.tetrahedron; } unsigned int opt_mesh_color_hexahedra(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.hexahedron = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.hexahedron,WID->mesh_col[6]); #endif return CTX.color.mesh.hexahedron; } unsigned int opt_mesh_color_prisms(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.prism = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.prism,WID->mesh_col[7]); #endif return CTX.color.mesh.prism; } unsigned int opt_mesh_color_pyramid(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.pyramid = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.pyramid,WID->mesh_col[8]); #endif return CTX.color.mesh.pyramid; } unsigned int opt_mesh_color_tangents(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.tangents = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.tangents,WID->mesh_col[9]); #endif return CTX.color.mesh.tangents; } unsigned int opt_mesh_color_normals(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.normals = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.normals,WID->mesh_col[10]); #endif return CTX.color.mesh.normals; } unsigned int opt_mesh_color_1(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[0] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[0],WID->mesh_col[11]); #endif return CTX.color.mesh.carousel[0]; } unsigned int opt_mesh_color_2(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[1] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[1],WID->mesh_col[12]); #endif return CTX.color.mesh.carousel[1]; } unsigned int opt_mesh_color_3(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[2] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[2],WID->mesh_col[13]); #endif return CTX.color.mesh.carousel[2]; } unsigned int opt_mesh_color_4(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[3] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[3],WID->mesh_col[14]); #endif return CTX.color.mesh.carousel[3]; } unsigned int opt_mesh_color_5(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[4] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[4],WID->mesh_col[15]); #endif return CTX.color.mesh.carousel[4]; } unsigned int opt_mesh_color_6(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[5] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[5],WID->mesh_col[16]); #endif return CTX.color.mesh.carousel[5]; } unsigned int opt_mesh_color_7(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[6] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[6],WID->mesh_col[17]); #endif return CTX.color.mesh.carousel[6]; } unsigned int opt_mesh_color_8(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[7] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[7],WID->mesh_col[18]); #endif return CTX.color.mesh.carousel[7]; } unsigned int opt_mesh_color_9(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[8] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[8],WID->mesh_col[19]); #endif return CTX.color.mesh.carousel[8]; } unsigned int opt_mesh_color_10(OPT_ARGS_COL){ - if(action & GMSH_SET) + if(action & GMSH_SET){ CTX.color.mesh.carousel[9] = val; + CTX.mesh.changed = 1; + } #ifdef _FLTK CCC(CTX.color.mesh.carousel[9],WID->mesh_col[20]); #endif diff --git a/Common/Options.h b/Common/Options.h index fc134dd254..3b82da7006 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -229,7 +229,6 @@ double opt_general_small_axes(OPT_ARGS_NUM); double opt_general_small_axes_position0(OPT_ARGS_NUM); double opt_general_small_axes_position1(OPT_ARGS_NUM); double opt_general_sphere_subdivisions(OPT_ARGS_NUM); -double opt_general_display_lists(OPT_ARGS_NUM); double opt_general_double_buffer(OPT_ARGS_NUM); double opt_general_alpha_blending(OPT_ARGS_NUM); double opt_general_trackball(OPT_ARGS_NUM); @@ -364,6 +363,7 @@ double opt_mesh_nb_hexahedra(OPT_ARGS_NUM); double opt_mesh_nb_prisms(OPT_ARGS_NUM); double opt_mesh_nb_pyramids(OPT_ARGS_NUM); double opt_mesh_cpu_time(OPT_ARGS_NUM); +double opt_mesh_display_lists(OPT_ARGS_NUM); double opt_solver_client_server(OPT_ARGS_NUM); double opt_solver_client_server0(OPT_ARGS_NUM); double opt_solver_client_server1(OPT_ARGS_NUM); @@ -382,6 +382,7 @@ double opt_solver_merge_views1(OPT_ARGS_NUM); double opt_solver_merge_views2(OPT_ARGS_NUM); double opt_solver_merge_views3(OPT_ARGS_NUM); double opt_solver_merge_views4(OPT_ARGS_NUM); +double opt_post_display_lists(OPT_ARGS_NUM); double opt_post_scales(OPT_ARGS_NUM); double opt_post_link(OPT_ARGS_NUM); double opt_post_smooth(OPT_ARGS_NUM); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 6040b9f532..14c21c3a31 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.149 2002-11-08 02:06:59 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.150 2002-11-08 18:56:21 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -611,7 +611,7 @@ void opt_general_ok_cb(CALLBACK_ARGS){ opt_general_fast_redraw(0, GMSH_SET, WID->gen_butt[2]->value()); if(opt_general_double_buffer(0, GMSH_GET, 0) != WID->gen_butt[3]->value()) opt_general_double_buffer(0, GMSH_SET, WID->gen_butt[3]->value()); - opt_general_display_lists(0, GMSH_SET, WID->gen_butt[4]->value()); + opt_post_display_lists(0, GMSH_SET, WID->gen_butt[4]->value());//this has to move opt_general_alpha_blending(0, GMSH_SET, WID->gen_butt[5]->value()); opt_general_trackball(0, GMSH_SET, WID->gen_butt[6]->value()); opt_general_terminal(0, GMSH_SET, WID->gen_butt[7]->value()); diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index 3a7856cb8c..fc29a07b9e 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.53 2002-11-08 02:06:59 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.54 2002-11-08 18:56:21 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -121,27 +121,43 @@ void Draw_Mesh (Mesh *M) { if(CTX.mesh.draw && CTX.render_mode != GMSH_SELECT){ + static int first = 1, listnum; + if(CTX.mesh.display_lists && CTX.mesh.changed){ + if(first) listnum = glGenLists(1); + first = 0; + printf("new list!\n"); + glNewList(listnum, GL_COMPILE); + } + if(M->status >= 3 && (CTX.mesh.volumes || CTX.mesh.volumes_num)){ Tree_Action(M->Volumes, Draw_Mesh_Volumes); } - + if(M->status >= 2 && (CTX.mesh.surfaces || CTX.mesh.surfaces_num)){ Tree_Action(M->Surfaces, Draw_Mesh_Surfaces); if(CTX.mesh.oldxtrude)//old extrusion algo - Tree_Action(M->Volumes, Draw_Mesh_Extruded_Surfaces); + Tree_Action(M->Volumes, Draw_Mesh_Extruded_Surfaces); } - + if(M->status >= 1 && (CTX.mesh.lines || CTX.mesh.lines_num)){ Tree_Action(M->Curves, Draw_Mesh_Curves); DrawVertexSupp = 1 ; Tree_Action(M->VertexEdges, Draw_Mesh_Points); } - + if(M->status >= 0 && (CTX.mesh.points || CTX.mesh.points_num)){ DrawVertexSupp = 0 ; Tree_Action(M->Vertices, Draw_Mesh_Points); } - + + if(CTX.mesh.display_lists){ + if(CTX.mesh.changed){ + glEndList(); + CTX.mesh.changed=0; + } + glCallList(listnum); + } + } if(M->status >= 0){ diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 5f2ae6d613..7b72f473fd 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.42 2002-11-06 02:52:37 geuzaine Exp $ +// $Id: Post.cpp,v 1.43 2002-11-08 18:56:21 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -377,7 +377,7 @@ void Draw_Post(void){ } - if(CTX.display_lists && !v->Changed && v->DisplayListNum>0){ + if(CTX.post.display_lists && !v->Changed && v->DisplayListNum>0){ Msg(DEBUG, "Call display List %d", v->DisplayListNum); glCallList(v->DisplayListNum); @@ -385,7 +385,7 @@ void Draw_Post(void){ } else{ - if(CTX.display_lists){ + if(CTX.post.display_lists){ if(v->DisplayListNum>0){ Msg(DEBUG, "Delete display List %d", v->DisplayListNum); glDeleteLists(v->DisplayListNum,1); @@ -517,7 +517,7 @@ void Draw_Post(void){ Draw_Text2D3D(3, v->TimeStep, v->NbT3, v->T3D, v->T3C); } - if(CTX.display_lists) glEndList(); + if(CTX.post.display_lists) glEndList(); v->Changed=0; diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index 9c9226ea82..b1da974bee 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.36 2002-05-20 18:28:27 geuzaine Exp $ +// $Id: Generator.cpp,v 1.37 2002-11-08 18:56:22 geuzaine Exp $ // // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // @@ -231,6 +231,8 @@ void Init_Mesh (Mesh * M, int all){ M->BGM.bgm = NULL; M->status = 0; + + CTX.mesh.changed = 1; } void mai3d (Mesh * M, int Asked){ @@ -306,5 +308,7 @@ void mai3d (Mesh * M, int Asked){ Msg(STATUS2, "Mesh 3D complete (%g s)", t2 - t1); M->status = 3; } + CTX.threads_lock = 0 ; + CTX.mesh.changed = 1; } -- GitLab