Better axes rendering

This commit is contained in:
Alessandro Ranellucci 2015-01-07 19:48:25 +01:00
parent 06aaf83cfe
commit a4235f5f44

View File

@ -745,6 +745,8 @@ sub Render {
glDrawArrays(GL_TRIANGLES, 0, $self->bed_triangles->elements / 3); glDrawArrays(GL_TRIANGLES, 0, $self->bed_triangles->elements / 3);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
# we need depth test for grid, otherwise it would disappear when looking
# the object from below
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
# draw grid # draw grid
@ -762,7 +764,8 @@ sub Render {
{ {
# draw axes # draw axes
$ground_z += 0.02; #$ground_z += 0.02;
glDisable(GL_DEPTH_TEST);
my $origin = $self->origin; my $origin = $self->origin;
my $axis_len = max( my $axis_len = max(
0.3 * max(@{ $self->bed_bounding_box->size }), 0.3 * max(@{ $self->bed_bounding_box->size }),
@ -783,6 +786,7 @@ sub Render {
glVertex3f(@$origin, $ground_z); glVertex3f(@$origin, $ground_z);
glVertex3f(@$origin, $ground_z+$axis_len); glVertex3f(@$origin, $ground_z+$axis_len);
glEnd(); glEnd();
glEnable(GL_DEPTH_TEST);
} }
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);