VirtualBox

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

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

Main: fix mac burn long<>GLint

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

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