VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/wgl.c@ 28347

Last change on this file since 28347 was 21954, checked in by vboxsync, 15 years ago

crOpenGL: fix stack corruption leading to crash when running call of duty

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 19.7 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_error.h"
8#include "cr_spu.h"
9#include "cr_environment.h"
10#include "stub.h"
11
12/* I *know* most of the parameters are unused, dammit. */
13#pragma warning( disable: 4100 )
14
15#define WIN32_LEAN_AND_MEAN
16#include <windows.h>
17#include <stdio.h>
18
19static GLuint desiredVisual = CR_RGB_BIT;
20
21
22/**
23 * Compute a mask of CR_*_BIT flags which reflects the attributes of
24 * the pixel format of the given hdc.
25 */
26static GLuint ComputeVisBits( HDC hdc )
27{
28 PIXELFORMATDESCRIPTOR pfd;
29 int iPixelFormat;
30 GLuint b = 0;
31
32 iPixelFormat = GetPixelFormat( hdc );
33
34 DescribePixelFormat( hdc, iPixelFormat, sizeof(pfd), &pfd );
35
36 if (pfd.cDepthBits > 0)
37 b |= CR_DEPTH_BIT;
38 if (pfd.cAccumBits > 0)
39 b |= CR_ACCUM_BIT;
40 if (pfd.cColorBits > 8)
41 b |= CR_RGB_BIT;
42 if (pfd.cStencilBits > 0)
43 b |= CR_STENCIL_BIT;
44 if (pfd.cAlphaBits > 0)
45 b |= CR_ALPHA_BIT;
46 if (pfd.dwFlags & PFD_DOUBLEBUFFER)
47 b |= CR_DOUBLE_BIT;
48 if (pfd.dwFlags & PFD_STEREO)
49 b |= CR_STEREO_BIT;
50
51 return b;
52}
53
54int WINAPI wglChoosePixelFormat_prox( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
55{
56 DWORD okayFlags;
57
58 stubInit();
59
60 /*
61 * NOTE!!!
62 * Here we're telling the renderspu not to use the GDI
63 * equivalent's of ChoosePixelFormat/DescribePixelFormat etc
64 * There are subtle differences in the use of these calls.
65 */
66 crSetenv("CR_WGL_DO_NOT_USE_GDI", "yes");
67
68 if ( pfd->nSize != sizeof(*pfd) || pfd->nVersion != 1 ) {
69 crError( "wglChoosePixelFormat: bad pfd\n" );
70 return 0;
71 }
72
73 okayFlags = ( PFD_DRAW_TO_WINDOW |
74 PFD_SUPPORT_GDI |
75 PFD_SUPPORT_OPENGL |
76 PFD_DOUBLEBUFFER |
77 PFD_DOUBLEBUFFER_DONTCARE |
78 PFD_SWAP_EXCHANGE |
79 PFD_SWAP_COPY |
80 PFD_STEREO |
81 PFD_STEREO_DONTCARE |
82 PFD_DEPTH_DONTCARE );
83 if ( pfd->dwFlags & ~okayFlags ) {
84 crWarning( "wglChoosePixelFormat: only support flags=0x%x, but you gave me flags=0x%x", okayFlags, pfd->dwFlags );
85 return 0;
86 }
87
88 if ( pfd->iPixelType != PFD_TYPE_RGBA ) {
89 crError( "wglChoosePixelFormat: only support RGBA\n" );
90 }
91
92 if ( pfd->cColorBits > 32 ||
93 pfd->cRedBits > 8 ||
94 pfd->cGreenBits > 8 ||
95 pfd->cBlueBits > 8 ||
96 pfd->cAlphaBits > 8 ) {
97 crWarning( "wglChoosePixelFormat: too much color precision requested\n" );
98 }
99
100 if ( pfd->dwFlags & PFD_DOUBLEBUFFER )
101 desiredVisual |= CR_DOUBLE_BIT;
102
103 if ( pfd->dwFlags & PFD_STEREO )
104 desiredVisual |= CR_STEREO_BIT;
105
106 if ( pfd->cColorBits > 8)
107 desiredVisual |= CR_RGB_BIT;
108
109 if ( pfd->cAccumBits > 0 ||
110 pfd->cAccumRedBits > 0 ||
111 pfd->cAccumGreenBits > 0 ||
112 pfd->cAccumBlueBits > 0 ||
113 pfd->cAccumAlphaBits > 0 ) {
114 crWarning( "wglChoosePixelFormat: asked for accumulation buffer, ignoring\n" );
115 }
116
117 if ( pfd->cAccumBits > 0 )
118 desiredVisual |= CR_ACCUM_BIT;
119
120 if ( pfd->cDepthBits > 32 ) {
121 crError( "wglChoosePixelFormat; asked for too many depth bits\n" );
122 }
123
124 if ( pfd->cDepthBits > 0 )
125 desiredVisual |= CR_DEPTH_BIT;
126
127 if ( pfd->cStencilBits > 8 ) {
128 crError( "wglChoosePixelFormat: asked for too many stencil bits\n" );
129 }
130
131 if ( pfd->cStencilBits > 0 )
132 desiredVisual |= CR_STENCIL_BIT;
133
134 if ( pfd->cAuxBuffers > 0 ) {
135 crError( "wglChoosePixelFormat: asked for aux buffers\n" );
136 }
137
138 if ( pfd->iLayerType != PFD_MAIN_PLANE ) {
139 crError( "wglChoosePixelFormat: asked for a strange layer\n" );
140 }
141
142 return 1;
143}
144
145BOOL WINAPI wglSetPixelFormat_prox( HDC hdc, int pixelFormat,
146 CONST PIXELFORMATDESCRIPTOR *pdf )
147{
148 if ( pixelFormat != 1 ) {
149 crError( "wglSetPixelFormat: pixelFormat=%d?\n", pixelFormat );
150 }
151
152 return 1;
153}
154
155BOOL WINAPI wglDeleteContext_prox( HGLRC hglrc )
156{
157 stubDestroyContext( (unsigned long) hglrc );
158 return 1;
159}
160
161BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc )
162{
163 ContextInfo *context;
164 WindowInfo *window;
165
166 context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
167 window = stubGetWindowInfo(hdc);
168
169 return stubMakeCurrent( window, context );
170}
171
172HGLRC WINAPI wglGetCurrentContext_prox( void )
173{
174 return (HGLRC) stub.currentContext;
175}
176
177HDC WINAPI wglGetCurrentDC_prox( void )
178{
179 if (stub.currentContext && stub.currentContext->currentDrawable)
180 return (HDC) stub.currentContext->currentDrawable->drawable;
181 else
182 return (HDC) NULL;
183}
184
185int WINAPI wglGetPixelFormat_prox( HDC hdc )
186{
187 /* this is what we call our generic pixelformat, regardless of the HDC */
188 return 1;
189}
190
191int WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes,
192 LPPIXELFORMATDESCRIPTOR pfd )
193{
194/* if ( pixelFormat != 1 ) {
195 * crError( "wglDescribePixelFormat: pixelFormat=%d?\n", pixelFormat );
196 * return 0;
197 * } */
198
199 if ( !pfd ) {
200 crWarning( "wglDescribePixelFormat: pfd=NULL\n" );
201 return 1; /* There's only one, baby */
202 }
203
204 if ( nBytes != sizeof(*pfd) ) {
205 crWarning( "wglDescribePixelFormat: nBytes=%u?\n", nBytes );
206 return 1; /* There's only one, baby */
207 }
208
209 pfd->nSize = sizeof(*pfd);
210 pfd->nVersion = 1;
211 pfd->dwFlags = ( PFD_DRAW_TO_WINDOW |
212 PFD_SUPPORT_GDI |
213 PFD_SUPPORT_OPENGL |
214 PFD_DOUBLEBUFFER );
215 pfd->iPixelType = PFD_TYPE_RGBA;
216 pfd->cColorBits = 32;
217 pfd->cRedBits = 8;
218 pfd->cRedShift = 24;
219 pfd->cGreenBits = 8;
220 pfd->cGreenShift = 16;
221 pfd->cBlueBits = 8;
222 pfd->cBlueShift = 8;
223 pfd->cAlphaBits = 8;
224 pfd->cAlphaShift = 0;
225 pfd->cAccumBits = 0;
226 pfd->cAccumRedBits = 0;
227 pfd->cAccumGreenBits = 0;
228 pfd->cAccumBlueBits = 0;
229 pfd->cAccumAlphaBits = 0;
230 pfd->cDepthBits = 32;
231 pfd->cStencilBits = 8;
232 pfd->cAuxBuffers = 0;
233 pfd->iLayerType = PFD_MAIN_PLANE;
234 pfd->bReserved = 0;
235 pfd->dwLayerMask = 0;
236 pfd->dwVisibleMask = 0;
237 pfd->dwDamageMask = 0;
238
239 /* the max PFD index */
240 return 1;
241}
242
243BOOL WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
244{
245 crWarning( "wglShareLists: unsupported" );
246 return 0;
247}
248
249
250HGLRC WINAPI wglCreateContext_prox( HDC hdc )
251{
252 char dpyName[MAX_DPY_NAME];
253 ContextInfo *context;
254
255 stubInit();
256
257 CRASSERT(stub.contextTable);
258
259 sprintf(dpyName, "%d", hdc);
260 if (stub.haveNativeOpenGL)
261 desiredVisual |= ComputeVisBits( hdc );
262
263 context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0);
264 if (!context)
265 return 0;
266
267 return (HGLRC) context->id;
268}
269
270BOOL WINAPI
271wglSwapBuffers_prox( HDC hdc )
272{
273 const WindowInfo *window = stubGetWindowInfo(hdc);
274 stubSwapBuffers( window, 0 );
275 return 1;
276}
277
278BOOL WINAPI wglCopyContext_prox( HGLRC src, HGLRC dst, UINT mask )
279{
280 crWarning( "wglCopyContext: unsupported" );
281 return 0;
282}
283
284HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane )
285{
286 stubInit();
287 crWarning( "wglCreateLayerContext: unsupported" );
288 return 0;
289}
290
291PROC WINAPI wglGetProcAddress_prox( LPCSTR name )
292{
293 return (PROC) crGetProcAddress( name );
294}
295
296BOOL WINAPI wglUseFontBitmapsA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
297{
298 crWarning( "wglUseFontBitmapsA: unsupported" );
299 return 0;
300}
301
302BOOL WINAPI wglUseFontBitmapsW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
303{
304 crWarning( "wglUseFontBitmapsW: unsupported" );
305 return 0;
306}
307
308BOOL WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane,
309 UINT nBytes, LPLAYERPLANEDESCRIPTOR lpd )
310{
311 crWarning( "wglDescribeLayerPlane: unimplemented" );
312 return 0;
313}
314
315int WINAPI wglSetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
316 int entries, CONST COLORREF *cr )
317{
318 crWarning( "wglSetLayerPaletteEntries: unsupported" );
319 return 0;
320}
321
322int WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
323 int entries, COLORREF *cr )
324{
325 crWarning( "wglGetLayerPaletteEntries: unsupported" );
326 return 0;
327}
328
329BOOL WINAPI wglRealizeLayerPalette_prox( HDC hdc, int layerPlane, BOOL realize )
330{
331 crWarning( "wglRealizeLayerPalette: unsupported" );
332 return 0;
333}
334
335DWORD WINAPI wglSwapMultipleBuffers_prox( UINT a, CONST void *b )
336{
337 crWarning( "wglSwapMultipleBuffer: unsupported" );
338 return 0;
339}
340
341BOOL WINAPI wglUseFontOutlinesA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
342 FLOAT deviation, FLOAT extrusion, int format,
343 LPGLYPHMETRICSFLOAT gmf )
344{
345 crWarning( "wglUseFontOutlinesA: unsupported" );
346 return 0;
347}
348
349BOOL WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
350 FLOAT deviation, FLOAT extrusion, int format,
351 LPGLYPHMETRICSFLOAT gmf )
352{
353 crWarning( "wglUseFontOutlinesW: unsupported" );
354 return 0;
355}
356
357BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes )
358{
359 crWarning( "wglSwapLayerBuffers: unsupported" );
360 return 0;
361}
362
363BOOL WINAPI wglChoosePixelFormatEXT_prox
364(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
365{
366 int *pi;
367 int wants_rgb = 0;
368
369 stubInit();
370
371 /* TODO : Need to check pfAttributes too ! */
372
373 for ( pi = (int *)piAttributes; *pi != 0; pi++ )
374 {
375 switch ( *pi )
376 {
377 case WGL_COLOR_BITS_EXT:
378 if (pi[1] > 8)
379 wants_rgb = 1;
380 pi++;
381 break;
382
383 case WGL_RED_BITS_EXT:
384 case WGL_GREEN_BITS_EXT:
385 case WGL_BLUE_BITS_EXT:
386 if (pi[1] > 3)
387 wants_rgb = 1;
388 pi++;
389 break;
390
391 case WGL_ACCUM_ALPHA_BITS_EXT:
392 case WGL_ALPHA_BITS_EXT:
393 if (pi[1] > 0)
394 desiredVisual |= CR_ALPHA_BIT;
395 pi++;
396 break;
397
398 case WGL_DOUBLE_BUFFER_EXT:
399 if (pi[1] > 0)
400 desiredVisual |= CR_DOUBLE_BIT;
401 pi++;
402 break;
403
404 case WGL_STEREO_EXT:
405 if (pi[1] > 0)
406 desiredVisual |= CR_STEREO_BIT;
407 pi++;
408 break;
409
410 case WGL_DEPTH_BITS_EXT:
411 if (pi[1] > 0)
412 desiredVisual |= CR_DEPTH_BIT;
413 pi++;
414 break;
415
416 case WGL_STENCIL_BITS_EXT:
417 if (pi[1] > 0)
418 desiredVisual |= CR_STENCIL_BIT;
419 pi++;
420 break;
421
422 case WGL_ACCUM_RED_BITS_EXT:
423 case WGL_ACCUM_GREEN_BITS_EXT:
424 case WGL_ACCUM_BLUE_BITS_EXT:
425 if (pi[1] > 0)
426 desiredVisual |= CR_ACCUM_BIT;
427 pi++;
428 break;
429
430 case WGL_SAMPLE_BUFFERS_EXT:
431 case WGL_SAMPLES_EXT:
432 if (pi[1] > 0)
433 desiredVisual |= CR_MULTISAMPLE_BIT;
434 pi++;
435 break;
436
437 case WGL_SUPPORT_OPENGL_ARB:
438 case WGL_DRAW_TO_WINDOW_ARB:
439 case WGL_ACCELERATION_ARB:
440 pi++;
441 break;
442
443 case WGL_PIXEL_TYPE_ARB:
444 if(pi[1]!=WGL_TYPE_RGBA_ARB)
445 {
446 crWarning("WGL_PIXEL_TYPE 0x%x not supported!", pi[1]);
447 return 0;
448 }
449 pi++;
450 break;
451
452 default:
453 crWarning( "wglChoosePixelFormatEXT: bad pi=0x%x", *pi );
454 return 0;
455 }
456 }
457
458 if (nNumFormats) *nNumFormats = 1;
459 if (nMaxFormats>0 && piFormats)
460 {
461 piFormats[0] = 1;
462 }
463
464 return 1;
465}
466
467BOOL WINAPI wglGetPixelFormatAttribivEXT_prox
468(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues)
469{
470 UINT i;
471
472 if (!pValues || !piAttributes) return 0;
473
474 if ((nAttributes!=1) || (piAttributes && piAttributes[0]!=WGL_NUMBER_PIXEL_FORMATS_ARB))
475 {
476 if (iPixelFormat!=1)
477 {
478 crDebug("wglGetPixelFormatAttribivARB: bad pf:%i", iPixelFormat);
479 return 0;
480 }
481 }
482
483 for (i=0; i<nAttributes; ++i)
484 {
485 switch (piAttributes[i])
486 {
487 case WGL_NUMBER_PIXEL_FORMATS_ARB:
488 pValues[i] = 1;
489 break;
490 case WGL_DRAW_TO_WINDOW_ARB:
491 case WGL_SUPPORT_OPENGL_ARB:
492 case WGL_DOUBLE_BUFFER_ARB:
493 case WGL_STEREO_ARB:
494 pValues[i] = 1;
495 break;
496 case WGL_DRAW_TO_BITMAP_ARB:
497 case WGL_NEED_PALETTE_ARB:
498 case WGL_NEED_SYSTEM_PALETTE_ARB:
499 case WGL_SWAP_LAYER_BUFFERS_ARB:
500 case WGL_NUMBER_OVERLAYS_ARB:
501 case WGL_NUMBER_UNDERLAYS_ARB:
502 case WGL_TRANSPARENT_ARB:
503 case WGL_TRANSPARENT_RED_VALUE_ARB:
504 case WGL_TRANSPARENT_GREEN_VALUE_ARB:
505 case WGL_TRANSPARENT_BLUE_VALUE_ARB:
506 case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
507 case WGL_TRANSPARENT_INDEX_VALUE_ARB:
508 case WGL_SHARE_DEPTH_ARB:
509 case WGL_SHARE_STENCIL_ARB:
510 case WGL_SHARE_ACCUM_ARB:
511 case WGL_SUPPORT_GDI_ARB:
512 pValues[i] = 0;
513 break;
514 case WGL_ACCELERATION_ARB:
515 pValues[i] = WGL_FULL_ACCELERATION_ARB;
516 break;
517 case WGL_SWAP_METHOD_ARB:
518 pValues[i] = WGL_SWAP_UNDEFINED_ARB;
519 break;
520 case WGL_PIXEL_TYPE_ARB:
521 pValues[i] = WGL_TYPE_RGBA_ARB;
522 break;
523 case WGL_COLOR_BITS_ARB:
524 pValues[i] = 32;
525 break;
526 case WGL_RED_BITS_ARB:
527 case WGL_GREEN_BITS_ARB:
528 case WGL_BLUE_BITS_ARB:
529 case WGL_ALPHA_BITS_ARB:
530 pValues[i] = 8;
531 break;
532 case WGL_RED_SHIFT_ARB:
533 pValues[i] = 24;
534 break;
535 case WGL_GREEN_SHIFT_ARB:
536 pValues[i] = 16;
537 break;
538 case WGL_BLUE_SHIFT_ARB:
539 pValues[i] = 8;
540 break;
541 case WGL_ALPHA_SHIFT_ARB:
542 pValues[i] = 0;
543 break;
544 case WGL_ACCUM_BITS_ARB:
545 pValues[i] = 0;
546 break;
547 case WGL_ACCUM_RED_BITS_ARB:
548 pValues[i] = 0;
549 break;
550 case WGL_ACCUM_GREEN_BITS_ARB:
551 pValues[i] = 0;
552 break;
553 case WGL_ACCUM_BLUE_BITS_ARB:
554 pValues[i] = 0;
555 break;
556 case WGL_ACCUM_ALPHA_BITS_ARB:
557 pValues[i] = 0;
558 break;
559 case WGL_DEPTH_BITS_ARB:
560 pValues[i] = 32;
561 break;
562 case WGL_STENCIL_BITS_ARB:
563 pValues[i] = 8;
564 break;
565 case WGL_AUX_BUFFERS_ARB:
566 pValues[i] = 0;
567 break;
568 case WGL_SAMPLE_BUFFERS_EXT:
569 pValues[i] = 1;
570 break;
571 case WGL_SAMPLES_EXT:
572 pValues[i] = 1;
573 break;
574 default:
575 crWarning("wglGetPixelFormatAttribivARB: bad attrib=0x%x", piAttributes[i]);
576 return 0;
577 }
578 }
579
580 return 1;
581}
582
583BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox
584(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, float *pValues)
585{
586 UINT i;
587
588 if (!pValues || !piAttributes) return 0;
589
590 if ((nAttributes!=1) || (piAttributes && piAttributes[0]!=WGL_NUMBER_PIXEL_FORMATS_ARB))
591 {
592 if (iPixelFormat!=1)
593 {
594 crDebug("wglGetPixelFormatAttribivARB: bad pf:%i", iPixelFormat);
595 return 0;
596 }
597 }
598
599 for (i=0; i<nAttributes; ++i)
600 {
601 switch (piAttributes[i])
602 {
603 case WGL_NUMBER_PIXEL_FORMATS_ARB:
604 pValues[i] = 1.f;
605 break;
606 case WGL_DRAW_TO_WINDOW_ARB:
607 case WGL_SUPPORT_OPENGL_ARB:
608 case WGL_DOUBLE_BUFFER_ARB:
609 case WGL_STEREO_ARB:
610 pValues[i] = 1.f;
611 break;
612 case WGL_DRAW_TO_BITMAP_ARB:
613 case WGL_NEED_PALETTE_ARB:
614 case WGL_NEED_SYSTEM_PALETTE_ARB:
615 case WGL_SWAP_LAYER_BUFFERS_ARB:
616 case WGL_NUMBER_OVERLAYS_ARB:
617 case WGL_NUMBER_UNDERLAYS_ARB:
618 case WGL_TRANSPARENT_ARB:
619 case WGL_TRANSPARENT_RED_VALUE_ARB:
620 case WGL_TRANSPARENT_GREEN_VALUE_ARB:
621 case WGL_TRANSPARENT_BLUE_VALUE_ARB:
622 case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
623 case WGL_TRANSPARENT_INDEX_VALUE_ARB:
624 case WGL_SHARE_DEPTH_ARB:
625 case WGL_SHARE_STENCIL_ARB:
626 case WGL_SHARE_ACCUM_ARB:
627 case WGL_SUPPORT_GDI_ARB:
628 pValues[i] = 0.f;
629 break;
630 case WGL_ACCELERATION_ARB:
631 pValues[i] = WGL_FULL_ACCELERATION_ARB;
632 break;
633 case WGL_SWAP_METHOD_ARB:
634 pValues[i] = WGL_SWAP_UNDEFINED_ARB;
635 break;
636 case WGL_PIXEL_TYPE_ARB:
637 pValues[i] = WGL_TYPE_RGBA_ARB;
638 break;
639 case WGL_COLOR_BITS_ARB:
640 pValues[i] = 32.f;
641 break;
642 case WGL_RED_BITS_ARB:
643 case WGL_GREEN_BITS_ARB:
644 case WGL_BLUE_BITS_ARB:
645 case WGL_ALPHA_BITS_ARB:
646 pValues[i] = 8.f;
647 break;
648 case WGL_RED_SHIFT_ARB:
649 pValues[i] = 24.f;
650 break;
651 case WGL_GREEN_SHIFT_ARB:
652 pValues[i] = 16.f;
653 break;
654 case WGL_BLUE_SHIFT_ARB:
655 pValues[i] = 8.f;
656 break;
657 case WGL_ALPHA_SHIFT_ARB:
658 pValues[i] = 0.f;
659 break;
660 case WGL_ACCUM_BITS_ARB:
661 pValues[i] = 0.f;
662 break;
663 case WGL_ACCUM_RED_BITS_ARB:
664 pValues[i] = 0.f;
665 break;
666 case WGL_ACCUM_GREEN_BITS_ARB:
667 pValues[i] = 0.f;
668 break;
669 case WGL_ACCUM_BLUE_BITS_ARB:
670 pValues[i] = 0.f;
671 break;
672 case WGL_ACCUM_ALPHA_BITS_ARB:
673 pValues[i] = 0.f;
674 break;
675 case WGL_DEPTH_BITS_ARB:
676 pValues[i] = 32.f;
677 break;
678 case WGL_STENCIL_BITS_ARB:
679 pValues[i] = 8.f;
680 break;
681 case WGL_AUX_BUFFERS_ARB:
682 pValues[i] = 0.f;
683 break;
684 case WGL_SAMPLE_BUFFERS_EXT:
685 pValues[i] = 1.f;
686 break;
687 case WGL_SAMPLES_EXT:
688 pValues[i] = 1.f;
689 break;
690 default:
691 crWarning("wglGetPixelFormatAttribivARB: bad attrib=0x%x", piAttributes[i]);
692 return 0;
693 }
694 }
695
696 return 1;
697}
698
699BOOL WINAPI wglSwapIntervalEXT_prox(int interval)
700{
701 return TRUE;
702}
703
704int WINAPI wglGetSwapIntervalEXT_prox()
705{
706 return 1;
707}
708
709static GLubyte *gsz_wgl_extensions = "WGL_EXT_pixel_format WGL_ARB_pixel_format WGL_ARB_multisample";
710
711const GLubyte * WINAPI wglGetExtensionsStringEXT_prox()
712{
713 return gsz_wgl_extensions;
714}
715
716const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc)
717{
718 (void) hdc;
719
720 return gsz_wgl_extensions;
721}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette