diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index a4309f2e940be3c4eb1cd6406b2e0d539a33a781..f331314c1734494b6283aa2ab228326ebe7d0e93 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1205,8 +1205,8 @@ StringXColor GeometryOptions_Color[] = { StringXColor MeshOptions_Color[] = { { F|O, "Points" , opt_mesh_color_points , - PACK_COLOR(0 , 200, 70 , 255), - PACK_COLOR(0 , 200, 70 , 255), + PACK_COLOR(0 , 255, 0 , 255), + PACK_COLOR(0 , 255, 0 , 255), PACK_COLOR(0, 0, 0, 255), "Mesh node color" }, { F|O, "PointsSup" , opt_mesh_color_points_deg2 , @@ -1215,8 +1215,8 @@ StringXColor MeshOptions_Color[] = { PACK_COLOR(0, 0, 0, 255), "Second order mesh node color" }, { F|O, "Lines" , opt_mesh_color_lines , - PACK_COLOR(0, 255, 0, 255), - PACK_COLOR(0, 255, 0, 255), + PACK_COLOR(0, 0, 255, 255), + PACK_COLOR(0, 0, 255, 255), PACK_COLOR(0, 0, 0, 255), "Mesh line color" }, { F|O, "Triangles" , opt_mesh_color_triangles , @@ -1232,14 +1232,14 @@ StringXColor MeshOptions_Color[] = { { F|O, "Pyramids" , opt_mesh_color_pyramid , COLY, COLY, COLW, "Mesh pyramid color (if Mesh.ColorCarousel=0)" }, { F|O, "Tangents" , opt_mesh_color_tangents , - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(0, 0, 0, 255), + PACK_COLOR(255, 255, 0, 255), + PACK_COLOR(255, 255, 0, 255), + PACK_COLOR(0, 0, 0, 255), "Tangent mesh vector color" }, { F|O, "Normals" , opt_mesh_color_normals , - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(0, 0, 0, 255), + PACK_COLOR(255, 0, 0, 255), + PACK_COLOR(255, 0, 0, 255), + PACK_COLOR(0, 0, 0, 255), "Normal mesh vector color" }, { F|O, "One" , opt_mesh_color_1 , COL1, COL1, COLW, "First color in color carousel" }, { F|O, "Two" , opt_mesh_color_2 , COL2, COL2, COLW, "Second color in color carousel" }, diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index 4eedfe7f6f22ce7677c2a4183b91b99a095366b5..779db3c103b9ea718048f03f3a5e9aba095cddc0 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.34 2004-04-13 19:27:09 geuzaine Exp $ +// $Id: Entity.cpp,v 1.35 2004-04-20 01:26:13 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -131,6 +131,7 @@ void Draw_Triangle(double *x, double *y, double *z, double *n, double x1x0, y1y0, z1z0, x2x0, y2y0, z2z0, nn[3]; if(light) glEnable(GL_LIGHTING); + glEnable(GL_POLYGON_OFFSET_FILL); glBegin(GL_TRIANGLES); if(light) { @@ -164,6 +165,7 @@ void Draw_Triangle(double *x, double *y, double *z, double *n, glVertex3d(x[2] + Raise[0][2], y[2] + Raise[1][2], z[2] + Raise[2][2]); glEnd(); + glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_LIGHTING); } diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index d404db144b994c4986fbfd471bb99f1ea1ad22b1..36b5f723d495464bf213c07faf836b3ac5e708b5 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.52 2004-04-19 19:04:15 geuzaine Exp $ +// $Id: Geom.cpp,v 1.53 2004-04-20 01:26:13 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -279,8 +279,8 @@ void Draw_Triangulated_Surface(Surface * s) double *points, *p1, *p2, *p3; if(CTX.geom.surfaces) { - glEnable(GL_POLYGON_OFFSET_FILL); if(CTX.geom.light) glEnable(GL_LIGHTING); + glEnable(GL_POLYGON_OFFSET_FILL); glBegin(GL_TRIANGLES); while (k < List_Nbr(s->thePolyRep->polygons)){ points = (double*)List_Pointer(s->thePolyRep->polygons,k); @@ -298,7 +298,7 @@ void Draw_Triangulated_Surface(Surface * s) } } glEnd(); - glDisable(GL_POLYGON_OFFSET_FILL); + glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_LIGHTING); } } @@ -504,6 +504,7 @@ void Draw_NonPlane_Surface(Surface * s) for(i = 0; i < NbTics; i++) tics[i] = v0 + ((double)(i + 1) / (double)NbTics) * (vn - v0); if(CTX.geom.light) glEnable(GL_LIGHTING); + glEnable(GL_POLYGON_OFFSET_FILL); GLUnurbsObj *nurb; nurb = gluNewNurbsRenderer(); #if defined(GLU_VERSION_1_3) @@ -516,6 +517,7 @@ void Draw_NonPlane_Surface(Surface * s) s->OrderU + 1, s->OrderV + 1, GL_MAP2_VERTEX_4); gluEndSurface(nurb); gluDeleteNurbsRenderer(nurb); + glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_LIGHTING); return; } diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index 21c1d73d9e6d46946981814a2bb6616817433745..dac738f1046461ea823d7b4becc7f92529ba7652 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.71 2004-04-19 23:52:12 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.72 2004-04-20 01:26:13 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -91,16 +91,15 @@ void Draw_Mesh(Mesh * M) if(CTX.clip[i]) glClipPlane((GLenum) (GL_CLIP_PLANE0 + i), CTX.clip_plane[i]); - glPointSize(CTX.mesh.point_size); - gl2psPointSize(CTX.mesh.point_size * CTX.print.eps_point_size_factor); - - glLineWidth(CTX.mesh.line_width); - gl2psLineWidth(CTX.mesh.line_width * CTX.print.eps_line_width_factor); + // draw the geometry - if(CTX.mesh.solid) - glEnable(GL_POLYGON_OFFSET_FILL); + if(M->status >= 0) + Draw_Geom(M); - // draw the bbox of the mesh in fast redraw mode if there is no geometry + // draw the bounding box of the mesh if we are in fast redraw mode + // and there is no geometry + + glLineWidth(CTX.line_width); if(!CTX.mesh.draw && Tree_Nbr(M->Vertices) && !Tree_Nbr(M->Points)) { glColor4ubv((GLubyte *) & CTX.color.fg); glBegin(GL_LINE_LOOP); @@ -127,6 +126,14 @@ void Draw_Mesh(Mesh * M) glEnd(); } + // draw the mesh + + glPointSize(CTX.mesh.point_size); + gl2psPointSize(CTX.mesh.point_size * CTX.print.eps_point_size_factor); + + glLineWidth(CTX.mesh.line_width); + gl2psLineWidth(CTX.mesh.line_width * CTX.print.eps_line_width_factor); + if(CTX.mesh.draw && CTX.render_mode != GMSH_SELECT) { static int first = 1, listnum; @@ -139,8 +146,7 @@ void Draw_Mesh(Mesh * M) glNewList(listnum, GL_COMPILE_AND_EXECUTE); } - if(!CTX.mesh.display_lists - || (CTX.mesh.display_lists && CTX.mesh.changed)) { + if(!CTX.mesh.display_lists || (CTX.mesh.display_lists && CTX.mesh.changed)) { //printf("normal mesh drawing\n"); @@ -150,13 +156,14 @@ void Draw_Mesh(Mesh * M) } if(M->status >= 2 && (CTX.mesh.surfaces_faces || CTX.mesh.surfaces_edges || - CTX.mesh.surfaces_num)) { + CTX.mesh.surfaces_num || CTX.mesh.normals)) { Tree_Action(M->Surfaces, Draw_Mesh_Surfaces); if(CTX.mesh.oldxtrude) //old extrusion algo Tree_Action(M->Volumes, Draw_Mesh_Extruded_Surfaces); } - if(M->status >= 1 && (CTX.mesh.lines || CTX.mesh.lines_num)) { + if(M->status >= 1 && (CTX.mesh.lines || CTX.mesh.lines_num || + CTX.mesh.tangents)) { Tree_Action(M->Curves, Draw_Mesh_Curves); } @@ -181,11 +188,7 @@ void Draw_Mesh(Mesh * M) } - if(M->status >= 0) - Draw_Geom(M); - - if(CTX.mesh.solid) - glDisable(GL_POLYGON_OFFSET_FILL); + // draw the post-processing views if(CTX.render_mode != GMSH_SELECT) { if(CTX.axes) @@ -471,6 +474,7 @@ void Draw_Simplex_Volume(void *a, void *b) double n[3]; // FIXME: should subdivide if s->VSUP if(CTX.mesh.light) glEnable(GL_LIGHTING); + glEnable(GL_POLYGON_OFFSET_FILL); glBegin(GL_TRIANGLES); if(CTX.mesh.light) glNormal3verts(s->V[0], s->V[2], s->V[1], n); glVertex3d(X[0], Y[0], Z[0]); @@ -489,6 +493,7 @@ void Draw_Simplex_Volume(void *a, void *b) glVertex3d(X[1], Y[1], Z[1]); glVertex3d(X[2], Y[2], Z[2]); glEnd(); + glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_LIGHTING); } } @@ -543,6 +548,7 @@ void Draw_Simplex_Surface_Common(Simplex * s, int L, int K, glColor4ubv((GLubyte *) & CTX.color.mesh.quadrangle); if(CTX.mesh.light) glEnable(GL_LIGHTING); + glEnable(GL_POLYGON_OFFSET_FILL); if(!L) { // first order elements if(K == 3) { @@ -590,6 +596,7 @@ void Draw_Simplex_Surface_Common(Simplex * s, int L, int K, glEnd(); } } + glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_LIGHTING); } } @@ -872,8 +879,8 @@ void Draw_Hexahedron_Volume(void *a, void *b) Z[i] = Zc + CTX.mesh.explode * (h->V[i]->Pos.Z - Zc); } - // FIXME: remove "1" when we add the face drawing code - if(1 || CTX.mesh.volumes_edges){ + // FIXME: change this when we add the face drawing code + if(CTX.mesh.volumes_edges || CTX.mesh.volumes_faces){ glBegin(GL_LINE_LOOP); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); @@ -1026,8 +1033,8 @@ void Draw_Prism_Volume(void *a, void *b) Z[i] = Zc + CTX.mesh.explode * (p->V[i]->Pos.Z - Zc); } - // FIXME: remove "1" when we add the face drawing code - if(1 || CTX.mesh.volumes_edges){ + // FIXME: change this when we add the face drawing code + if(CTX.mesh.volumes_edges || CTX.mesh.volumes_faces){ glBegin(GL_LINE_LOOP); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); @@ -1162,8 +1169,8 @@ void Draw_Pyramid_Volume(void *a, void *b) Z[i] = Zc + CTX.mesh.explode * (p->V[i]->Pos.Z - Zc); } - // FIXME: remove "1" when we add the face drawing code - if(1 || CTX.mesh.volumes_edges){ + // FIXME: change this when we add the face drawing code + if(CTX.mesh.volumes_edges || CTX.mesh.volumes_faces){ glBegin(GL_LINE_LOOP); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 215adc1c3e749c5f2da51daac8659bf96da35497..f63a6edaf35d8881389a7db39b6394384999edd9 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.52 2004-02-20 17:58:00 geuzaine Exp $ +// $Id: Post.cpp,v 1.53 2004-04-20 01:26:13 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -467,9 +467,6 @@ void Draw_Post(void) glLineWidth(v->LineWidth); gl2psLineWidth(v->LineWidth * CTX.print.eps_line_width_factor); - if(v->ShowElement) - glEnable(GL_POLYGON_OFFSET_FILL); - // force this if(v->IntervalsType == DRAW_POST_CONTINUOUS) { glShadeModel(GL_SMOOTH); @@ -609,10 +606,6 @@ void Draw_Post(void) glEndList(); v->Changed = 0; - - if(v->ShowElement || v->VectorType == DRAW_POST_DISPLACEMENT) - glDisable(GL_POLYGON_OFFSET_FILL); - } } diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index abfc9eaaa94689cd8d84c9bbb10078b7322b4973..ec0fe8a7a73bb472c67e6a4e307b5925e6206d67 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.23 2004-02-28 00:48:49 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.24 2004-04-20 01:26:14 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -469,6 +469,7 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, else { if(View->Light) glEnable(GL_LIGHTING); + glEnable(GL_POLYGON_OFFSET_FILL); if(View->IntervalsType == DRAW_POST_CONTINUOUS) { if(Val[0] >= ValMin && Val[0] <= ValMax && @@ -534,6 +535,7 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, } } + glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_LIGHTING); } }