diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp index 0785fde1a7ff01f718f90a25fc61a2b3e988cda1..79ab3b05f6b26807e91b68b635dc81eae79cdcbf 100644 --- a/Graphics/Draw.cpp +++ b/Graphics/Draw.cpp @@ -1,4 +1,4 @@ -// $Id: Draw.cpp,v 1.90 2005-12-21 02:11:47 geuzaine Exp $ +// $Id: Draw.cpp,v 1.91 2005-12-21 23:09:52 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -75,7 +75,7 @@ void Draw3d(void) glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); - InitProjection(0, 0); + InitProjection(); InitRenderModel(); InitPosition(); @@ -133,7 +133,7 @@ void ClearOpengl(void) // Init -void InitProjection(int x, int y) +void InitProjection(int xpick, int ypick, int wpick, int hpick) { double Va = (GLdouble) (CTX.viewport[3] - CTX.viewport[1]) / @@ -169,10 +169,10 @@ void InitProjection(int x, int y) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - // restrict to 5x5 pixel viewport when in SELECT mode + // restrict picking to a rectangular region around xpick,ypick in SELECT mode if(CTX.render_mode == GMSH_SELECT) - gluPickMatrix((GLdouble) x, (GLdouble) (CTX.viewport[3] - y), - 5.0, 5.0, (GLint *) CTX.viewport); + gluPickMatrix((GLdouble)xpick, (GLdouble)(CTX.viewport[3] - ypick), + (GLdouble)wpick, (GLdouble)hpick, (GLint *)CTX.viewport); double grad_z, grad_xy; double zmax = MAX(fabs(CTX.min[2]), fabs(CTX.max[2])); @@ -364,7 +364,7 @@ void Process_SelectionBuffer(int x, int y, int *n, hit *hits) // an entity is drawn glPushMatrix(); - InitProjection(x, y); + InitProjection(x, y, 5, 5); InitPosition(); Draw_Mesh(&M); glPopMatrix(); diff --git a/Graphics/Draw.h b/Graphics/Draw.h index 66f9052a259303e59324926232506055017bf08b..66b0be577d4261679c93024df2ca8bead5056e26 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -33,7 +33,7 @@ void SetOpenglContext(void); void ClearOpengl(void); -void InitProjection(int x, int y); +void InitProjection(int xpick=0, int ypick=0, int wpick=0, int hpick=0); void InitPosition(void); void InitRenderModel(void); diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index b667315063b9846a468621141fd30a552bbade0d..c8ad137e580c30f33920a1fb0c3bacaf5ceafe12 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $Id: Mesh.cpp,v 1.146 2005-12-19 02:30:33 geuzaine Exp $ +// $Id: Mesh.cpp,v 1.147 2005-12-21 23:09:52 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -60,7 +60,7 @@ void draw_polygon_2d(double r, double g, double b, int n, // of the 2D aniso mesh CalculateMinMax(THEM->Points, NULL); SetOpenglContext(); - InitProjection(0, 0); + InitProjection(); InitPosition(); glDisable(GL_DEPTH_TEST);