diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index 511df0c5dcf9f13015121b377d1ebd4d77018550..437ff8516dd37a333e103d2b43aeb9ec91d46d71 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -265,7 +265,8 @@ void drawContext::draw2d() glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho((double)viewport[0], (double)viewport[2], - (double)viewport[1], (double)viewport[3], -1., 1.); + (double)viewport[1], (double)viewport[3], + -100., 100.); // in pixels, so we can draw some 3D glyphs // hack to make the 2D primitives appear "in front" in GL2PS glTranslated(0., 0., CTX::instance()->clipFactor > 1. ? diff --git a/Graphics/drawGraph2d.cpp b/Graphics/drawGraph2d.cpp index 22f58f38fa8768a6c34ab97b39edc18a759e2fe9..73a6429cfee0061b99a273d88851e1389c779c12 100644 --- a/Graphics/drawGraph2d.cpp +++ b/Graphics/drawGraph2d.cpp @@ -310,7 +310,7 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop, static void addGraphPoint(drawContext *ctx, PView *p, double xleft, double ytop, double width, double height, double x, double y, double xmin, double xmax, double ymin, double ymax, - bool numeric) + bool numeric, bool sphere) { PViewOptions *opt = p->getOptions(); @@ -337,6 +337,8 @@ static void addGraphPoint(drawContext *ctx, PView *p, double xleft, double ytop, sprintf(label, opt->format.c_str(), y); ctx->drawString(label); } + else if(sphere) + ctx->drawSphere(opt->pointSize, px, py, 0, 10, 10, opt->light); else glVertex2d(px, py); } @@ -355,24 +357,6 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto glLineWidth((float)opt->lineWidth); gl2psLineWidth((float)(opt->lineWidth * CTX::instance()->print.epsLineWidthFactor)); - if(opt->intervalsType == PViewOptions::Numeric){ - for(unsigned int i = 0; i < y.size(); i++) - for(unsigned int j = 0; j < x.size(); j++) - addGraphPoint(ctx, p, xleft, ytop, width, height, x[j], y[i][j], - xmin, xmax, opt->tmpMin, opt->tmpMax, true); - } - - if(opt->intervalsType == PViewOptions::Iso || - opt->intervalsType == PViewOptions::Discrete || - opt->intervalsType == PViewOptions::Numeric){ - glBegin(GL_POINTS); - for(unsigned int i = 0; i < y.size(); i++) - for(unsigned int j = 0; j < x.size(); j++) - addGraphPoint(ctx, p, xleft, ytop, width, height, x[j], y[i][j], - xmin, xmax, opt->tmpMin, opt->tmpMax, false); - glEnd(); - } - if(opt->intervalsType == PViewOptions::Discrete || opt->intervalsType == PViewOptions::Continuous){ for(unsigned int i = 0; i < y.size(); i++){ @@ -384,7 +368,7 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto glBegin(GL_LINE_STRIP); for(unsigned int j = 0; j < x.size(); j++) addGraphPoint(ctx, p, xleft, ytop, width, height, x[j], y[i][j], - xmin, xmax, opt->tmpMin, opt->tmpMax, false); + xmin, xmax, opt->tmpMin, opt->tmpMax, false, false); glEnd(); if(opt->useStipple){ glDisable(GL_LINE_STIPPLE); @@ -392,6 +376,25 @@ static void drawGraphCurves(drawContext *ctx, PView *p, double xleft, double yto } } } + + if(opt->intervalsType == PViewOptions::Iso || + opt->intervalsType == PViewOptions::Discrete || + opt->intervalsType == PViewOptions::Numeric){ + bool sphere = (opt->pointType == 1 || opt->pointType == 3); + if(!sphere) glBegin(GL_POINTS); + for(unsigned int i = 0; i < y.size(); i++) + for(unsigned int j = 0; j < x.size(); j++) + addGraphPoint(ctx, p, xleft, ytop, width, height, x[j], y[i][j], + xmin, xmax, opt->tmpMin, opt->tmpMax, false, sphere); + if(!sphere) glEnd(); + } + + if(opt->intervalsType == PViewOptions::Numeric){ + for(unsigned int i = 0; i < y.size(); i++) + for(unsigned int j = 0; j < x.size(); j++) + addGraphPoint(ctx, p, xleft, ytop, width, height, x[j], y[i][j], + xmin, xmax, opt->tmpMin, opt->tmpMax, true, false); + } } static void drawGraph(drawContext *ctx, PView *p, double xleft, double ytop,