+ PIXELFORMATDESCRIPTOR pfd;
+ const int setupVal = DoSetup(pfd, attribList);
+ if ( setupVal == 0 ) // PixelFormat error
+ return false;
+
+ if ( setupVal == -1 ) // FSAA requested
+ {
+ // now that we have a valid OpenGL window, query it for FSAA support
+ int pixelFormat;
+ {
+ wxGLContext ctx(this);
+ ctx.SetCurrent(*this);
+ pixelFormat = ::ChoosePixelFormatARB(m_hDC, attribList);
+ }
+
+ if ( pixelFormat > 0 )
+ {
+ // from http://msdn.microsoft.com/en-us/library/ms537559(VS.85).aspx:
+ //
+ // Setting the pixel format of a window more than once can
+ // lead to significant complications for the Window Manager
+ // and for multithread applications, so it is not allowed. An
+ // application can only set the pixel format of a window one
+ // time. Once a window's pixel format is set, it cannot be
+ // changed.
+ //
+ // so we need to delete the old window and create the new one
+
+ // destroy Window
+ ::ReleaseDC(GetHwnd(), m_hDC);
+ m_hDC = 0;
+
+ parent->RemoveChild(this);
+ const HWND hwnd = GetHwnd();
+ DissociateHandle(); // will do SetHWND(0);
+ ::DestroyWindow(hwnd);
+
+ // now recreate with FSAA pixelFormat
+ if ( !CreateWindow(parent, id, pos, size, style, name) )
+ return false;
+
+ if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) )
+ {
+ wxLogLastError(_T("SetPixelFormat"));
+ return false;
+ }
+ }
+ }
+