diff --git a/Common/Context.h b/Common/Context.h index 2612cc4a46da692fd409e2fa2679f0d314c40d59..5cfb6ac4405a5a33df26ca787d9b31b032ce2325 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -197,6 +197,7 @@ class CTX { int msgFontSize; // point/line widths double pointSize, lineWidth; + double highResolutionPointSizeFactor; // light options int light[6]; double lightPosition[6][4], shine, shineExponent; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index cbd094473f9480b98d500ad4eb6dfb1dc8d297bf..28e2e5b78e4c3b6a4e1fbb4f6eef6c8884501852 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -505,6 +505,8 @@ StringXNumber GeneralOptions_Number[] = { "tools window" }, { F|O, "HighResolutionGraphics" , opt_general_high_resolution_graphics , 1. , "Use high-resolution OpenGL graphics (e.g. for Macs with retina displays)" }, + { F|O, "HighResolutionPointSizeFactor" , opt_general_high_resolution_point_size_factor , 2. , + "Point size factor when using high-resolution OpenGL graphics" }, { F|O, "InitialModule", opt_general_initial_context, 0. , "Module launched on startup (0=automatic, 1=geometry, 2=mesh, 3=solver, " diff --git a/Common/Options.cpp b/Common/Options.cpp index 858af0a28530e4af561d794163058d90482152d9..151e3342b9243fcf6b0f422d984c0d1884c9f2a6 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -2638,6 +2638,13 @@ double opt_general_point_size(OPT_ARGS_NUM) return CTX::instance()->pointSize; } +double opt_general_high_resolution_point_size_factor(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->highResolutionPointSizeFactor = val; + return CTX::instance()->highResolutionPointSizeFactor; +} + double opt_general_line_width(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index c75a760aab70ec51558930081fa7f7b65db52d55..9cc4a1dfa1c99a4b63fd842f9a168a5f90277e5f 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -164,6 +164,7 @@ double opt_general_manip_position1(OPT_ARGS_NUM); double opt_general_hot_position0(OPT_ARGS_NUM); double opt_general_hot_position1(OPT_ARGS_NUM); double opt_general_high_resolution_graphics(OPT_ARGS_NUM); +double opt_general_high_resolution_point_size_factor(OPT_ARGS_NUM); double opt_general_session_save(OPT_ARGS_NUM); double opt_general_options_save(OPT_ARGS_NUM); double opt_general_rotation0(OPT_ARGS_NUM); diff --git a/Graphics/drawGeom.cpp b/Graphics/drawGeom.cpp index c8c7903d618207de5bbe0e94d94617c23366ec9d..127e4329e4c62479afb6bd9d169d105e2f49c6b2 100644 --- a/Graphics/drawGeom.cpp +++ b/Graphics/drawGeom.cpp @@ -53,14 +53,21 @@ class drawGVertex { glPushName(v->tag()); } + double ps = CTX::instance()->geom.pointSize; + double sps = CTX::instance()->geom.selectedPointSize; + if(_ctx->isHighResolution()){ + ps *= CTX::instance()->highResolutionPointSizeFactor; + sps *= CTX::instance()->highResolutionPointSizeFactor; + } + if(v->getSelection()) { - glPointSize((float)CTX::instance()->geom.selectedPointSize); + glPointSize((float)sps); gl2psPointSize((float)(CTX::instance()->geom.selectedPointSize * CTX::instance()->print.epsPointSizeFactor)); glColor4ubv((GLubyte *) & CTX::instance()->color.geom.selection); } else { - glPointSize((float)CTX::instance()->geom.pointSize); + glPointSize((float)ps); gl2psPointSize((float)(CTX::instance()->geom.pointSize * CTX::instance()->print.epsPointSizeFactor)); glColor4ubv((GLubyte *) & CTX::instance()->color.geom.point); @@ -80,11 +87,9 @@ class drawGVertex { if(CTX::instance()->geom.points) { if(CTX::instance()->geom.pointType > 0) { if(v->getSelection()) - _ctx->drawSphere(CTX::instance()->geom.selectedPointSize, x, y, z, - CTX::instance()->geom.light); + _ctx->drawSphere(sps, x, y, z, CTX::instance()->geom.light); else - _ctx->drawSphere(CTX::instance()->geom.pointSize, x, y, z, - CTX::instance()->geom.light); + _ctx->drawSphere(ps, x, y, z, CTX::instance()->geom.light); } else { glBegin(GL_POINTS); @@ -94,7 +99,7 @@ class drawGVertex { } if(CTX::instance()->geom.pointsNum) { - double offset = (0.5 * CTX::instance()->geom.pointSize + + double offset = (0.5 * ps + 0.1 * CTX::instance()->glFontSize) * _ctx->pixel_equiv_x; drawEntityLabel(_ctx, v, x, y, z, offset); } diff --git a/Graphics/drawGraph2d.cpp b/Graphics/drawGraph2d.cpp index db2ff339a69e85b7699027477c0454233329734a..7c5edbe7b38dc62538a05d402314902ccdc44431 100644 --- a/Graphics/drawGraph2d.cpp +++ b/Graphics/drawGraph2d.cpp @@ -240,7 +240,11 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop, font_a *= ss; } - glPointSize((float)CTX::instance()->pointSize); + double ps = CTX::instance()->pointSize; + if(ctx->isHighResolution()) + ps *= CTX::instance()->highResolutionPointSizeFactor; + + glPointSize((float)ps); gl2psPointSize((float)(CTX::instance()->pointSize * CTX::instance()->print.epsPointSizeFactor)); @@ -449,10 +453,13 @@ static void addGraphPoint(drawContext *ctx, PView *p, double xleft, double ytop, ctx->drawString(label); } else if(singlePoint && (opt->pointType == 1 || opt->pointType == 3)){ + double ps = CTX::instance()->pointSize; + if(ctx->isHighResolution()) + ps *= CTX::instance()->highResolutionPointSizeFactor; if(inModelCoordinates) - ctx->drawSphere(opt->pointSize, px, py, 0, opt->light); + ctx->drawSphere(ps, px, py, 0, opt->light); else - ctx->drawSphere(opt->pointSize, px, py, 0, 10, 10, opt->light); + ctx->drawSphere(ps, px, py, 0, 10, 10, opt->light); } else{ if(singlePoint) glBegin(GL_POINTS); @@ -478,7 +485,11 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto PViewOptions *opt = p->getOptions(); - glPointSize((float)opt->pointSize); + double ps = CTX::instance()->pointSize; + if(ctx->isHighResolution()) + ps *= CTX::instance()->highResolutionPointSizeFactor; + + glPointSize((float)ps); gl2psPointSize((float)(opt->pointSize * CTX::instance()->print.epsPointSizeFactor)); glLineWidth((float)opt->lineWidth);