Last change
on this file since 20162 was 20162, checked in by vboxsync, 16 years ago |
Main: missing include in opengl test
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | /* $Id: OpenGLTestDarwin.cpp 20162 2009-05-29 16:34:55Z 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 | #include <OpenGL/gl.h>
|
---|
18 |
|
---|
19 | bool is3DAccelerationSupported()
|
---|
20 | {
|
---|
21 | CGDirectDisplayID display = CGMainDisplayID ();
|
---|
22 | CGOpenGLDisplayMask cglDisplayMask = CGDisplayIDToOpenGLDisplayMask (display);
|
---|
23 | CGLPixelFormatObj pixelFormat = NULL;
|
---|
24 | GLint numPixelFormats = 0;
|
---|
25 |
|
---|
26 | CGLPixelFormatAttribute attribs[] = {
|
---|
27 | kCGLPFADisplayMask,
|
---|
28 | (CGLPixelFormatAttribute)cglDisplayMask,
|
---|
29 | kCGLPFAAccelerated,
|
---|
30 | kCGLPFADoubleBuffer,
|
---|
31 | kCGLPFAWindow,
|
---|
32 | (CGLPixelFormatAttribute)NULL
|
---|
33 | };
|
---|
34 |
|
---|
35 | display = CGMainDisplayID();
|
---|
36 | cglDisplayMask = CGDisplayIDToOpenGLDisplayMask(display);
|
---|
37 | CGLChoosePixelFormat(attribs, &pixelFormat, &numPixelFormats);
|
---|
38 |
|
---|
39 | if (pixelFormat)
|
---|
40 | {
|
---|
41 | CGLContextObj cglContext = 0;
|
---|
42 | CGLCreateContext(pixelFormat, NULL, &cglContext);
|
---|
43 | CGLDestroyPixelFormat(pixelFormat);
|
---|
44 | if (cglContext)
|
---|
45 | {
|
---|
46 | CGLDestroyContext(cglContext);
|
---|
47 | return true;
|
---|
48 | }
|
---|
49 | }
|
---|
50 |
|
---|
51 | return false;
|
---|
52 | }
|
---|
53 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.