← Back to team overview

kicad-developers team mailing list archive

[PATCH] 3d-viewer: Fix grid update by calling CreateDrawGL_List

 

Hi all,

Changing the grid size in the 3D viewer currently hides the grid until
some other display parameter is toggled. The reason is that the grid
should be explicitely rebuilt by calling CreateDrawGL_List(). The
attached patch should fix this.

The grid has two other unfixed glitches, visible in the attached screenshots:
1/ There is a rounding error somewhere that causes on extra line on both sides.
2/ Each 5 grid lines is drawn with a light color (gridcolor_marker),
but only when you look from one direction. Some kind of backface
culling prevents the light color from taking effect the other way.

Martin
From 13cf687f90da82ab87af6ac024352d6e2c6dccc1 Mon Sep 17 00:00:00 2001
From: Martin d'Allens <martin.dallens@xxxxxxxxx>
Date: Thu, 18 Jun 2015 22:56:14 +0200
Subject: [PATCH 4/4] 3d-viewer: Fix grid update by calling CreateDrawGL_List

---
 3d-viewer/3d_draw.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp
index f7a6642..fe24092 100644
--- a/3d-viewer/3d_draw.cpp
+++ b/3d-viewer/3d_draw.cpp
@@ -558,8 +558,13 @@ void EDA_3D_CANVAS::Redraw()
 
     // Grid uses transparency: draw it after all objects
 
-    if( isEnabled( FL_GRID ) && m_glLists[GL_ID_GRID] )
+    if( isEnabled( FL_GRID ) )
+    {
+        if( ! m_glLists[GL_ID_GRID] )
+            CreateDrawGL_List( &errorReporter, &activityReporter );
+
         glCallList( m_glLists[GL_ID_GRID] );
+    }
 
 
     // Draw Board Shadow
-- 
2.1.4

Attachment: grid-back.png
Description: PNG image

Attachment: grid-front.png
Description: PNG image


Follow ups