这篇教程C++ ChoosePixelFormat函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ChoosePixelFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ ChoosePixelFormat函数的具体用法?C++ ChoosePixelFormat怎么用?C++ ChoosePixelFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ChoosePixelFormat函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CreateWindowGLvoid CreateWindowGL (gl_window_t *win) // This Code Creates Our OpenGL Window{ __int64 timer; // Holds High Resolution Timer Information DWORD windowStyle = WS_OVERLAPPEDWINDOW; // Define Our Window Style DWORD windowExtendedStyle = WS_EX_APPWINDOW; // Define The Window's Extended Style PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof (PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format win->init.bitsPerPixel, // Select Our 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, // Accumulation Bits Ignored 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; RECT windowRect = {0, 0, win->init.width, win->init.height}; // Define Our Window Coordinates GLuint PixelFormat; // Will Hold The Selected Pixel Format if (win->init.isFullScreen == TRUE) // Fullscreen Requested, Try Changing Video Modes { if (ChangeScreenResolution (win->init.width, win->init.height, win->init.bitsPerPixel) == FALSE) { // Fullscreen Mode Failed. Run In Windowed Mode Instead MessageBox (HWND_DESKTOP, "Mode Switch Failed./nRunning In Windowed Mode.", "Error", MB_OK | MB_ICONEXCLAMATION); win->init.isFullScreen = FALSE; // Set isFullscreen To False (Windowed Mode) } else // Otherwise (If Fullscreen Mode Was Successful) { ShowCursor (FALSE); // Turn Off The Cursor windowStyle = WS_POPUP; // Set The WindowStyle To WS_POPUP (Popup Window) windowExtendedStyle |= WS_EX_TOPMOST; // Set The Extended Window Style To WS_EX_TOPMOST } // (Top Window Covering Everything Else) } else // If Fullscreen Was Not Selected { // Adjust Window, Account For Window Borders AdjustWindowRectEx (&windowRect, windowStyle, 0, windowExtendedStyle); } // Create The OpenGL Window win->hWnd = CreateWindowExA (windowExtendedStyle, // Extended Style win->init.application->className, // Class Name win->init.title, // Window Title windowStyle, // Window Style win->init.left, win->init.top, // Window X,Y Position windowRect.right - windowRect.left, // Window Width windowRect.bottom - windowRect.top, // Window Height HWND_DESKTOP, // Desktop Is Window's Parent 0, // No Menu win->init.application->hInstance, // Pass The Window Instance win); if (win->hWnd == 0) // Was Window Creation A Success? { win->isCreated = FALSE; return; } win->hDC = GetDC (win->hWnd); // Grab A Device Context For This Window if (win->hDC == 0) // Did We Get A Device Context? { // Failed DestroyWindow (win->hWnd); // Destroy The Window win->hWnd = 0; // Zero The Window Handle win->isCreated = FALSE; return; // Return False } PixelFormat = ChoosePixelFormat (win->hDC, &pfd); // Find A Compatible Pixel Format if (PixelFormat == 0) // Did We Find A Compatible Format? { // Failed ReleaseDC (win->hWnd, win->hDC); // Release Our Device Context win->hDC = 0; // Zero The Device Context DestroyWindow (win->hWnd); // Destroy The Window win->hWnd = 0; // Zero The Window Handle win->isCreated = FALSE; return; // Return False } if (SetPixelFormat (win->hDC, PixelFormat, &pfd) == FALSE) // Try To Set The Pixel Format { // Failed ReleaseDC (win->hWnd, win->hDC); // Release Our Device Context win->hDC = 0; // Zero The Device Context DestroyWindow (win->hWnd); // Destroy The Window//.........这里部分代码省略.........
开发者ID:kungfooman,项目名称:easygl,代码行数:101,
示例2: throw//.........这里部分代码省略......... tmp += "rgba"; DJV_LOG(context->debugLog(), "djvWglContext", QString("Pixel format %1: %2 %3/%4/%5/%6/%7"). arg(i). arg(tmp.join(" ")). arg(pixelFormatInfo.cColorBits). arg(pixelFormatInfo.cRedBits). arg(pixelFormatInfo.cGreenBits). arg(pixelFormatInfo.cBlueBits). arg(pixelFormatInfo.cAlphaBits)); } PIXELFORMATDESCRIPTOR pixelFormat = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; int pixelFormatId = ChoosePixelFormat(_p->device, &pixelFormat); //DJV_DEBUG_PRINT("pixel format = " << pixelFormatId); DJV_LOG(context->debugLog(), "djvWglContext", QString("Chosen pixel format: %1").arg(pixelFormatId)); if (! pixelFormatId) { throw djvError( "djvWglContext", errorLabels()[ERROR_GET_PIXEL_FORMAT].arg(int(GetLastError()))); } if (! SetPixelFormat(_p->device, pixelFormatId, &pixelFormat)) { throw djvError( "djvWglContext", errorLabels()[ERROR_SET_PIXEL_FORMAT].arg(int(GetLastError()))); } // Create OpengGL context. DJV_LOG(context->debugLog(), "djvWglContext", "Creating OpenGL context..."); _p->context = wglCreateContext(_p->device); if (! _p->context) { throw djvError( "djvWglContext", errorLabels()[ERROR_CREATE_CONTEXT].arg(int(GetLastError()))); }
开发者ID:sobotka,项目名称:djv-view,代码行数:67,
示例3: WIN_GL_SetupWindow//.........这里部分代码省略......... } if ( this->gl_config.stereo ) { *iAttr++ = WGL_STEREO_ARB; *iAttr++ = GL_TRUE; } if ( this->gl_config.multisamplebuffers ) { *iAttr++ = WGL_SAMPLE_BUFFERS_ARB; *iAttr++ = this->gl_config.multisamplebuffers; } if ( this->gl_config.multisamplesamples ) { *iAttr++ = WGL_SAMPLES_ARB; *iAttr++ = this->gl_config.multisamplesamples; } if ( this->gl_config.accelerated >= 0 ) { *iAttr++ = WGL_ACCELERATION_ARB; *iAttr++ = (this->gl_config.accelerated ? WGL_GENERIC_ACCELERATION_ARB : WGL_NO_ACCELERATION_ARB); } *iAttr = 0; for ( i=0; ; ++i ) { /* Get the window device context for our OpenGL drawing */ GL_hdc = GetDC(SDL_Window); if ( GL_hdc == NULL ) { SDL_SetError("Unable to get DC for SDL_Window"); return(-1); } /* Choose and set the closest available pixel format */ pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs); if ( !pixel_format ) { pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd); } if ( !pixel_format ) { SDL_SetError("No matching GL pixel format available"); return(-1); } if ( !SetPixelFormat(GL_hdc, pixel_format, &GL_pfd) ) { if ( i == 0 ) { /* First time through, try resetting the window */ if ( WIN_GL_ResetWindow(this) < 0 ) { return(-1); } continue; } SDL_SetError("Unable to set HDC pixel format"); return(-1); } /* We either succeeded or failed by this point */ break; } DescribePixelFormat(GL_hdc, pixel_format, sizeof(GL_pfd), &GL_pfd); GL_hrc = this->gl_data->wglCreateContext(GL_hdc); if ( GL_hrc == NULL ) { SDL_SetError("Unable to create GL context"); return(-1); } if ( WIN_GL_MakeCurrent(this) < 0 ) { return(-1); } gl_active = 1;
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:67,
示例4: sizeofint CGraphics::InitAll() { GLuint PixelFormat; //Contiene el formato de pixel static PIXELFORMATDESCRIPTOR pfd= //Contiene la informacion del formato del pixel { sizeof(PIXELFORMATDESCRIPTOR), //Tama C++ ChopWindingInPlace函数代码示例 C++ ChooseFont函数代码示例
|