EDIT: SolutionConfirmed the fix. Your canvas subclass does indeed use SwapBuffers, but supplies no attribList to the parent constructor. I've fixed this; the only attribute I've supplied is the WX_GL_DOUBLEBUFFER.
The changes I made are below.
Code: Select all
diff -ruN CELayoutEditor-0.7.1-old/inc/EditorCanvas.h CELayoutEditor-0.7.1/inc/EditorCanvas.h
--- CELayoutEditor-0.7.1-old/inc/EditorCanvas.h 2009-12-09 09:46:28.000000000 +0000
+++ CELayoutEditor-0.7.1/inc/EditorCanvas.h 2010-12-12 20:01:22.000000000 +0000
@@ -46,7 +46,7 @@
************************************************************************/
/** Constructor.*/
- EditorCanvas(wxView *view, wxFrame *frame, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
+ EditorCanvas(wxView *view, wxFrame *frame, int *attribList, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
/************************************************************************
* PUBLIC FUNCTIONS
diff -ruN CELayoutEditor-0.7.1-old/src/EditorCanvas.cpp CELayoutEditor-0.7.1/src/EditorCanvas.cpp
--- CELayoutEditor-0.7.1-old/src/EditorCanvas.cpp 2010-01-01 18:54:45.000000000 +0000
+++ CELayoutEditor-0.7.1/src/EditorCanvas.cpp 2010-12-12 20:00:55.000000000 +0000
@@ -47,7 +47,7 @@
//////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------
-EditorCanvas::EditorCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size) :
+EditorCanvas::EditorCanvas(wxView *v, wxFrame *frame, int *attribList, const wxPoint& pos, const wxSize& size) :
// Store view
m_view(v),
@@ -58,7 +58,7 @@
mLastMouseX(-1),
mLastMouseY(-1),
-wxGLCanvas(frame, wx_static_cast(wxGLCanvas*, NULL), -1, pos, size, wxNO_BORDER )
+wxGLCanvas(frame, wx_static_cast(wxGLCanvas*, NULL), -1, pos, size, wxNO_BORDER, _("GLCanvas"), attribList)
{
// NOTE: Prefer constructor initialization lists (which are
// often more efficient) to assignment inside the
diff -ruN CELayoutEditor-0.7.1-old/src/EditorFrame.cpp CELayoutEditor-0.7.1/src/EditorFrame.cpp
--- CELayoutEditor-0.7.1-old/src/EditorFrame.cpp 2010-01-01 18:54:45.000000000 +0000
+++ CELayoutEditor-0.7.1/src/EditorFrame.cpp 2010-12-12 20:02:11.000000000 +0000
@@ -360,7 +360,8 @@
// Create the GLCanvas. This approach provides MDI support maybe in the future
//EditorCanvas* const canvas = new EditorCanvas(view, this, GetClientAreaOrigin(), wxDefaultSize);
- EditorCanvas* const canvas = new EditorCanvas(view, this, wxPoint(0,0), wxDefaultSize);
+ int attribList[] = {WX_GL_DOUBLEBUFFER, 0};
+ EditorCanvas* const canvas = new EditorCanvas(view, this, attribList, wxPoint(0,0), wxDefaultSize);
// Tell it about the initial size
//canvas->changeSize(width + BORDER_SIZE, height + BORDER_SIZE);
/EDITI am having the exact same problem as the original poster: same error message, when opening / creating a new layout (I'm assuming this means, "when beginning use of a wxwidgets OpenGL surface".
I built/installed v0.7.1 of the CELayoutEditor and am using the wxgtk v2.8.11-1 package on Arch Linux.
For what it's worth, regarding the error:
I recently was working with a wxWidgets-based project myself (same version of wxgtk), and I got this same X error, BadDrawable yadda yadda, for some time.
It ended up that this happened when I attempted to use the wxGLCanvas::SwapBuffers() function for a canvas that hadn't been initialized properly - that is, the "int attribList[]" that included WX_GL_DOUBLEBUFFER was not passed to my canvas's constructor. This was due to my following what appears to have been out-of-date / incorrect code.
Looking here:
http://wiki.wxwidgets.org/WxGLCanvasYou'll see in the example, the overridden constructor does not make use of (or in the first example, even -take-) the "int attribList[]". This caused the aforementioned X error when swapping buffers. (If I compile that example code, it gives me the BadDrawable error).
Others were apparently also encountering this problem lately:
https://bugs.launchpad.net/kicad/+bug/6 ... omments/11Perhaps the wxgtk implementation previously used WX_GL_DOUBLEBUFFER by default, and no longer does so? In any event, I'm sure there are other ways to get this error besides swapping buffers on a canvas that hasn't been initialized with double-buffer capability; thought I'd throw out my own recent experience.
CrazyEddie wrote:I'm not sure of the cause of this issue. First you should be aware that development on the existing editor code had ceased and by and large no further support for that will be provided. A replacement editor will be available fairly soon (a week, maybe two).
I wonder which version of wxWidgets you're using? I believe there are issues when using the 2.9.x versions. The last known / tested compatible version of wxWidgets is 2.8.11.
CE.