comparison libinterp/corefcn/gl-render.cc @ 18667:e42843ceff48

Fix axes bounding box not obeying 'layer' property. * gl-render.cc (draw_axes_boxes): Check layer2Dtop to decide which Z-value to place axis at. In 2-D plot, don't draw box lines at second Z-value which overlaps original axis and is always on top. * graphics.cc (update_axes_layout): Set property is2D based on whether view() elevation is 90 degrees. * graphics.in.h (axes::properties): New is2D bool property. * graphics.in.h (axes::properties::get_is2D): New getter function.
author Rik <rik@octave.org>
date Wed, 23 Apr 2014 18:48:30 -0700
parents 75ec138ba53b
children f684f7075aee
comparison
equal deleted inserted replaced
18666:652d9ed6f88d 18667:e42843ceff48
871 871
872 void 872 void
873 opengl_renderer::draw_axes_boxes (const axes::properties& props) 873 opengl_renderer::draw_axes_boxes (const axes::properties& props)
874 { 874 {
875 bool xySym = props.get_xySym (); 875 bool xySym = props.get_xySym ();
876 bool layer2Dtop = props.get_layer2Dtop ();
877 bool is2d = props.get_is2D ();
876 double xPlane = props.get_xPlane (); 878 double xPlane = props.get_xPlane ();
877 double yPlane = props.get_yPlane (); 879 double yPlane = props.get_yPlane ();
878 double zPlane = props.get_zPlane (); 880 double zPlane = props.get_zPlane ();
879 double xPlaneN = props.get_xPlaneN (); 881 double xPlaneN = props.get_xPlaneN ();
880 double yPlaneN = props.get_yPlaneN (); 882 double yPlaneN = props.get_yPlaneN ();
897 { 899 {
898 glBegin (GL_LINES); 900 glBegin (GL_LINES);
899 901
900 // X box 902 // X box
901 set_color (props.get_xcolor_rgb ()); 903 set_color (props.get_xcolor_rgb ());
904
905 if (layer2Dtop)
906 std::swap (zpTick, zpTickN);
907
902 glVertex3d (xPlaneN, ypTick, zpTick); 908 glVertex3d (xPlaneN, ypTick, zpTick);
903 glVertex3d (xPlane, ypTick, zpTick); 909 glVertex3d (xPlane, ypTick, zpTick);
904 910
905 if (props.is_box ()) 911 if (props.is_box ())
906 { 912 {
907 glVertex3d (xPlaneN, ypTickN, zpTick); 913 glVertex3d (xPlaneN, ypTickN, zpTick);
908 glVertex3d (xPlane, ypTickN, zpTick); 914 glVertex3d (xPlane, ypTickN, zpTick);
909 glVertex3d (xPlaneN, ypTickN, zpTickN); 915 if (! is2d)
910 glVertex3d (xPlane, ypTickN, zpTickN); 916 {
911 glVertex3d (xPlaneN, ypTick, zpTickN); 917 glVertex3d (xPlaneN, ypTickN, zpTickN);
912 glVertex3d (xPlane, ypTick, zpTickN); 918 glVertex3d (xPlane, ypTickN, zpTickN);
919 glVertex3d (xPlaneN, ypTick, zpTickN);
920 glVertex3d (xPlane, ypTick, zpTickN);
921 }
913 } 922 }
914 923
915 // Y box 924 // Y box
916 set_color (props.get_ycolor_rgb ()); 925 set_color (props.get_ycolor_rgb ());
917 glVertex3d (xpTick, yPlaneN, zpTick); 926 glVertex3d (xpTick, yPlaneN, zpTick);
919 928
920 if (props.is_box () && ! plotyy) 929 if (props.is_box () && ! plotyy)
921 { 930 {
922 glVertex3d (xpTickN, yPlaneN, zpTick); 931 glVertex3d (xpTickN, yPlaneN, zpTick);
923 glVertex3d (xpTickN, yPlane, zpTick); 932 glVertex3d (xpTickN, yPlane, zpTick);
924 glVertex3d (xpTickN, yPlaneN, zpTickN); 933
925 glVertex3d (xpTickN, yPlane, zpTickN); 934 if (! is2d)
926 glVertex3d (xpTick, yPlaneN, zpTickN); 935 {
927 glVertex3d (xpTick, yPlane, zpTickN); 936 glVertex3d (xpTickN, yPlaneN, zpTickN);
937 glVertex3d (xpTickN, yPlane, zpTickN);
938 glVertex3d (xpTick, yPlaneN, zpTickN);
939 glVertex3d (xpTick, yPlane, zpTickN);
940 }
928 } 941 }
929 942
930 // Z box 943 // Z box
931 set_color (props.get_zcolor_rgb ()); 944 set_color (props.get_zcolor_rgb ());
932 945