Since changing from wxWidgets 2.9.3 to 3.1.2 (Win10 / MingW32), i have the problem, that additional wxGLCanvas-creation seem to crash the existing OpenGL-context. The program is executes normal, but there are textures 'getting lost', like this:
The first wxGLCanvas and the wxGLContext is created succesfully. After initialisation, of basic OpenGL-things, three textures (black, b/w-noise, hsv-noise) are created using glGenTextures(), which also works. The next step is to create a second wxGLCanvas. Further glGenTextures() return an invalid value and glGetError() returns GL_INVALID_OPERATION.
I tested it with both wxGLCanvas-constructors documented in the 3.1.2-reference. I have a small class "clsBuffer" that is used to organize textures. Each time, when an new instance of this class is created, there is allocated a texture. Also it logs the returned handle and the active texture and errors if there are. This class, i used to find the exact progeamline, where the OpenGL-context seems to get lost.
Here you see the version with wxGLAttributes:
Code: Select all
CTRLframe = new clsFrame (this, -1, GetTitle(), wxDefaultPosition, wxSize(1024, 630), wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxMINIMIZE_BOX | wxMAXIMIZE_BOX, "OUTPUT");
new clsBuffer ( 2, 2, "test 1" );
wxGLAttributes attrib; attrib.RGBA ().DoubleBuffer ().PlatformDefaults ( ) .EndList();
new clsBuffer ( 2, 2, "test 2" );
CTRLcanvas = new wxGLCanvas (CTRLframe, attrib ,-1, wxPoint(0,0), wxSize(1024, 630), 0);
new clsBuffer ( 2, 2, "test 3" );
When i later start rendering, the first textures still work but none of them that were created after the second wxGLCanvas. I also tested if, especially this one is the reason, but later wxGLCanvas calls have the same effect.
Is there anyone knowig a reson, why this might happen?
Best,
Frank