OpenGL double buffering in a panel RRS feed

  • Question

  • I am writing an application and want to use OpenGL double-buffered graphics in one panel and have standard CLR controls in other panels within the form.  I can render the OpenGL graphics fine, but the panel flickers because of the WM_ERASEBKGND processing before the Paint() method is called.  To get around this, one uses SetStyle() to set DoubleBuffer, AllPaintingInWmPaint & UserPaint to true - but of course you have to make your own Panel subclass since SetStyle() is protected.  After creating my OGLPanel class, I render the graphics in the Paint() method, and now the panel is being cleared by the OS AFTER I render and swap the buffers - leaving me with a blank panel :-(

    Does anyone know why the panel would be cleared after calling the Paint() method?
    • Moved by Zhi-Xin Ye Tuesday, July 29, 2008 11:07 AM better to post in Windows Forms fourms (Moved from Common Language Runtime to Off-Topic Posts (Do Not Post Here))
    Wednesday, July 23, 2008 11:36 AM