VirtualBox

source: vbox/trunk/src/VBox/Main/darwin/OpenGLTestDarwin.cpp@ 20161

Last change on this file since 20161 was 20161, checked in by vboxsync, 16 years ago

Main: fix mac burn long<>GLint

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1/* $Id: OpenGLTestDarwin.cpp 20161 2009-05-29 16:30:42Z vboxsync $ */
2
3/** @file
4 * VBox host opengl support test
5 */
6
7/*
8 * Copyright (C) 2009 Sun Microsystems, Inc.
9 *
10 * Sun Microsystems, Inc. confidential
11 * All rights reserved
12 */
13
14
15#include <OpenGL/OpenGL.h>
16#include <ApplicationServices/ApplicationServices.h>
17
18bool is3DAccelerationSupported()
19{
20 CGDirectDisplayID display = CGMainDisplayID ();
21 CGOpenGLDisplayMask cglDisplayMask = CGDisplayIDToOpenGLDisplayMask (display);
22 CGLPixelFormatObj pixelFormat = NULL;
23 GLint numPixelFormats = 0;
24
25 CGLPixelFormatAttribute attribs[] = {
26 kCGLPFADisplayMask,
27 (CGLPixelFormatAttribute)cglDisplayMask,
28 kCGLPFAAccelerated,
29 kCGLPFADoubleBuffer,
30 kCGLPFAWindow,
31 (CGLPixelFormatAttribute)NULL
32 };
33
34 display = CGMainDisplayID();
35 cglDisplayMask = CGDisplayIDToOpenGLDisplayMask(display);
36 CGLChoosePixelFormat(attribs, &pixelFormat, &numPixelFormats);
37
38 if (pixelFormat)
39 {
40 CGLContextObj cglContext = 0;
41 CGLCreateContext(pixelFormat, NULL, &cglContext);
42 CGLDestroyPixelFormat(pixelFormat);
43 if (cglContext)
44 {
45 CGLDestroyContext(cglContext);
46 return true;
47 }
48 }
49
50 return false;
51}
52
Note: See TracBrowser for help on using the repository browser.

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