Skip to content
Snippets Groups Projects
Commit 86c1b666 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Perf. improvement without display lists

parent a7eeed9b
No related branches found
No related tags found
No related merge requests found
// $Id: Options.cpp,v 1.34 2001-07-30 18:34:26 geuzaine Exp $ // $Id: Options.cpp,v 1.35 2001-07-30 20:22:55 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -738,8 +738,13 @@ double opt_general_small_axes(OPT_ARGS_NUM){ ...@@ -738,8 +738,13 @@ double opt_general_small_axes(OPT_ARGS_NUM){
return CTX.small_axes; return CTX.small_axes;
} }
double opt_general_display_lists(OPT_ARGS_NUM){ double opt_general_display_lists(OPT_ARGS_NUM){
if(action & GMSH_SET) int i;
if(action & GMSH_SET){
CTX.display_lists = (int)val; CTX.display_lists = (int)val;
if(CTX.display_lists)
for(i=0 ; i<List_Nbr(Post_ViewList) ; i++)
((Post_View*)List_Pointer_Test(Post_ViewList, i))->Changed = 1;
}
#ifdef _FLTK #ifdef _FLTK
if(WID && (action & GMSH_GUI)) if(WID && (action & GMSH_GUI))
WID->gen_butt[4]->value(CTX.display_lists); WID->gen_butt[4]->value(CTX.display_lists);
......
// $Id: Post.cpp,v 1.18 2001-07-30 18:34:26 geuzaine Exp $ // $Id: Post.cpp,v 1.19 2001-07-30 20:22:55 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -275,12 +275,15 @@ void Draw_Post (void) { ...@@ -275,12 +275,15 @@ void Draw_Post (void) {
if(v->NbST && v->DrawTriangles && v->DrawScalars){ if(v->NbST && v->DrawTriangles && v->DrawScalars){
nb = List_Nbr(v->ST) / v->NbST ; nb = List_Nbr(v->ST) / v->NbST ;
if(v->Light && v->SmoothNormals){ //two passes if(v->Light && v->SmoothNormals){ //two passes
for(i = 0 ; i < List_Nbr(v->ST) ; i+=nb) if(v->Changed){
Draw_ScalarTriangle(v, 1, ValMin, ValMax, Raise, Msg(DEBUG, "Preprocessing of triangle normals in view %d", v->Num);
(double*)List_Pointer_Fast(v->ST,i), for(i = 0 ; i < List_Nbr(v->ST) ; i+=nb)
(double*)List_Pointer_Fast(v->ST,i+3), Draw_ScalarTriangle(v, 1, ValMin, ValMax, Raise,
(double*)List_Pointer_Fast(v->ST,i+6), (double*)List_Pointer_Fast(v->ST,i),
(double*)List_Pointer_Fast(v->ST,i+9)); (double*)List_Pointer_Fast(v->ST,i+3),
(double*)List_Pointer_Fast(v->ST,i+6),
(double*)List_Pointer_Fast(v->ST,i+9));
}
for(i = 0 ; i < List_Nbr(v->ST) ; i+=nb) for(i = 0 ; i < List_Nbr(v->ST) ; i+=nb)
Draw_ScalarTriangle(v, 0, ValMin, ValMax, Raise, Draw_ScalarTriangle(v, 0, ValMin, ValMax, Raise,
(double*)List_Pointer_Fast(v->ST,i), (double*)List_Pointer_Fast(v->ST,i),
...@@ -317,25 +320,19 @@ void Draw_Post (void) { ...@@ -317,25 +320,19 @@ void Draw_Post (void) {
} }
// Tetrahedra // Tetrahedra
/*
Modif Jf :
IsoSurfaces are really better rendered with smooth shading.
My idea is first to transform the scalar simplex map on a
scalar triangle map. This map has to be changed each time
the number of iso-surfaces is changed.
*/
if(v->NbSS && v->DrawTetrahedra && v->DrawScalars){ if(v->NbSS && v->DrawTetrahedra && v->DrawScalars){
nb = List_Nbr(v->SS) / v->NbSS ; nb = List_Nbr(v->SS) / v->NbSS ;
if(v->Light && v->SmoothNormals){ //two passes if(v->Light && v->SmoothNormals){ //two passes
for(i = 0 ; i < List_Nbr(v->SS) ; i+=nb) if(v->Changed){
Draw_ScalarTetrahedron(v, 1, ValMin, ValMax, Raise, Msg(DEBUG, "Preprocessing of tets normals in view %d", v->Num);
(double*)List_Pointer_Fast(v->SS,i), for(i = 0 ; i < List_Nbr(v->SS) ; i+=nb)
(double*)List_Pointer_Fast(v->SS,i+4), Draw_ScalarTetrahedron(v, 1, ValMin, ValMax, Raise,
(double*)List_Pointer_Fast(v->SS,i+8), (double*)List_Pointer_Fast(v->SS,i),
(double*)List_Pointer_Fast(v->SS,i+12)); (double*)List_Pointer_Fast(v->SS,i+4),
(double*)List_Pointer_Fast(v->SS,i+8),
(double*)List_Pointer_Fast(v->SS,i+12));
}
for(i = 0 ; i < List_Nbr(v->SS) ; i+=nb) for(i = 0 ; i < List_Nbr(v->SS) ; i+=nb)
Draw_ScalarTetrahedron(v, 0, ValMin, ValMax, Raise, Draw_ScalarTetrahedron(v, 0, ValMin, ValMax, Raise,
(double*)List_Pointer_Fast(v->SS,i), (double*)List_Pointer_Fast(v->SS,i),
...@@ -372,10 +369,9 @@ void Draw_Post (void) { ...@@ -372,10 +369,9 @@ void Draw_Post (void) {
} }
if(CTX.display_lists){ if(CTX.display_lists) glEndList();
glEndList();
v->Changed=0; v->Changed=0;
}
if(v->ShowElement || v->ArrowType == DRAW_POST_DISPLACEMENT) if(v->ShowElement || v->ArrowType == DRAW_POST_DISPLACEMENT)
glDisable(GL_POLYGON_OFFSET_FILL) ; glDisable(GL_POLYGON_OFFSET_FILL) ;
...@@ -386,7 +382,7 @@ void Draw_Post (void) { ...@@ -386,7 +382,7 @@ void Draw_Post (void) {
} }
/* revenir au shading par defaut, pour l'echelle */ // go back to default shading for the scale
InitNoShading(); InitNoShading();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment