VirtualBox

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

最後變更 在這個檔案從20371是 20162,由 vboxsync 提交於 16 年 前

Main: missing include in opengl test

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 1.2 KB
 
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
19bool 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
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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