]> git.saurik.com Git - wxWidgets.git/commitdiff
document that SetCurrent() must be called on a visible window; assert that this is...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 31 May 2005 15:01:31 +0000 (15:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 31 May 2005 15:01:31 +0000 (15:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/glcanvas.tex
src/msw/glcanvas.cpp

index 8c5b4d66e147e337ecf9077f39f3544f8ce38dce..f0cbc168c6673dee6a3b8cb134dab82273afdcd7 100644 (file)
@@ -63,6 +63,7 @@ alpha channel, and accum buffer. Other implementations may support them.
 
 \latexignore{\rtfignore{\wxheading{Members}}}
 
+
 \membersection{wxGLCanvas::wxGLCanvas}\label{wxglcanvasconstr}
 
 \func{void}{wxGLCanvas}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id = -1}, \param{const wxPoint\&}{ pos},
@@ -110,12 +111,14 @@ and so on.
 \docparam{palette}{If the window has the palette, it should by pass this value.
 Note: palette and WX\_GL\_RGBA are mutually exclusive.}
 
+
 \membersection{wxGLCanvas::GetContext}\label{wxglcanvasgetcontext}
 
 \func{wxGLContext*}{GetContext}{\void}
 
 Obtains the context that is associated with this canvas.
 
+
 \membersection{wxGLCanvas::SetCurrent}\label{wxglcanvassetcurrent}
 
 \func{void}{SetCurrent}{\void}
@@ -125,12 +128,16 @@ Each canvas contains an OpenGL device context that has been created during
 the creation of this window. So this call sets the current device context
 as the target device context for OpenGL operations.
 
+Note that this function may only be called after the window has been shown.
+
+
 \membersection{wxGLCanvas::SetColour}\label{wxglcanvassetcolour}
 
 \func{void}{SetColour}{\param{const char*}{ colour}}
 
 Sets the current colour for this window, using the wxWidgets colour database to find a named colour.
 
+
 \membersection{wxGLCanvas::SwapBuffers}\label{wxglcanvasswapbuffers}
 
 \func{void}{SwapBuffers}{\void}
index 21e44ab4b556406b35cfdd294c152a5e00bcddeb..d0867503fae02cdf003fc9b3ddb6ff78a30d334e 100644 (file)
@@ -243,11 +243,6 @@ void wxGLContext::SetCurrent()
   {
     wglMakeCurrent((HDC) m_hDC, m_glContext);
   }
-
-  /*
-  setupPixelFormat(hDC);
-  setupPalette(hDC);
-  */
 }
 
 void wxGLContext::SetColour(const wxChar *colour)
@@ -586,6 +581,12 @@ void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
 
 void wxGLCanvas::SetCurrent()
 {
+  // although on MSW it works even if the window is still hidden, it doesn't
+  // under wxGTK and documentation mentions that SetCurrent() can only be
+  // called for a shown window, so check it
+  wxASSERT_MSG( GetParent()->IsShown(),
+                    _T("can't make hidden GL canvas current") );
+
   if (m_glContext)
   {
     m_glContext->SetCurrent();