96 PIXELFORMATDESCRIPTOR pfd;
106 depthbits = colorbits > 16 ? 24 : 16;
112 if (qwglChoosePixelFormatARB && multisamples > 1) {
116 iAttributes[0] = WGL_DRAW_TO_WINDOW_ARB;
117 iAttributes[1] = TRUE;
118 iAttributes[2] = WGL_SUPPORT_OPENGL_ARB;
119 iAttributes[3] = TRUE;
120 iAttributes[4] = WGL_DOUBLE_BUFFER_ARB;
121 iAttributes[5] = TRUE;
122 iAttributes[6] = WGL_PIXEL_TYPE_ARB;
123 iAttributes[7] = WGL_TYPE_RGBA_ARB;
124 iAttributes[8] = WGL_COLOR_BITS_ARB;
125 iAttributes[9] = colorbits;
126 iAttributes[10] = WGL_DEPTH_BITS_ARB;
127 iAttributes[11] = depthbits;
128 iAttributes[12] = WGL_STENCIL_BITS_ARB;
129 iAttributes[13] = stencilbits;
130 iAttributes[14] = WGL_SAMPLE_BUFFERS_ARB;
132 iAttributes[16] = WGL_SAMPLES_ARB;
133 iAttributes[17] = multisamples;
137 if (qwglChoosePixelFormatARB(
win.dc, iAttributes, NULL, 1, &pixelformat, &numFormats) == FALSE) {
141 if (numFormats == 0) {
142 Com_EPrintf(
"No suitable OpenGL pixelformat found for %d multisamples\n", multisamples);
146 memset(&pfd, 0,
sizeof(pfd));
147 pfd.nSize =
sizeof(pfd);
149 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
150 pfd.iPixelType = PFD_TYPE_RGBA;
151 pfd.cColorBits = colorbits;
152 pfd.cDepthBits = depthbits;
153 pfd.cStencilBits = stencilbits;
154 pfd.iLayerType = PFD_MAIN_PLANE;
157 if ((pixelformat = qwglChoosePixelFormat(
win.dc, &pfd)) == 0) {
162 if ((pixelformat = ChoosePixelFormat(
win.dc, &pfd)) == 0) {
171 qwglDescribePixelFormat(
win.dc, pixelformat,
sizeof(pfd), &pfd);
174 if (qwglSetPixelFormat(
win.dc, pixelformat, &pfd) == FALSE) {
179 DescribePixelFormat(
win.dc, pixelformat,
sizeof(pfd), &pfd);
182 if (SetPixelFormat(
win.dc, pixelformat, &pfd) == FALSE) {
189 if (pfd.dwFlags & PFD_GENERIC_FORMAT) {
191 Com_EPrintf(
"No hardware OpenGL acceleration detected\n");
194 Com_WPrintf(
"...using software emulation\n");
195 }
else if (pfd.dwFlags & PFD_GENERIC_ACCELERATED) {
196 Com_DPrintf(
"...MCD acceleration found\n");
197 win.flags |= QVF_ACCELERATED;
199 Com_DPrintf(
"...ICD acceleration found\n");
200 win.flags |= QVF_ACCELERATED;
204 if ((
glw.
hGLRC = qwglCreateContext(
win.dc)) == NULL) {