是否可以提供一点入门级的学习资料,代码等等。不胜感激!

解决方案 »

  1.   

    不大懂你说的意思,描述一下你的问题
    OpenGL的硬件加速是显卡已经在硬件中实现了的,只要你是使用并且配置好OpenGL,就会有“加速”的效果阿
      

  2.   

    我觉得虽然你做的东西是纯软件的,但毕竟是OpenGL做的,是OpenGL做的程序,就能够用到显卡的硬件加速功能
    一小段初始化OpenGL的代码,基本都是这么写吧
    static PIXELFORMATDESCRIPTOR pfd = 
    {
            sizeof(PIXELFORMATDESCRIPTOR),  // size of this pfd
            1,                              // version number
    // PFD_SWAP_EXCHANGE|
            PFD_DRAW_TO_WINDOW |            // support window
            PFD_SUPPORT_OPENGL ,          // support OpenGL
            PFD_TYPE_RGBA,                  // RGBA type
            24,                             // 24-bit color depth
            0, 0, 0, 0, 0, 0,               // color bits ignored
            0,                              // no alpha buffer
            0,                              // shift bit ignored
            0,                              // no accumulation buffer
            0, 0, 0, 0,                     // accum bits ignored
            pPresent->bDepthBits,           // 32-bit z-buffer
            pPresent->bStencilBits,         // no stencil buffer
            0,                              // no auxiliary buffer
            PFD_MAIN_PLANE,                 // main layer
            0,                              // reserved
            0, 0, 0                         // layer masks ignored
        };
        int pixelformat;
    HDC  hDC;
    HGLRC hglRC; //
    assert(pPresent);
    if(!pPresent)
    return RESULT_POINTER_INVALID;
    // (* ppDevice)=NULL;
    hDC=pPresent->hDC;
    if(DeviceType==CGI_DEVICETYPE_ACCELERATOR)
    pfd.dwFlags|=PFD_GENERIC_ACCELERATED;
    else
    pfd.dwFlags|=PFD_GENERIC_FORMAT;
    if(pPresent->uBackBufferCounts>=1)
    pfd.dwFlags|=PFD_DOUBLEBUFFER;    if((pixelformat=GetMatchPixelFormat(hDC,pfd))==0)
        {
    if((pixelformat = ChoosePixelFormat(hDC, &pfd)) == 0 )
    {
    return RESULT_CHOOSEPIXEL_FAIL;
    }
        }
        if(SetPixelFormat(hDC,pixelformat,&pfd)== FALSE)
        {
    return RESULT_SETPIXEL_FAIL;
        } hglRC=wglCreateContext(hDC);
    if(hglRC==NULL)
    return RESULT_CREATECONTEXT_FAIL; (*ppDevice)=new CxGiDevice1;
    (*ppDevice)->m_hDC=pPresent->hDC;
    (*ppDevice)->m_hglRC=hglRC;
    DescribePixelFormat(hDC,pixelformat,sizeof(pfd),&pfd);
    if((pfd.dwFlags&PFD_DOUBLEBUFFER)==PFD_DOUBLEBUFFER)
    pPresent->uBackBufferCounts=1;
    else
    pPresent->uBackBufferCounts=0;
    pPresent->bDepthBits=pfd.cDepthBits;
    pPresent->bStencilBits=pfd.cStencilBits;
    return RESULT_SUCCESS;
      

  3.   

    pPresent是当前窗口的句柄吗?
    DeviceType是如何得到的呢?
    CGI_DEVICETYPE_ACCELERATOR在MSDN里面查不到,是否使用了什么类库?
    pfd是怎样定义的结构?
      

  4.   

    你有信箱吗?这样子的话交流方便一些
    我这个程序是一个应用程序里面摘抄下来的,可能不能运行,我的意思只是想告诉你所有的OpenGL的初始化基本都是这个样子的
      

  5.   

    我这里收集了一堆OpenGL的例子,大概30M,你要不?
    有一本书较OpenGL宝典,我觉得不错,不知道你看过没有
      

  6.   

    谢谢薄荷了,呵呵,我的信箱是可[email protected]
    我想要你的例子啊,这么大上传吗?
    还有什么书?