DemoCreateRenderingContext() public static method

public static DemoCreateRenderingContext ( uint &ref_uint_DC, uint &ref_uint_RC ) : void
ref_uint_DC uint
ref_uint_RC uint
return void
// ############################################################################
// ############################################################################
// ############################################################################
// ############################################################################

// ============================================================================
// The following can be used as an example of how to initialize OpenGL
// rendering.  A System.Windows.Forms object can use a window handle acquired
// from (uint)((this.Handle).ToInt32()) as the "HWND" parameter.
//
// Here is a crude illustration of the use of WGL.DemoInitOpenGL() by a Form:
//
//    // ----------------------------------------------------------------------
//    public static uint            m_uint_HWND = 0;
//    public static uint            m_uint_DC   = 0;
//    public static uint            m_uint_RC   = 0;
//
//    protected override void OnPaintBackground( PaintEventArgs e )
//    {
//    // This overrides the System.Windows.Forms.Control protected method
//    // "OnPaintBackground()" so that we don't clear the client area of
//    // this form window -- so the OpenGL doesn't flicker on each frame.
//    }
//
//    protected override void OnPaint( System.Windows.Forms.PaintEventArgs e )
//    {
//    if (0 == m_uint_RC)
//      {
//      m_uint_HWND = (uint)((this.Handle).ToInt32());
//      WGL.DemoInitOpenGL( m_uint_HWND, ref m_uint_DC, ref m_uint_RC );
//      }
//    if (0 != m_uint_RC)
//      {
//      WGL.DemoOpenGLDraw( this.Size.Width, this.Size.Height,  m_uint_DC );
//      }
//    System.Threading.Thread.Sleep( 10 ); // 10 msec --> 100 frames per second, max.
//    Invalidate(false); // Force OnPaint() to get called again.
//    }
//    // ----------------------------------------------------------------------
//
// ============================================================================
        public static void DemoInitOpenGL
        (
            uint uint_HWND,       // in
            ref uint ref_uint_DC, // out
            ref uint ref_uint_RC  // out
        )
        {
            ref_uint_DC = WGL.GetDC(uint_HWND);

            // CAUTION: Not doing the following WGL.wglSwapBuffers() on the DC will
            // result in a failure to subsequently create the RC.
            WGL.wglSwapBuffers(ref_uint_DC);

            WGL.DemoCreateRenderingContext(ref ref_uint_DC, ref ref_uint_RC);

            if (0 == ref_uint_RC)
            {
                WGL.MessageBox(0, "Failed to create OpenGL Rendering Context (RC)",
                               "WGL.DemoInitOpenGL() : ERROR", MB_OK);
                return;
            }
        }