diff --git a/libsrc/visualization/mvdraw.cpp b/libsrc/visualization/mvdraw.cpp index 65b89b05..dd0ef5e7 100644 --- a/libsrc/visualization/mvdraw.cpp +++ b/libsrc/visualization/mvdraw.cpp @@ -494,8 +494,6 @@ namespace netgen void VisualScene :: CreateTexture (int ncols, int linear, double alpha, int typ) { if (linear) ncols = 32; - else ncols = 8; - if (ntexcols != ncols) { @@ -576,7 +574,7 @@ namespace netgen { if (!vispar.drawcolorbar) return; - CreateTexture (8, linear, 1, GL_DECAL); + CreateTexture (GetVSSolution().numtexturecols, linear, 1, GL_DECAL); if (logscale && maxval <= 0) maxval = 1; if (logscale && minval <= 0) minval = 1e-4 * maxval; diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 0af2f5ad..4ff8a97f 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -61,6 +61,7 @@ namespace netgen clipplane_isolinelist = 0; surface_vector_list = 0; isosurface_list = 0; + numtexturecols = 8; fieldlineslist = 0; pointcurvelist = 0; @@ -387,7 +388,7 @@ namespace netgen BuildScene(); - CreateTexture (numtexturecols, lineartexture, 0.5, GL_MODULATE); + CreateTexture (GetVSSolution().numtexturecols, lineartexture, 0.5, GL_MODULATE); glClearColor(backcolor, backcolor, backcolor, 1); // glClearColor(backcolor, backcolor, backcolor, 0); diff --git a/ng/ngvisual.tcl b/ng/ngvisual.tcl index f2dcc498..99441f57 100644 --- a/ng/ngvisual.tcl +++ b/ng/ngvisual.tcl @@ -1282,6 +1282,13 @@ proc visual_dialog { } { -validatecommand "Ng_Vis_Set parameters; redraw;my_validatespinbox %W %P 10" \ -command "Ng_Vis_Set parameters; redraw;" \ -invalidcommand "my_invalidspinbox %W;Ng_Vis_Set parameters; redraw" -from -1e10 -to 1e10 -increment 0.001 + + + ttk::label $w.as.lncols -text "N Colors" + ttk::spinbox $w.as.snumcols -textvariable visoptions.numtexturecols -width 5 -validate focus \ + -command "Ng_Vis_Set parameters; redraw;" \ + -from 2 -to 31 -increment 1 + #tixControl $w.as.minval -label "Min-value: " -integer false \ -variable visoptions.mminval \ @@ -1301,7 +1308,7 @@ proc visual_dialog { } { # } pack $w.as -fill x -pady 5 -ipady 3 - grid $w.as.autoscale $w.as.lmin $w.as.smin $w.as.lmax $w.as.smax -sticky nw -padx 4 + grid $w.as.autoscale $w.as.lmin $w.as.smin $w.as.lmax $w.as.smax $w.as.lncols $w.as.snumcols -sticky nw -padx 4 grid columnconfigure $w.as 0 -pad 20 grid columnconfigure $w.as 2 -pad 20 grid anchor $w.as center @@ -1592,11 +1599,6 @@ proc visual_dialog { } { ttk::checkbutton $w.fcb.cb.lineartexture -text "Use Linear Texture" \ -variable visoptions.lineartexture \ -command { Ng_Vis_Set parameters; redraw } - - scale $w.numcols -orient horizontal -length 100 -from 0 -to 50 \ - -resolution 1 \ - -variable visoptions.numtexturecols \ - -command { popupcheckredraw visual_dialog_pop1 } ttk::checkbutton $w.fcb.cb.showclipsolution -text "Draw Clipping Plane Solution" \ -variable visoptions.showclipsolution \ diff --git a/ng/onetcl.cpp b/ng/onetcl.cpp index c104b543..eb19c92e 100644 --- a/ng/onetcl.cpp +++ b/ng/onetcl.cpp @@ -279,7 +279,7 @@ DLL_HEADER const char * ngscript[] = {"" ,"set visoptions.invcolor 0\n" ,"set visoptions.imaginary 0\n" ,"set visoptions.lineartexture 0\n" -,"set visoptions.numtexturecols 16\n" +,"set visoptions.numtexturecols 8\n" ,"set visoptions.showclipsolution 1\n" ,"set visoptions.showsurfacesolution 0\n" ,"set visoptions.drawfieldlines 0\n" @@ -5218,8 +5218,12 @@ DLL_HEADER const char * ngscript[] = {"" ,"-validatecommand \"Ng_Vis_Set parameters; redraw;my_validatespinbox %W %P 10\" \\\n" ,"-command \"Ng_Vis_Set parameters; redraw;\" \\\n" ,"-invalidcommand \"my_invalidspinbox %W;Ng_Vis_Set parameters; redraw\" -from -1e10 -to 1e10 -increment 0.001\n" +,"ttk::label $w.as.lncols -text \"N Colors\"\n" +,"ttk::spinbox $w.as.snumcols -textvariable visoptions.numtexturecols -width 5 -validate focus \\\n" +,"-command \"Ng_Vis_Set parameters; redraw;\" \\\n" +,"-from 2 -to 31 -increment 1\n" ,"pack $w.as -fill x -pady 5 -ipady 3\n" -,"grid $w.as.autoscale $w.as.lmin $w.as.smin $w.as.lmax $w.as.smax -sticky nw -padx 4\n" +,"grid $w.as.autoscale $w.as.lmin $w.as.smin $w.as.lmax $w.as.smax $w.as.lncols $w.as.snumcols -sticky nw -padx 4\n" ,"grid columnconfigure $w.as 0 -pad 20\n" ,"grid columnconfigure $w.as 2 -pad 20\n" ,"grid anchor $w.as center\n" @@ -5410,10 +5414,6 @@ DLL_HEADER const char * ngscript[] = {"" ,"ttk::checkbutton $w.fcb.cb.lineartexture -text \"Use Linear Texture\" \\\n" ,"-variable visoptions.lineartexture \\\n" ,"-command { Ng_Vis_Set parameters; redraw }\n" -,"scale $w.numcols -orient horizontal -length 100 -from 0 -to 50 \\\n" -,"-resolution 1 \\\n" -,"-variable visoptions.numtexturecols \\\n" -,"-command { popupcheckredraw visual_dialog_pop1 }\n" ,"ttk::checkbutton $w.fcb.cb.showclipsolution -text \"Draw Clipping Plane Solution\" \\\n" ,"-variable visoptions.showclipsolution \\\n" ,"-command { Ng_Vis_Set parameters; redraw }\n" diff --git a/ng/variables.tcl b/ng/variables.tcl index cdc95856..cc7042fc 100644 --- a/ng/variables.tcl +++ b/ng/variables.tcl @@ -273,7 +273,7 @@ set visoptions.usetexture 1 set visoptions.invcolor 0 set visoptions.imaginary 0 set visoptions.lineartexture 0 -set visoptions.numtexturecols 16 +set visoptions.numtexturecols 8 set visoptions.showclipsolution 1 set visoptions.showsurfacesolution 0 set visoptions.drawfieldlines 0