From: Elias N. <eli...@us...> - 2002-12-12 22:04:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv28973/win32 Modified Files: org_lwjgl_opengl_BaseGL.cpp Log Message: Added more pixelformat tests to win32 Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_BaseGL.cpp 12 Dec 2002 20:06:15 -0000 1.7 +++ org_lwjgl_opengl_BaseGL.cpp 12 Dec 2002 22:04:05 -0000 1.8 @@ -60,15 +60,16 @@ printf("No window handle\n"); return JNI_FALSE; } + int flags = PFD_DRAW_TO_WINDOW | // support window + PFD_SUPPORT_OPENGL | // support OpenGL + PFD_GENERIC_ACCELERATED | + PFD_DOUBLEBUFFER; // double buffered PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd 1, // version number - PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | // support OpenGL - PFD_GENERIC_ACCELERATED | - PFD_DOUBLEBUFFER, // double buffered - PFD_TYPE_RGBA, // RGBA type + flags, // RGBA type + PFD_TYPE_RGBA, (BYTE)colorBits, 0, 0, 0, 0, 0, 0, // color bits ignored (BYTE)alphaBits, @@ -86,7 +87,7 @@ // Ensure desktop color depth is adequate int availableBitDepth = GetDeviceCaps(hdc, BITSPIXEL); if (availableBitDepth < colorBits) { - printf("This application requires a greater colour depth."); + printf("This application requires a greater colour depth.\n"); return JNI_FALSE; }; @@ -97,8 +98,34 @@ if (iPixelFormat == 0) { printf("Failed to choose pixel format.\n"); return JNI_FALSE; - } - + } + + PIXELFORMATDESCRIPTOR desc; + if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + printf("Could not describe pixel format\n"); + return JNI_FALSE; + } + + if (desc.cColorBits < colorBits) { + printf("This application requires a greater colour depth.\n"); + return JNI_FALSE; + } + + if (desc.cStencilBits < stencilBits) { + printf("This application requires a greater stencil depth.\n"); + return JNI_FALSE; + } + + if (desc.cDepthBits < depthBits) { + printf("This application requires a greater depth buffer depth.\n"); + return JNI_FALSE; + } + + if ((desc.dwFlags & flags) == 0) { + printf("Capabilities not supported.\n"); + return JNI_FALSE; + } + #ifdef _DEBUG printf("Pixel format is %d\n", iPixelFormat); #endif |