2009-07-30 13 views

答えて

2

私はどんなウィンドウのコンテキストにも描画できると思います。
シンプルにHWNDを取得し、コンテキスト作成に使用します。

void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC) 
{ 
    PIXELFORMATDESCRIPTOR pfd; 
    int iFormat; 

    // get the device context (DC) 
    *hDC = GetDC(hWnd); 

    // set the pixel format for the DC 
    ZeroMemory(&pfd, sizeof(pfd)); 
    pfd.nSize = sizeof(pfd); 
    pfd.nVersion = 1; 
    pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | 
        PFD_DOUBLEBUFFER; 
    pfd.iPixelType = PFD_TYPE_RGBA; 
    pfd.cColorBits = 24; 
    pfd.cDepthBits = 16; 
    pfd.iLayerType = PFD_MAIN_PLANE; 
    iFormat = ChoosePixelFormat(*hDC, &pfd); 
    SetPixelFormat(*hDC, iFormat, &pfd); 

    // create and enable the render context (RC) 
    *hRC = wglCreateContext(*hDC); 
    wglMakeCurrent(*hDC, *hRC); 
} 
1

私はピクチャボックスにそれを置くために管理してきた、modificationthis exampleを使用して、あなただけのPictureBox(以前のフォーム)にCOpenGLコンストラクタを変更する必要があります。しかし、とにかく最後のピクチャボックスだけがレンダリングされます。まだそれに取り組んで...

関連する問題