[Gmsh] Antialiasing gmsh2
Christophe Geuzaine
cgeuzaine at ulg.ac.be
Thu Jan 18 15:39:45 CET 2007
Kubicek Bernhard wrote:
> Hello!
>
> While playing around with the gmsh-2.0.0-nightly-20070117 source, I
> found that at least on my system (Ubuntu-x86 dapper, nvidia) enabling
> antialiasing leads to nicer/smoother look in the gmsh-OpenGL window. A
> drawback might be slower rendering time. Attached are two PNGs showing
> the difference.
Nice! I've merged a modified patch in cvs (with a button to control the
behavior in the gui).
Thanks,
Christophe
>
> To do so, one needs to change the sourcecode and recompile.
>
> In the file Fltk/GUI.cpp, after line 1445, change the code to (basically
> just inserting FL_MULTISAMPLE):
> ----
> // opengl window
>
> g_opengl_window = new Opengl_Window(0, 0, width, glheight);
> g_opengl_window->mode(FL_RGB | FL_DEPTH | FL_MULTISAMPLE |
> FL_DOUBLE ); //enable antialiasing
> if(!opt_general_double_buffer(0, GMSH_GET, 0)) {
> Msg(INFO, "Setting OpenGL visual to single buffered");
> g_opengl_window->mode(FL_RGB | FL_DEPTH | FL_MULTISAMPLE | FL_SINGLE
> ); //enable antialiasing
> }
> ----
>
> However for being able to switch between single and double buffered
> display without loosing the antialiasing, also Common/Options.cpp needs
> to changed similarly:
> ----
> double opt_general_double_buffer(OPT_ARGS_NUM)
> {
> if(action & GMSH_SET) {
> CTX.db = (int)val;
> #if defined(HAVE_FLTK)
> if(WID) {
> if(CTX.db) {
> Msg(INFO, "Setting OpenGL visual to double buffered");
> WID->g_opengl_window->mode(FL_RGB | FL_DEPTH | FL_MULTISAMPLE |
> FL_DOUBLE); //enable antialiasing
> }
> else {
> Msg(INFO, "Setting OpenGL visual to single buffered");
> WID->g_opengl_window->mode(FL_RGB | FL_DEPTH | FL_MULTISAMPLE |
> FL_SINGLE);//enable antialiasing
> }
> }
> #endif
> }
> #if defined(HAVE_FLTK)
> if(WID && (action & GMSH_GUI))
> WID->gen_butt[3]->value(CTX.db);
> #endif
> return CTX.db;
> }
> ----
> For productive usage, one probably could include a preprocessor switch
> or a GUI element similar to the double-buffering switch.
>
> Nice greetings,
> Bernhard
>
>
> /------
> | freelancer at Arsenal Research, Vienna, Austria http://arsenal.ac.at/
> | PhD at Vienna University of Technology, Austria
> | http://www.phdcomics.com/comics/archive.php?comicid=180
> \------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine