Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » KiCAD
  • » [Kicad-developers] [PATCH] PCBNEW crashes when enter 3d view [RSS Feed]

#1 Jan. 30, 2011 04:53:25

Phinitnan C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Kicad-developers] [PATCH] PCBNEW crashes when enter 3d view


Hello,

After my investigation of the 3d view bug which affected some computer,
below is the patch. You may read the previous post on this topic for more
information.
This is my first time trying to make a patch, so please bear with me :)






=== modified file '3d-viewer/3d_canvas.cpp'
--- 3d-viewer/3d_canvas.cpp 2011-01-20 16:34:57 +0000
+++ 3d-viewer/3d_canvas.cpp 2011-01-29 04:39:05 +0000
@@ -73,9 +73,9 @@
Pcb3D_GLCanvas::OnPopUpMenu )
END_EVENT_TABLE()

-Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
-#if wxCHECK_VERSION( 2, 9, 0 )
- wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize,
+Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, int* attribList
) :
+#if wxCHECK_VERSION( 2, 7, 0 )
+ wxGLCanvas( parent, -1, attribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#else
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize,
@@ -87,7 +87,7 @@
m_Parent = parent;
m_ortho = false;

-#if wxCHECK_VERSION( 2, 9, 0 )
+#if wxCHECK_VERSION( 2, 7, 0 )

// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext( this );
@@ -101,7 +101,7 @@
{
ClearLists();
m_init = FALSE;
-#if wxCHECK_VERSION( 2, 9, 0 )
+#if wxCHECK_VERSION( 2, 7, 0 )
delete m_glRC;
#endif
}

=== modified file '3d-viewer/3d_draw.cpp'
--- 3d-viewer/3d_draw.cpp 2011-01-19 10:34:56 +0000
+++ 3d-viewer/3d_draw.cpp 2011-01-29 04:46:23 +0000
@@ -55,7 +55,11 @@

void Pcb3D_GLCanvas::Redraw( bool finish )
{
-#if wxCHECK_VERSION( 2, 9, 0 )
+ /* SwapBuffer requires the window to be shown before calling */
+ if( !IsShown() )
+ return;
+
+#if wxCHECK_VERSION( 2, 7, 0 )
SetCurrent( *m_glRC );
#else
SetCurrent();
@@ -96,8 +100,9 @@
}

glFlush();
- if( finish )
+ if( finish );
glFinish();
+
SwapBuffers();
}


=== modified file '3d-viewer/3d_frame.cpp'
--- 3d-viewer/3d_frame.cpp 2010-10-04 12:58:07 +0000
+++ 3d-viewer/3d_frame.cpp 2011-01-29 04:43:39 +0000
@@ -78,7 +78,8 @@
ReCreateVToolbar();

// Make a Pcb3D_GLCanvas
- m_Canvas = new Pcb3D_GLCanvas( this );
+ int attrs = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16,
0};
+ m_Canvas = new Pcb3D_GLCanvas( this, attrs );

m_auimgr.SetManagedWindow( this );


=== modified file '3d-viewer/3d_viewer.h'
--- 3d-viewer/3d_viewer.h 2010-12-29 17:47:32 +0000
+++ 3d-viewer/3d_viewer.h 2011-01-29 04:38:32 +0000
@@ -141,11 +141,11 @@
/// Tracks whether to use Orthographic or Perspective projection
//TODO: Does this belong here, or in WinEDA3D_DrawFrame ???
bool m_ortho;
-#if wxCHECK_VERSION( 2, 9, 0 )
+#if wxCHECK_VERSION( 2, 7, 0 )
wxGLContext* m_glRC;
#endif
public:
- Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
+ Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, int* attribList = 0 );
~Pcb3D_GLCanvas();

void ClearLists();_______________________________________________
Mailing list:https://launchpad.net/~kicad-developersPost to : kicad-developers@lists.launchpad.net
Unsubscribe :https://launchpad.net/~kicad-developersMore help :https://help.launchpad.net/ListHelp

Offline

  • Root
  • » KiCAD
  • » [Kicad-developers] [PATCH] PCBNEW crashes when enter 3d view [RSS Feed]

Board footer

Moderator control

Enjoy the 17th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support