From 9734f5a18e053fb44f162ff2110ccf8000fb560e Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 21 Dec 2005 23:09:52 +0000 Subject: [PATCH] pick --- Graphics/Draw.cpp | 14 +++++++------- Graphics/Draw.h | 2 +- Graphics/Mesh.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp index 0785fde1a7..79ab3b05f6 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 66f9052a25..66b0be577d 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 b667315063..c8ad137e58 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); -- GitLab