打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
8《高效学习OpenGL》之 openGL设置窗口像素格式
  1. PIXELFORMATDESCRIPTOR pfd = {  
  2.         sizeof(PIXELFORMATDESCRIPTOR),    // Size Of This Pixel Format Descriptor  
  3.         1,                  // Version Number  
  4.         PFD_DRAW_TO_WINDOW |         // Format Must Support Window  
  5.         PFD_SUPPORT_OPENGL |         // Format Must Support OpenGL  
  6.         PFD_DOUBLEBUFFER,           // Must Support Double Buffering  
  7.         PFD_TYPE_RGBA,            // Request An RGBA Format  
  8.         24,                  // Select Our Color Depth  
  9.         0, 0, 0, 0, 0, 0,           // Color Bits Ignored  
  10.         0,                  // No Alpha Buffer  
  11.         0,                  // Shift Bit Ignored  
  12.         0,                  // No Accumulation Buffer  
  13.         0, 0, 0, 0,              // Accumulation Bits Ignored  
  14.         32,                  // 16Bit Z-Buffer (Depth Buffer)    
  15.         0,                  // No Stencil Buffer  
  16.         0,                  // No Auxiliary Buffer  
  17.         PFD_MAIN_PLANE,            // Main Drawing Layer  
  18.         0,                  // Reserved  
  19.         0, 0, 0                // Layer Masks Ignored  
  20.     };<pre code_snippet_id="166348" snippet_file_name="blog_20140122_1_8091549" name="code" class="cpp">//在DC中选择合适的像素格式并返回索引号  
  21.     int pixelFomat;  
  22.     pixelFomat = ::ChoosePixelFormat(m_pDC->GetSafeHdc(), &pfd);  
  23.     if (pixelFomat == 0)  
  24.     {  
  25.         MessageBox(L"选择像素模式失败!", L"设置像素格式", MB_ICONERROR);  
  26.         return FALSE;  
  27.     }  
  28.     //设置指定像素格式  
  29.     if(::SetPixelFormat(m_pDC->GetSafeHdc(), pixelFomat, &pfd) == FALSE)  
  30.     {  
  31.         MessageBox(L"设置像素模式失败!", L"设置像素格式", MB_ICONERROR);  
  32.         return FALSE;  
  33.     }</pre><br>  
  34. <pre></pre>  
  35. <br>  
  36.      
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
OpenGL(非常值得借鉴)
基于MFC的OpenGL绘图
VC(MFC)开发OPENGL程序
OpenGL游戏学习一:MFC下OpenGL环境的搭建
OpenGL三角形的双面不同颜色的绘制
OpenGL ES2.0 基本编程
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服