diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index d4ace764fd87f99f78a9bb6e63c69b4461b84410..0b59e8d18d96296ad8fa3a9964519c7cb335489d 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -215,7 +215,10 @@ void openglWindow::draw() _ctx->draw3d(); glColor4ubv((GLubyte *) & CTX::instance()->color.fg); - glPointSize((float)CTX::instance()->geom.pointSize); + float ps = CTX::instance()->geom.pointSize; + if(_ctx->isHighResolution()) + ps *= CTX::instance()->highResolutionPointSizeFactor; + glPointSize(ps); glBegin(GL_POINTS); glVertex3d(_point[0], _point[1], _point[2]); glEnd(); diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index 2b950e203fb0566bf0d81f61eb55c6a80f887640..beffcb054f9573ae398720d24f43a5d5a3543ae2 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -755,21 +755,26 @@ void drawContext::initPosition() // Takes a cursor position in window coordinates and returns the line (given by // a point and a unit direction vector), in real space, that corresponds to that // cursor position -void drawContext::unproject(double x, double y, double p[3], double d[3]) +void drawContext::unproject(double winx, double winy, double p[3], double d[3]) { + if(isHighResolution()){ + winx *= 2; // true pixels + winy *= 2; + } + GLint vp[4]; glGetIntegerv(GL_VIEWPORT, vp); - y = vp[3] - y; + winy = vp[3] - winy; GLdouble x0, y0, z0, x1, y1, z1; // we use the stored model and proj matrices instead of directly // getGetDouble'ing the matrices since unproject can be called in or after // draw2d - if(!gluUnProject(x, y, 0.0, model, proj, vp, &x0, &y0, &z0)) + if(!gluUnProject(winx, winy, 0.0, model, proj, vp, &x0, &y0, &z0)) Msg::Warning("unproject1 failed"); - if(!gluUnProject(x, y, 1.0, model, proj, vp, &x1, &y1, &z1)) + if(!gluUnProject(winx, winy, 1.0, model, proj, vp, &x1, &y1, &z1)) Msg::Warning("unproject2 failed"); p[0] = x0; @@ -784,24 +789,24 @@ void drawContext::unproject(double x, double y, double p[3], double d[3]) d[2] /= len; } -void drawContext::viewport2World(double win[3], double xyz[3]) +void drawContext::viewport2World(double vp[3], double xyz[3]) { GLint viewport[4]; GLdouble model[16], proj[16]; glGetIntegerv(GL_VIEWPORT, viewport); glGetDoublev(GL_PROJECTION_MATRIX, proj); glGetDoublev(GL_MODELVIEW_MATRIX, model); - gluUnProject(win[0], win[1], win[2], model, proj, viewport, &xyz[0], &xyz[1], &xyz[2]); + gluUnProject(vp[0], vp[1], vp[2], model, proj, viewport, &xyz[0], &xyz[1], &xyz[2]); } -void drawContext::world2Viewport(double xyz[3], double win[3]) +void drawContext::world2Viewport(double xyz[3], double vp[3]) { GLint viewport[4]; GLdouble model[16], proj[16]; glGetIntegerv(GL_VIEWPORT, viewport); glGetDoublev(GL_PROJECTION_MATRIX, proj); glGetDoublev(GL_MODELVIEW_MATRIX, model); - gluProject(xyz[0], xyz[1], xyz[2], model, proj, viewport, &win[0], &win[1], &win[2]); + gluProject(xyz[0], xyz[1], xyz[2], model, proj, viewport, &vp[0], &vp[1], &vp[2]); } class hit{ diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h index ef2d1e9edea7c67a365aabbda823381431730b42..183790c653c2bda3a39e6874202affa9e76bf831 100644 --- a/Graphics/drawContext.h +++ b/Graphics/drawContext.h @@ -191,9 +191,9 @@ class drawContext { void initProjection(int xpick=0, int ypick=0, int wpick=0, int hpick=0); void initRenderModel(); void initPosition(); - void unproject(double x, double y, double p[3], double d[3]); - void viewport2World(double win[3], double xyz[3]); - void world2Viewport(double xyz[3], double win[3]); + void unproject(double winx, double winy, double p[3], double d[3]); + void viewport2World(double vp[3], double xyz[3]); + void world2Viewport(double xyz[3], double vp[3]); bool select(int type, bool multiple, bool mesh, int x, int y, int w, int h, std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions,