Mercurial > hg > octave-nkf
comparison libinterp/corefcn/gl-render.cc @ 18959:be8d7721ac16
Use OpenGL line smoothing when multisample is not available.
* gl-render.cc (opengl_renderer::init_gl_context): Check whether multisample is
enabled and use GL_LINE_SMOOTH if it is not.
* gl-render.cc (opengl_renderer::setup_opengl_transformation). Remove call to
disable GL_LINE_SMOOTH.
* gl-render.cc (opengl_renderer::draw_axes_children): Remove call to enable
GL_LINE_SMOOTH.
* gl-render.cc (opengl_renderer::draw_axes): Disable GL_LINE_SMOOTH for axes
lines, but re-enable for axes children.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 18 May 2014 14:20:24 -0700 |
parents | ff39ddf84a19 |
children | 79f69742971a |
comparison
equal
deleted
inserted
replaced
18958:ff39ddf84a19 | 18959:be8d7721ac16 |
---|---|
620 glEnable (GL_NORMALIZE); | 620 glEnable (GL_NORMALIZE); |
621 | 621 |
622 if (enhanced) | 622 if (enhanced) |
623 { | 623 { |
624 glEnable (GL_BLEND); | 624 glEnable (GL_BLEND); |
625 glEnable (GL_LINE_SMOOTH); | 625 glEnable (GL_MULTISAMPLE); |
626 GLint iMultiSample, iNumSamples; | |
627 glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample); | |
628 glGetIntegerv (GL_SAMPLES, &iNumSamples); | |
629 if (iMultiSample != GL_TRUE || iNumSamples == 0) | |
630 { | |
631 // MultiSample not implemented. Use old-style anti-aliasing | |
632 glDisable (GL_MULTISAMPLE); | |
633 glEnable (GL_LINE_SMOOTH); | |
634 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST); | |
635 } | |
626 } | 636 } |
627 else | 637 else |
628 { | 638 { |
629 glDisable (GL_BLEND); | 639 glDisable (GL_BLEND); |
630 glDisable (GL_LINE_SMOOTH); | 640 glDisable (GL_LINE_SMOOTH); |
814 glOrtho (0, vw[2], vw[3], 0, xZ1, xZ2); | 824 glOrtho (0, vw[2], vw[3], 0, xZ1, xZ2); |
815 glMultMatrixd (x_mat2.data ()); | 825 glMultMatrixd (x_mat2.data ()); |
816 glMatrixMode (GL_MODELVIEW); | 826 glMatrixMode (GL_MODELVIEW); |
817 | 827 |
818 glClear (GL_DEPTH_BUFFER_BIT); | 828 glClear (GL_DEPTH_BUFFER_BIT); |
819 | |
820 glDisable (GL_LINE_SMOOTH); | |
821 | 829 |
822 // store axes transformation data | 830 // store axes transformation data |
823 | 831 |
824 xform = props.get_transform (); | 832 xform = props.get_transform (); |
825 } | 833 } |
1338 void | 1346 void |
1339 opengl_renderer::draw_axes_children (const axes::properties& props) | 1347 opengl_renderer::draw_axes_children (const axes::properties& props) |
1340 { | 1348 { |
1341 // Children | 1349 // Children |
1342 | 1350 |
1343 GLboolean antialias; | |
1344 glGetBooleanv (GL_LINE_SMOOTH, &antialias); | |
1345 | |
1346 if (antialias == GL_TRUE) | |
1347 glEnable (GL_LINE_SMOOTH); | |
1348 | |
1349 Matrix children = props.get_all_children (); | 1351 Matrix children = props.get_all_children (); |
1350 std::list<graphics_object> obj_list; | 1352 std::list<graphics_object> obj_list; |
1351 std::list<graphics_object>::iterator it; | 1353 std::list<graphics_object>::iterator it; |
1352 | 1354 |
1353 // 1st pass: draw light objects | 1355 // 1st pass: draw light objects |
1427 return; | 1429 return; |
1428 } | 1430 } |
1429 | 1431 |
1430 setup_opengl_transformation (props); | 1432 setup_opengl_transformation (props); |
1431 | 1433 |
1434 // Disable line smoothing for axes | |
1435 GLboolean antialias; | |
1436 glGetBooleanv (GL_LINE_SMOOTH, &antialias); | |
1437 if (antialias == GL_TRUE) | |
1438 glDisable (GL_LINE_SMOOTH); | |
1439 | |
1432 // draw axes object | 1440 // draw axes object |
1433 | 1441 |
1434 draw_axes_planes (props); | 1442 draw_axes_planes (props); |
1435 draw_axes_boxes (props); | 1443 draw_axes_boxes (props); |
1436 | 1444 |
1441 draw_axes_z_grid (props); | 1449 draw_axes_z_grid (props); |
1442 | 1450 |
1443 set_linestyle ("-"); | 1451 set_linestyle ("-"); |
1444 | 1452 |
1445 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max); | 1453 set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max); |
1454 | |
1455 // Re-enable line smoothing for children | |
1456 if (antialias == GL_TRUE) | |
1457 glEnable (GL_LINE_SMOOTH); | |
1446 | 1458 |
1447 draw_axes_children (props); | 1459 draw_axes_children (props); |
1448 } | 1460 } |
1449 | 1461 |
1450 void | 1462 void |