diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp index d78ff6e5d7..f8e7e6cf64 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp @@ -405,19 +405,18 @@ CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::generateLayerListFromContainer( c m_boardAdapter.BiuTo3Dunits(), false ); // Create display list // ///////////////////////////////////////////////////////////////////// - return new CLAYERS_OGL_DISP_LISTS( *layerTriangles, - m_ogl_circle_texture, - layer_z_bot, - layer_z_top ); + return new CLAYERS_OGL_DISP_LISTS( *layerTriangles, m_ogl_circle_texture, + layer_z_bot, layer_z_top ); } -CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::createBoard( SHAPE_POLY_SET aBoardPoly ) +CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::createBoard( const SHAPE_POLY_SET& aBoardPoly ) { CLAYERS_OGL_DISP_LISTS* dispLists = nullptr; CCONTAINER2D boardContainer; - Convert_shape_line_polygon_to_triangles( aBoardPoly, - boardContainer, + SHAPE_POLY_SET brd_outlines = aBoardPoly; + + Convert_shape_line_polygon_to_triangles( brd_outlines, boardContainer, m_boardAdapter.BiuTo3Dunits(), (const BOARD_ITEM &)*m_boardAdapter.GetBoard() ); diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h index b0ad32c0d7..9f867cd6fc 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h @@ -73,7 +73,7 @@ public: private: bool initializeOpenGL(); - CLAYERS_OGL_DISP_LISTS* createBoard( SHAPE_POLY_SET aBoardPoly ); + CLAYERS_OGL_DISP_LISTS* createBoard( const SHAPE_POLY_SET& aBoardPoly ); void reload( REPORTER* aStatusReporter, REPORTER* aWarningReporter ); void ogl_set_arrow_material(); diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 477f12a943..c6eab4a7f0 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -852,7 +852,8 @@ void OPENGL_GAL::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius, d seg_count += 1; // Recalculate alphaIncrement with a even integer number of segment - alphaIncrement = (aEndAngle -aStartAngle ) / seg_count; + if( seg_count ) + alphaIncrement = (aEndAngle -aStartAngle ) / seg_count; Save(); currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );