X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dc3065a56f1febf3de3b3bbf0904cf8fdc7f7c50..dd9f8b6bb6935360a8271dc3e8749fb026b601a8:/src/msw/glcanvas.cpp diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp index a95e48a54b..edf2264d60 100644 --- a/src/msw/glcanvas.cpp +++ b/src/msw/glcanvas.cpp @@ -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;