Capturing covered window area

Robin Dunn wrote:
> Normally you would just pass the wxPrinterDC to your draw method, but
> since that is in OpenGL in this case (and I don't know OpenGL that
> much) I'm not sure what to do. Is there any OpenGL functions to
> render a canvas to an image or something?

Yeah, this is what I've ended up doing to convert the GLCanvas to a wxImage. This is what I've ended up doing in case others have this problem... This is the simplest way I've found so far for printing an OpenGL widget.

     view = glGetIntegerv(GL_VIEWPORT)
     pixels = glReadPixels( 0, 0, view[2], view[3], GL_RGB, GL_UNSIGNED_BYTE) #

     img = wxEmptyImage(view[2], view[3] )
     img.SetData( pixels )
     img = img.Mirror(false)
     bmp = wxBitmapFromImage(img)

     dc.BeginDrawing()
     dc.DrawBitmap(bmp, 0,0,false)
     dc.EndDrawing()