+
+// ----------------------------------------------------------------------------
+// MyApp: the application object
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_APP(MyApp)
+
+bool MyApp::OnInit()
+{
+ if ( !wxApp::OnInit() )
+ return false;
+
+ new MyFrame();
+
+ return true;
+}
+
+int MyApp::OnExit()
+{
+ delete m_glContext;
+
+ return wxApp::OnExit();
+}
+
+TestGLContext& MyApp::GetContext(wxGLCanvas *canvas)
+{
+ if ( !m_glContext )
+ {
+ // Create the OpenGL context for the first window which needs it:
+ // subsequently created windows will all share the same context.
+ m_glContext = new TestGLContext(canvas);
+ }
+
+ m_glContext->SetCurrent(*canvas);
+
+ return *m_glContext;
+}
+