/* $Id: OpenGLTestDarwin.cpp 20512 2009-06-12 13:02:29Z vboxsync $ */ /** @file * VBox host opengl support test */ /* * Copyright (C) 2009 Sun Microsystems, Inc. * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 USA or visit http://www.sun.com if you need * additional information or have any questions. */ #include #include #include bool is3DAccelerationSupported() { CGDirectDisplayID display = CGMainDisplayID (); CGOpenGLDisplayMask cglDisplayMask = CGDisplayIDToOpenGLDisplayMask (display); CGLPixelFormatObj pixelFormat = NULL; GLint numPixelFormats = 0; CGLPixelFormatAttribute attribs[] = { kCGLPFADisplayMask, (CGLPixelFormatAttribute)cglDisplayMask, kCGLPFAAccelerated, kCGLPFADoubleBuffer, kCGLPFAWindow, (CGLPixelFormatAttribute)NULL }; display = CGMainDisplayID(); cglDisplayMask = CGDisplayIDToOpenGLDisplayMask(display); CGLChoosePixelFormat(attribs, &pixelFormat, &numPixelFormats); if (pixelFormat) { CGLContextObj cglContext = 0; CGLCreateContext(pixelFormat, NULL, &cglContext); CGLDestroyPixelFormat(pixelFormat); if (cglContext) { CGLDestroyContext(cglContext); return true; } } return false; }