]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/glcanvas.cpp
make XPM data pointer parameter fully const
[wxWidgets.git] / src / mac / carbon / glcanvas.cpp
index fb67a575944c31c33876701fd3b75c9f6eeca02c..b3a2a81245e557c7ebc9dac55e05e17db71ae795 100644 (file)
@@ -63,10 +63,6 @@ wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other)
                                     other ? other->m_aglContext : NULL);
     if ( !m_aglContext )
         wxLogAGLError("aglCreateContext");
-
-    return;
-    if ( !aglEnable(m_aglContext, AGL_BUFFER_RECT) )
-        wxLogAGLError("aglEnable(AGL_BUFFER_RECT)");
 }
 
 wxGLContext::~wxGLContext()
@@ -79,20 +75,27 @@ wxGLContext::~wxGLContext()
     }
 }
 
-void wxGLContext::SetCurrent(const wxGLCanvas& win) const
+bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
 {
     if ( !m_aglContext )
-        return;
+        return false;
 
-    AGLDrawable drawable = (AGLDrawable)UMAGetWindowPort(
+    AGLDrawable drawable = (AGLDrawable)GetWindowPort(
                                 MAC_WXHWND(win.MacGetTopLevelWindowRef()));
     if ( !aglSetDrawable(m_aglContext, drawable) )
+    {
         wxLogAGLError("aglSetDrawable");
+        return false;
+    }
 
     if ( !aglSetCurrentContext(m_aglContext) )
+    {
         wxLogAGLError("aglSetCurrentContext");
+        return false;
+    }
 
     wx_const_cast(wxGLCanvas&, win).SetViewport();
+    return true;
 }
 
 // ----------------------------------------------------------------------------
@@ -309,12 +312,13 @@ wxGLCanvas::~wxGLCanvas()
         aglDestroyPixelFormat(m_aglFormat);
 }
 
-void wxGLCanvas::SwapBuffers()
+bool wxGLCanvas::SwapBuffers()
 {
     AGLContext context = aglGetCurrentContext();
-    wxCHECK_RET( context, _T("should have current context") );
+    wxCHECK_MSG(context, false, _T("should have current context"));
 
     aglSwapBuffers(context);
+    return true;
 }
 
 void wxGLCanvas::SetViewport()
@@ -363,9 +367,13 @@ void wxGLCanvas::SetViewport()
         parms[0] += 20000;
 
     if ( !aglSetInteger(context, AGL_BUFFER_RECT, parms) )
-    {
         wxLogAGLError("aglSetInteger(AGL_BUFFER_RECT)");
-    }
+
+    if ( !aglEnable(context, AGL_BUFFER_RECT) )
+        wxLogAGLError("aglEnable(AGL_BUFFER_RECT)");
+
+    if ( !aglUpdateContext(context) )
+        wxLogAGLError("aglUpdateContext");
 }
 
 void wxGLCanvas::OnSize(wxSizeEvent& event)