]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/glcanvas.cpp
Better fix
[wxWidgets.git] / src / msw / glcanvas.cpp
index a95e48a54be6981ccbb149ff1fab0368433f4acb..edf2264d60c2707d2ba10daf46a2104de82eeee4 100644 (file)
@@ -200,12 +200,14 @@ wxGLContext::~wxGLContext()
     wglDeleteContext(m_glContext);
 }
 
-void wxGLContext::SetCurrent(const wxGLCanvas& win) const
+bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
 {
     if ( !wglMakeCurrent(win.GetHDC(), m_glContext) )
     {
         wxLogLastError(_T("wglMakeCurrent"));
+        return false;
     }
+    return true;
 }
 
 // ============================================================================
@@ -313,10 +315,14 @@ bool wxGLCanvas::Create(wxWindow *parent,
 // operations
 // ----------------------------------------------------------------------------
 
-void wxGLCanvas::SwapBuffers()
+bool wxGLCanvas::SwapBuffers()
 {
     if ( !::SwapBuffers(m_hDC) )
+    {
+        return false;
         wxLogLastError(_T("SwapBuffers"));
+    }
+    return true;
 }
 
 // ----------------------------------------------------------------------------
@@ -444,6 +450,14 @@ wxGLCanvas::ChooseMatchingPixelFormat(HDC hdc,
     return ::ChoosePixelFormat(hdc, ppfd);
 }
 
+/* static */
+bool wxGLCanvasBase::IsDisplaySupported(const int *attribList)
+{
+    // We need a device context to test the pixel format, so get one
+    // for the root window.
+    return wxGLCanvas::ChooseMatchingPixelFormat(ScreenHDC(), attribList) > 0;
+}
+
 bool wxGLCanvas::DoSetup(const int *attribList)
 {
     PIXELFORMATDESCRIPTOR pfd;