VirtualBox

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

最後變更 在這個檔案從38493是 38244,由 vboxsync 提交於 13 年 前

crOpenGL: missing commit for r72917, fix thread sync issues

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 20.2 KB
 
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 BOOL ret;
166
167 crHashtableLock(stub.windowTable);
168 crHashtableLock(stub.contextTable);
169
170 context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
171 window = stubGetWindowInfo(hdc);
172
173 if (hglrc!=0 && !context)
174 {
175 crWarning("wglMakeCurrent got unexpected hglrc 0x%x", hglrc);
176 }
177
178 ret = stubMakeCurrent( window, context );
179
180 crHashtableUnlock(stub.contextTable);
181 crHashtableUnlock(stub.windowTable);
182
183 return ret;
184}
185
186HGLRC WINAPI wglGetCurrentContext_prox( void )
187{
188 return (HGLRC) (stub.currentContext ? stub.currentContext->id : 0);
189}
190
191HDC WINAPI wglGetCurrentDC_prox( void )
192{
193 if (stub.currentContext && stub.currentContext->currentDrawable)
194 return (HDC) stub.currentContext->currentDrawable->drawable;
195 else
196 return (HDC) NULL;
197}
198
199int WINAPI wglGetPixelFormat_prox( HDC hdc )
200{
201 /* this is what we call our generic pixelformat, regardless of the HDC */
202 return 1;
203}
204
205int WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes,
206 LPPIXELFORMATDESCRIPTOR pfd )
207{
208/* if ( pixelFormat != 1 ) {
209 * crError( "wglDescribePixelFormat: pixelFormat=%d?\n", pixelFormat );
210 * return 0;
211 * } */
212
213 if ( !pfd ) {
214 crWarning( "wglDescribePixelFormat: pfd=NULL\n" );
215 return 1; /* There's only one, baby */
216 }
217
218 if ( nBytes != sizeof(*pfd) ) {
219 crWarning( "wglDescribePixelFormat: nBytes=%u?\n", nBytes );
220 return 1; /* There's only one, baby */
221 }
222
223 pfd->nSize = sizeof(*pfd);
224 pfd->nVersion = 1;
225 pfd->dwFlags = ( PFD_DRAW_TO_WINDOW |
226 PFD_SUPPORT_GDI |
227 PFD_SUPPORT_OPENGL |
228 PFD_DOUBLEBUFFER );
229 pfd->iPixelType = PFD_TYPE_RGBA;
230 pfd->cColorBits = 32;
231 pfd->cRedBits = 8;
232 pfd->cRedShift = 24;
233 pfd->cGreenBits = 8;
234 pfd->cGreenShift = 16;
235 pfd->cBlueBits = 8;
236 pfd->cBlueShift = 8;
237 pfd->cAlphaBits = 8;
238 pfd->cAlphaShift = 0;
239 pfd->cAccumBits = 0;
240 pfd->cAccumRedBits = 0;
241 pfd->cAccumGreenBits = 0;
242 pfd->cAccumBlueBits = 0;
243 pfd->cAccumAlphaBits = 0;
244 pfd->cDepthBits = 32;
245 pfd->cStencilBits = 8;
246 pfd->cAuxBuffers = 0;
247 pfd->iLayerType = PFD_MAIN_PLANE;
248 pfd->bReserved = 0;
249 pfd->dwLayerMask = 0;
250 pfd->dwVisibleMask = 0;
251 pfd->dwDamageMask = 0;
252
253 /* the max PFD index */
254 return 1;
255}
256
257BOOL WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
258{
259 crWarning( "wglShareLists: unsupported" );
260 return 0;
261}
262
263
264HGLRC WINAPI wglCreateContext_prox( HDC hdc )
265{
266 char dpyName[MAX_DPY_NAME];
267 ContextInfo *context;
268
269 stubInit();
270
271 CRASSERT(stub.contextTable);
272
273 sprintf(dpyName, "%d", hdc);
274 if (stub.haveNativeOpenGL)
275 desiredVisual |= ComputeVisBits( hdc );
276
277 context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0);
278 if (!context)
279 return 0;
280
281 return (HGLRC) context->id;
282}
283
284BOOL WINAPI
285wglSwapBuffers_prox( HDC hdc )
286{
287 WindowInfo *window = stubGetWindowInfo(hdc);
288 stubSwapBuffers( window, 0 );
289 return 1;
290}
291
292BOOL WINAPI wglCopyContext_prox( HGLRC src, HGLRC dst, UINT mask )
293{
294 crWarning( "wglCopyContext: unsupported" );
295 return 0;
296}
297
298HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane )
299{
300 stubInit();
301 crWarning( "wglCreateLayerContext: unsupported" );
302 return 0;
303}
304
305PROC WINAPI wglGetProcAddress_prox( LPCSTR name )
306{
307 return (PROC) crGetProcAddress( name );
308}
309
310BOOL WINAPI wglUseFontBitmapsA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
311{
312 crWarning( "wglUseFontBitmapsA: unsupported" );
313 return 0;
314}
315
316BOOL WINAPI wglUseFontBitmapsW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase )
317{
318 crWarning( "wglUseFontBitmapsW: unsupported" );
319 return 0;
320}
321
322BOOL WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane,
323 UINT nBytes, LPLAYERPLANEDESCRIPTOR lpd )
324{
325 crWarning( "wglDescribeLayerPlane: unimplemented" );
326 return 0;
327}
328
329int WINAPI wglSetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
330 int entries, CONST COLORREF *cr )
331{
332 crWarning( "wglSetLayerPaletteEntries: unsupported" );
333 return 0;
334}
335
336int WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start,
337 int entries, COLORREF *cr )
338{
339 crWarning( "wglGetLayerPaletteEntries: unsupported" );
340 return 0;
341}
342
343BOOL WINAPI wglRealizeLayerPalette_prox( HDC hdc, int layerPlane, BOOL realize )
344{
345 crWarning( "wglRealizeLayerPalette: unsupported" );
346 return 0;
347}
348
349DWORD WINAPI wglSwapMultipleBuffers_prox( UINT a, CONST void *b )
350{
351 crWarning( "wglSwapMultipleBuffer: unsupported" );
352 return 0;
353}
354
355BOOL WINAPI wglUseFontOutlinesA_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
356 FLOAT deviation, FLOAT extrusion, int format,
357 LPGLYPHMETRICSFLOAT gmf )
358{
359 crWarning( "wglUseFontOutlinesA: unsupported" );
360 return 0;
361}
362
363BOOL WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase,
364 FLOAT deviation, FLOAT extrusion, int format,
365 LPGLYPHMETRICSFLOAT gmf )
366{
367 crWarning( "wglUseFontOutlinesW: unsupported" );
368 return 0;
369}
370
371BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes )
372{
373 if (planes == WGL_SWAP_MAIN_PLANE)
374 {
375 return wglSwapBuffers_prox(hdc);
376 }
377 else
378 {
379 crWarning( "wglSwapLayerBuffers: unsupported" );
380 return 0;
381 }
382}
383
384BOOL WINAPI wglChoosePixelFormatEXT_prox
385(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
386{
387 int *pi;
388 int wants_rgb = 0;
389
390 stubInit();
391
392 /* TODO : Need to check pfAttributes too ! */
393
394 for ( pi = (int *)piAttributes; *pi != 0; pi++ )
395 {
396 switch ( *pi )
397 {
398 case WGL_COLOR_BITS_EXT:
399 if (pi[1] > 8)
400 wants_rgb = 1;
401 pi++;
402 break;
403
404 case WGL_RED_BITS_EXT:
405 case WGL_GREEN_BITS_EXT:
406 case WGL_BLUE_BITS_EXT:
407 if (pi[1] > 3)
408 wants_rgb = 1;
409 pi++;
410 break;
411
412 case WGL_ACCUM_ALPHA_BITS_EXT:
413 case WGL_ALPHA_BITS_EXT:
414 if (pi[1] > 0)
415 desiredVisual |= CR_ALPHA_BIT;
416 pi++;
417 break;
418
419 case WGL_DOUBLE_BUFFER_EXT:
420 if (pi[1] > 0)
421 desiredVisual |= CR_DOUBLE_BIT;
422 pi++;
423 break;
424
425 case WGL_STEREO_EXT:
426 if (pi[1] > 0)
427 desiredVisual |= CR_STEREO_BIT;
428 pi++;
429 break;
430
431 case WGL_DEPTH_BITS_EXT:
432 if (pi[1] > 0)
433 desiredVisual |= CR_DEPTH_BIT;
434 pi++;
435 break;
436
437 case WGL_STENCIL_BITS_EXT:
438 if (pi[1] > 0)
439 desiredVisual |= CR_STENCIL_BIT;
440 pi++;
441 break;
442
443 case WGL_ACCUM_RED_BITS_EXT:
444 case WGL_ACCUM_GREEN_BITS_EXT:
445 case WGL_ACCUM_BLUE_BITS_EXT:
446 if (pi[1] > 0)
447 desiredVisual |= CR_ACCUM_BIT;
448 pi++;
449 break;
450
451 case WGL_SAMPLE_BUFFERS_EXT:
452 case WGL_SAMPLES_EXT:
453 if (pi[1] > 0)
454 desiredVisual |= CR_MULTISAMPLE_BIT;
455 pi++;
456 break;
457
458 case WGL_SUPPORT_OPENGL_ARB:
459 case WGL_DRAW_TO_WINDOW_ARB:
460 case WGL_ACCELERATION_ARB:
461 pi++;
462 break;
463
464 case WGL_PIXEL_TYPE_ARB:
465 if(pi[1]!=WGL_TYPE_RGBA_ARB)
466 {
467 crWarning("WGL_PIXEL_TYPE 0x%x not supported!", pi[1]);
468 return 0;
469 }
470 pi++;
471 break;
472
473 default:
474 crWarning( "wglChoosePixelFormatEXT: bad pi=0x%x", *pi );
475 return 0;
476 }
477 }
478
479 if (nNumFormats) *nNumFormats = 1;
480 if (nMaxFormats>0 && piFormats)
481 {
482 piFormats[0] = 1;
483 }
484
485 return 1;
486}
487
488BOOL WINAPI wglGetPixelFormatAttribivEXT_prox
489(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues)
490{
491 UINT i;
492
493 if (!pValues || !piAttributes) return 0;
494
495 if ((nAttributes!=1) || (piAttributes && piAttributes[0]!=WGL_NUMBER_PIXEL_FORMATS_ARB))
496 {
497 if (iPixelFormat!=1)
498 {
499 crDebug("wglGetPixelFormatAttribivARB: bad pf:%i", iPixelFormat);
500 return 0;
501 }
502 }
503
504 for (i=0; i<nAttributes; ++i)
505 {
506 switch (piAttributes[i])
507 {
508 case WGL_NUMBER_PIXEL_FORMATS_ARB:
509 pValues[i] = 1;
510 break;
511 case WGL_DRAW_TO_WINDOW_ARB:
512 case WGL_SUPPORT_OPENGL_ARB:
513 case WGL_DOUBLE_BUFFER_ARB:
514 case WGL_STEREO_ARB:
515 pValues[i] = 1;
516 break;
517 case WGL_DRAW_TO_BITMAP_ARB:
518 case WGL_NEED_PALETTE_ARB:
519 case WGL_NEED_SYSTEM_PALETTE_ARB:
520 case WGL_SWAP_LAYER_BUFFERS_ARB:
521 case WGL_NUMBER_OVERLAYS_ARB:
522 case WGL_NUMBER_UNDERLAYS_ARB:
523 case WGL_TRANSPARENT_ARB:
524 case WGL_TRANSPARENT_RED_VALUE_ARB:
525 case WGL_TRANSPARENT_GREEN_VALUE_ARB:
526 case WGL_TRANSPARENT_BLUE_VALUE_ARB:
527 case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
528 case WGL_TRANSPARENT_INDEX_VALUE_ARB:
529 case WGL_SHARE_DEPTH_ARB:
530 case WGL_SHARE_STENCIL_ARB:
531 case WGL_SHARE_ACCUM_ARB:
532 case WGL_SUPPORT_GDI_ARB:
533 pValues[i] = 0;
534 break;
535 case WGL_ACCELERATION_ARB:
536 pValues[i] = WGL_FULL_ACCELERATION_ARB;
537 break;
538 case WGL_SWAP_METHOD_ARB:
539 pValues[i] = WGL_SWAP_UNDEFINED_ARB;
540 break;
541 case WGL_PIXEL_TYPE_ARB:
542 pValues[i] = WGL_TYPE_RGBA_ARB;
543 break;
544 case WGL_COLOR_BITS_ARB:
545 pValues[i] = 32;
546 break;
547 case WGL_RED_BITS_ARB:
548 case WGL_GREEN_BITS_ARB:
549 case WGL_BLUE_BITS_ARB:
550 case WGL_ALPHA_BITS_ARB:
551 pValues[i] = 8;
552 break;
553 case WGL_RED_SHIFT_ARB:
554 pValues[i] = 24;
555 break;
556 case WGL_GREEN_SHIFT_ARB:
557 pValues[i] = 16;
558 break;
559 case WGL_BLUE_SHIFT_ARB:
560 pValues[i] = 8;
561 break;
562 case WGL_ALPHA_SHIFT_ARB:
563 pValues[i] = 0;
564 break;
565 case WGL_ACCUM_BITS_ARB:
566 pValues[i] = 0;
567 break;
568 case WGL_ACCUM_RED_BITS_ARB:
569 pValues[i] = 0;
570 break;
571 case WGL_ACCUM_GREEN_BITS_ARB:
572 pValues[i] = 0;
573 break;
574 case WGL_ACCUM_BLUE_BITS_ARB:
575 pValues[i] = 0;
576 break;
577 case WGL_ACCUM_ALPHA_BITS_ARB:
578 pValues[i] = 0;
579 break;
580 case WGL_DEPTH_BITS_ARB:
581 pValues[i] = 32;
582 break;
583 case WGL_STENCIL_BITS_ARB:
584 pValues[i] = 8;
585 break;
586 case WGL_AUX_BUFFERS_ARB:
587 pValues[i] = 0;
588 break;
589 case WGL_SAMPLE_BUFFERS_EXT:
590 pValues[i] = 1;
591 break;
592 case WGL_SAMPLES_EXT:
593 pValues[i] = 1;
594 break;
595 default:
596 crWarning("wglGetPixelFormatAttribivARB: bad attrib=0x%x", piAttributes[i]);
597 return 0;
598 }
599 }
600
601 return 1;
602}
603
604BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox
605(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, float *pValues)
606{
607 UINT i;
608
609 if (!pValues || !piAttributes) return 0;
610
611 if ((nAttributes!=1) || (piAttributes && piAttributes[0]!=WGL_NUMBER_PIXEL_FORMATS_ARB))
612 {
613 if (iPixelFormat!=1)
614 {
615 crDebug("wglGetPixelFormatAttribivARB: bad pf:%i", iPixelFormat);
616 return 0;
617 }
618 }
619
620 for (i=0; i<nAttributes; ++i)
621 {
622 switch (piAttributes[i])
623 {
624 case WGL_NUMBER_PIXEL_FORMATS_ARB:
625 pValues[i] = 1.f;
626 break;
627 case WGL_DRAW_TO_WINDOW_ARB:
628 case WGL_SUPPORT_OPENGL_ARB:
629 case WGL_DOUBLE_BUFFER_ARB:
630 case WGL_STEREO_ARB:
631 pValues[i] = 1.f;
632 break;
633 case WGL_DRAW_TO_BITMAP_ARB:
634 case WGL_NEED_PALETTE_ARB:
635 case WGL_NEED_SYSTEM_PALETTE_ARB:
636 case WGL_SWAP_LAYER_BUFFERS_ARB:
637 case WGL_NUMBER_OVERLAYS_ARB:
638 case WGL_NUMBER_UNDERLAYS_ARB:
639 case WGL_TRANSPARENT_ARB:
640 case WGL_TRANSPARENT_RED_VALUE_ARB:
641 case WGL_TRANSPARENT_GREEN_VALUE_ARB:
642 case WGL_TRANSPARENT_BLUE_VALUE_ARB:
643 case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
644 case WGL_TRANSPARENT_INDEX_VALUE_ARB:
645 case WGL_SHARE_DEPTH_ARB:
646 case WGL_SHARE_STENCIL_ARB:
647 case WGL_SHARE_ACCUM_ARB:
648 case WGL_SUPPORT_GDI_ARB:
649 pValues[i] = 0.f;
650 break;
651 case WGL_ACCELERATION_ARB:
652 pValues[i] = WGL_FULL_ACCELERATION_ARB;
653 break;
654 case WGL_SWAP_METHOD_ARB:
655 pValues[i] = WGL_SWAP_UNDEFINED_ARB;
656 break;
657 case WGL_PIXEL_TYPE_ARB:
658 pValues[i] = WGL_TYPE_RGBA_ARB;
659 break;
660 case WGL_COLOR_BITS_ARB:
661 pValues[i] = 32.f;
662 break;
663 case WGL_RED_BITS_ARB:
664 case WGL_GREEN_BITS_ARB:
665 case WGL_BLUE_BITS_ARB:
666 case WGL_ALPHA_BITS_ARB:
667 pValues[i] = 8.f;
668 break;
669 case WGL_RED_SHIFT_ARB:
670 pValues[i] = 24.f;
671 break;
672 case WGL_GREEN_SHIFT_ARB:
673 pValues[i] = 16.f;
674 break;
675 case WGL_BLUE_SHIFT_ARB:
676 pValues[i] = 8.f;
677 break;
678 case WGL_ALPHA_SHIFT_ARB:
679 pValues[i] = 0.f;
680 break;
681 case WGL_ACCUM_BITS_ARB:
682 pValues[i] = 0.f;
683 break;
684 case WGL_ACCUM_RED_BITS_ARB:
685 pValues[i] = 0.f;
686 break;
687 case WGL_ACCUM_GREEN_BITS_ARB:
688 pValues[i] = 0.f;
689 break;
690 case WGL_ACCUM_BLUE_BITS_ARB:
691 pValues[i] = 0.f;
692 break;
693 case WGL_ACCUM_ALPHA_BITS_ARB:
694 pValues[i] = 0.f;
695 break;
696 case WGL_DEPTH_BITS_ARB:
697 pValues[i] = 32.f;
698 break;
699 case WGL_STENCIL_BITS_ARB:
700 pValues[i] = 8.f;
701 break;
702 case WGL_AUX_BUFFERS_ARB:
703 pValues[i] = 0.f;
704 break;
705 case WGL_SAMPLE_BUFFERS_EXT:
706 pValues[i] = 1.f;
707 break;
708 case WGL_SAMPLES_EXT:
709 pValues[i] = 1.f;
710 break;
711 default:
712 crWarning("wglGetPixelFormatAttribivARB: bad attrib=0x%x", piAttributes[i]);
713 return 0;
714 }
715 }
716
717 return 1;
718}
719
720BOOL WINAPI wglSwapIntervalEXT_prox(int interval)
721{
722 return TRUE;
723}
724
725int WINAPI wglGetSwapIntervalEXT_prox()
726{
727 return 1;
728}
729
730static GLubyte *gsz_wgl_extensions = "WGL_EXT_pixel_format WGL_ARB_pixel_format WGL_ARB_multisample";
731
732const GLubyte * WINAPI wglGetExtensionsStringEXT_prox()
733{
734 return gsz_wgl_extensions;
735}
736
737const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc)
738{
739 (void) hdc;
740
741 return gsz_wgl_extensions;
742}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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