From 1d8e255126e4e1bb2c4bc0e34cd11f75b9bd6cc6 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 29 Nov 2007 21:30:21 +0000 Subject: [PATCH] fixed almost all case for wglGetPixelFormatAttribivARB and wglGetPixelFormatAttribfvARB full support of them are not done yet. documations over it is found at http://msdn2.microsoft.com/EN-US/library/ms537569.aspx and http://developer.3dlabs.com/documents/WGLmanpages/wglgetpixelformatattribarb.htm This change was done by me (Magnus Olsen magnus at greatlord dot com) and Kamil Hornicek tykef at atlas dot cz (irc nick : Pigglesworth) we done this toghter svn path=/trunk/; revision=30902 --- .../mesa32/src/drivers/windows/gdi/wgl.c | 1028 ++++++++++++++++- 1 file changed, 997 insertions(+), 31 deletions(-) diff --git a/reactos/dll/3rdparty/mesa32/src/drivers/windows/gdi/wgl.c b/reactos/dll/3rdparty/mesa32/src/drivers/windows/gdi/wgl.c index 8b0f001d9cb..3504dbb4f90 100644 --- a/reactos/dll/3rdparty/mesa32/src/drivers/windows/gdi/wgl.c +++ b/reactos/dll/3rdparty/mesa32/src/drivers/windows/gdi/wgl.c @@ -772,7 +772,20 @@ wglGetSwapIntervalEXT (void) /* WGL_ARB_pixel_format */ #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F #define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 #define WGL_STEREO_ARB 0x2012 #define WGL_PIXEL_TYPE_ARB 0x2013 #define WGL_COLOR_BITS_ARB 0x2014 @@ -791,6 +804,17 @@ wglGetSwapIntervalEXT (void) #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 #define WGL_DEPTH_BITS_ARB 0x2022 #define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 + GLAPI BOOL GLAPIENTRY wglGetPixelFormatAttribivARB (HDC hdc, @@ -801,43 +825,503 @@ wglGetPixelFormatAttribivARB (HDC hdc, int *piValues) { BOOL retVal = FALSE; + BOOL Count = 0; int i; for (i=0;i 0) && (iPixelFormat<=npfd)) + { + if ( ( pfd[iPixelFormat - 1].pfd.dwFlags & PFD_GENERIC_FORMAT ) == PFD_GENERIC_FORMAT) + { + piValues[i] = WGL_NO_ACCELERATION_ARB; // or WGL_GENERIC_ACCELERATION_ARB ? + } + + else if ( ( pfd[iPixelFormat - 1].pfd.dwFlags & PFD_GENERIC_FORMAT ) == PFD_GENERIC_ACCELERATED) + { + piValues[i] = WGL_GENERIC_ACCELERATION_ARB; // or WGL_FULL_ACCELERATION_ARB ? + } + else + { + piValues[i] = WGL_FULL_ACCELERATION_ARB; // or WGL_NO_ACCELERATION_ARB ? + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + /* note from http://developer.3dlabs.com/documents/WGLmanpages/wglgetpixelformatattribarb.htm + * + * WGL_NO_ACCELERATION_ARB + * Only the software renderer supports this pixel format. + * + * WGL_GENERIC_ACCELERATION_ARB + * The pixel format is supported by an MCD driver. + * + * WGL_FULL_ACCELERATION_ARB + * The pixel format is supported by an ICD driver. + */ break; - case WGL_RED_BITS_ARB : - piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cRedBits; + case WGL_ACCUM_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; - case WGL_GREEN_BITS_ARB : - piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cGreenBits; + case WGL_ACCUM_ALPHA_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumAlphaBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; - case WGL_BLUE_BITS_ARB : - piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cBlueBits; + + case WGL_ACCUM_BLUE_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumBlueBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_ACCUM_GREEN_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumGreenBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_ACCUM_RED_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumRedBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; case WGL_ALPHA_BITS_ARB : - piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAlphaBits; + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAlphaBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_ALPHA_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAlphaShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_AUX_BUFFERS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAuxBuffers; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_BLUE_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cBlueBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_BLUE_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cBlueShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_COLOR_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cColorBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; case WGL_DEPTH_BITS_ARB : - piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cDepthBits; + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cDepthBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_DRAW_TO_BITMAP_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.dwFlags & ~PFD_DRAW_TO_BITMAP; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_DRAW_TO_WINDOW_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.dwFlags & ~PFD_DRAW_TO_WINDOW; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_DRAW_TO_PBUFFER_ARB : + piValues[i] = GL_TRUE; + break; + + case WGL_DOUBLE_BUFFER_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_DOUBLEBUFFER) == PFD_DOUBLEBUFFER) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_GREEN_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cGreenBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_GREEN_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cGreenShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + + case WGL_MAX_PBUFFER_PIXELS_ARB : + // FIXME + break; + + case WGL_MAX_PBUFFER_WIDTH_ARB : + // FIXME + break; + + case WGL_MAX_PBUFFER_HEIGHT_ARB : + // FIXME + break; + + case WGL_NEED_PALETTE_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_NEED_PALETTE) == PFD_NEED_PALETTE) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_NEED_SYSTEM_PALETTE_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_NEED_PALETTE) == PFD_NEED_SYSTEM_PALETTE) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_NUMBER_PIXEL_FORMATS_ARB : + piValues[i] = (int)npfd; + Count++; + break; + + case WGL_NUMBER_UNDERLAYS_ARB : + // FIXME + break; +/* + case WGL_OPTIMAL_PBUFFER_WIDTH_ARB + // FIXME + break; + + case WGL_OPTIMAL_PBUFFER_HEIGHT_ARB + // FIXME + break; +*/ + case WGL_PIXEL_TYPE_ARB : + // FIXME + break; + + case WGL_RED_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cRedBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_RED_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cRedShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_SAMPLES_ARB : + // FIXME + break; + + case WGL_SAMPLE_BUFFERS_ARB : + // FIXME + break; + + case WGL_SHARE_ACCUM_ARB : + // FIXME - True if the layer plane shares the accumulation buffer with the main planes. If iLayerPlane is zero, this is always true. + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if (iLayerPlane == 0) + { + piValues[i] = GL_TRUE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SHARE_DEPTH_ARB : + // FIXME - True if the layer plane shares the depth buffer with the main planes. If iLayerPlane is zero, this is always true. + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if (iLayerPlane == 0) + { + piValues[i] = GL_TRUE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; break; case WGL_STENCIL_BITS_ARB : - piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAuxBuffers; + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + piValues[i] = (int)pfd[iPixelFormat - 1].pfd.cStencilBits ; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_STEREO_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_STEREO) == PFD_STEREO) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SUPPORT_GDI_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_SUPPORT_GDI) == PFD_SUPPORT_GDI) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SUPPORT_OPENGL_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_SUPPORT_OPENGL) == PFD_SUPPORT_OPENGL) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SWAP_LAYER_BUFFERS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_SUPPORT_OPENGL) == PFD_SWAP_LAYER_BUFFERS) + { + piValues[i] = GL_TRUE; + } + else + { + piValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SWAP_METHOD_ARB : + // FIXME + break; + + case WGL_TRANSPARENT_ARB : + //FIXME after WGL_TRANSPARENT_VALUE been implement piValues[i] = GL_TRUE; + piValues[i] = GL_FALSE; + Count++; break; default : @@ -846,7 +1330,17 @@ wglGetPixelFormatAttribivARB (HDC hdc, } } - return retVal; + if(GetObjectType(hdc) != OBJ_DC) + { + SetLastError(ERROR_DC_NOT_FOUND); + } + else if (Count == nAttributes) + { + retVal = TRUE; + } + + + return retVal; } GLAPI BOOL GLAPIENTRY @@ -858,43 +1352,502 @@ wglGetPixelFormatAttribfvARB (HDC hdc, FLOAT *pfValues) { BOOL retVal = FALSE; + BOOL Count = 0; int i; for (i=0;i 0) && (iPixelFormat<=npfd)) + { + if ( ( pfd[iPixelFormat - 1].pfd.dwFlags & PFD_GENERIC_FORMAT ) == PFD_GENERIC_FORMAT) + { + pfValues[i] = WGL_NO_ACCELERATION_ARB; // or WGL_GENERIC_ACCELERATION_ARB ? + } + + else if ( ( pfd[iPixelFormat - 1].pfd.dwFlags & PFD_GENERIC_FORMAT ) == PFD_GENERIC_ACCELERATED) + { + pfValues[i] = WGL_GENERIC_ACCELERATION_ARB; // or WGL_FULL_ACCELERATION_ARB ? + } + else + { + pfValues[i] = WGL_FULL_ACCELERATION_ARB; // or WGL_NO_ACCELERATION_ARB ? + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + /* note from http://developer.3dlabs.com/documents/WGLmanpages/wglgetpixelformatattribarb.htm + * + * WGL_NO_ACCELERATION_ARB + * Only the software renderer supports this pixel format. + * + * WGL_GENERIC_ACCELERATION_ARB + * The pixel format is supported by an MCD driver. + * + * WGL_FULL_ACCELERATION_ARB + * The pixel format is supported by an ICD driver. + */ break; - case WGL_RED_BITS_ARB : - pfValues[i] = (FLOAT)pfd[iPixelFormat - 1].pfd.cRedBits; + case WGL_ACCUM_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; - case WGL_GREEN_BITS_ARB : - pfValues[i] = (FLOAT)pfd[iPixelFormat - 1].pfd.cGreenBits; + case WGL_ACCUM_ALPHA_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumAlphaBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; - case WGL_BLUE_BITS_ARB : - pfValues[i] = (FLOAT)pfd[iPixelFormat - 1].pfd.cBlueBits; + + case WGL_ACCUM_BLUE_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumBlueBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_ACCUM_GREEN_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumGreenBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_ACCUM_RED_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAccumRedBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; case WGL_ALPHA_BITS_ARB : - pfValues[i] = (FLOAT)pfd[iPixelFormat - 1].pfd.cAlphaBits; + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAlphaBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_ALPHA_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAlphaShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_AUX_BUFFERS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cAuxBuffers; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_BLUE_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cBlueBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_BLUE_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cBlueShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_COLOR_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cColorBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; case WGL_DEPTH_BITS_ARB : - pfValues[i] = (FLOAT)pfd[iPixelFormat - 1].pfd.cDepthBits; + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cDepthBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_DRAW_TO_BITMAP_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.dwFlags & ~PFD_DRAW_TO_BITMAP; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_DRAW_TO_WINDOW_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.dwFlags & ~PFD_DRAW_TO_WINDOW; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_DRAW_TO_PBUFFER_ARB : + pfValues[i] = GL_TRUE; + break; + + case WGL_DOUBLE_BUFFER_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_DOUBLEBUFFER) == PFD_DOUBLEBUFFER) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_GREEN_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cGreenBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_GREEN_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cGreenShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + + case WGL_MAX_PBUFFER_PIXELS_ARB : + // FIXME + break; + + case WGL_MAX_PBUFFER_WIDTH_ARB : + // FIXME + break; + + case WGL_MAX_PBUFFER_HEIGHT_ARB : + // FIXME + break; + + case WGL_NEED_PALETTE_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_NEED_PALETTE) == PFD_NEED_PALETTE) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_NEED_SYSTEM_PALETTE_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_NEED_PALETTE) == PFD_NEED_SYSTEM_PALETTE) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_NUMBER_PIXEL_FORMATS_ARB : + pfValues[i] = (int)npfd; + Count++; + break; + + case WGL_NUMBER_UNDERLAYS_ARB : + // FIXME + break; +/* + case WGL_OPTIMAL_PBUFFER_WIDTH_ARB + // FIXME + break; + + case WGL_OPTIMAL_PBUFFER_HEIGHT_ARB + // FIXME + break; +*/ + case WGL_PIXEL_TYPE_ARB : + // FIXME + break; + + case WGL_RED_BITS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cRedBits; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_RED_SHIFT_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cRedShift; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + + break; + + case WGL_SAMPLES_ARB : + // FIXME + break; + + case WGL_SAMPLE_BUFFERS_ARB : + // FIXME + break; + + case WGL_SHARE_ACCUM_ARB : + // FIXME - True if the layer plane shares the accumulation buffer with the main planes. If iLayerPlane is zero, this is always true. + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if (iLayerPlane == 0) + { + pfValues[i] = GL_TRUE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SHARE_DEPTH_ARB : + // FIXME - True if the layer plane shares the depth buffer with the main planes. If iLayerPlane is zero, this is always true. + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if (iLayerPlane == 0) + { + pfValues[i] = GL_TRUE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } break; case WGL_STENCIL_BITS_ARB : - pfValues[i] = (FLOAT)pfd[iPixelFormat - 1].pfd.cAuxBuffers; + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + pfValues[i] = (int)pfd[iPixelFormat - 1].pfd.cStencilBits ; + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_STEREO_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_STEREO) == PFD_STEREO) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SUPPORT_GDI_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_SUPPORT_GDI) == PFD_SUPPORT_GDI) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SUPPORT_OPENGL_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_SUPPORT_OPENGL) == PFD_SUPPORT_OPENGL) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SWAP_LAYER_BUFFERS_ARB : + if ((iPixelFormat > 0) && (iPixelFormat<=npfd)) + { + if ((pfd[iPixelFormat - 1].pfd.dwFlags & PFD_SUPPORT_OPENGL) == PFD_SWAP_LAYER_BUFFERS) + { + pfValues[i] = GL_TRUE; + } + else + { + pfValues[i] = GL_FALSE; + } + Count++; + } + else + { + SetLastError(ERROR_INVALID_PIXEL_FORMAT); + } + break; + + case WGL_SWAP_METHOD_ARB : + // FIXME + break; + + case WGL_TRANSPARENT_ARB : + //FIXME after WGL_TRANSPARENT_VALUE been implement piValues[i] = GL_TRUE; + pfValues[i] = GL_FALSE; + Count++; break; default : @@ -903,9 +1856,19 @@ wglGetPixelFormatAttribfvARB (HDC hdc, } } + if(GetObjectType(hdc) != OBJ_DC) + { + SetLastError(ERROR_DC_NOT_FOUND); + } + else if (Count == nAttributes) + { + retVal = TRUE; + } + return retVal; } + GLAPI BOOL GLAPIENTRY wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, @@ -1029,3 +1992,6 @@ wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer) return FALSE; } + + +