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;
}
// ============================================================================
wxGLCanvas::~wxGLCanvas()
{
-#if WXWIN_COMPATIBILITY_2_8
- delete m_glContext;
-#endif
-
::ReleaseDC(GetHwnd(), m_hDC);
}
// operations
// ----------------------------------------------------------------------------
-void wxGLCanvas::SwapBuffers()
+bool wxGLCanvas::SwapBuffers()
{
if ( !::SwapBuffers(m_hDC) )
+ {
+ return false;
wxLogLastError(_T("SwapBuffers"));
+ }
+ return true;
}
// ----------------------------------------------------------------------------
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;