Spits out some video card info for active displays to the console
ActiveDisplays OpenGL Mask OpenGL Renderers Accelerated? MultiScreen? OffScreen? Renderer (Software, Generic, nVidia GeForce2MX, etc.) VRAM VRAM usable for textures Display Bounds (0,0,w,h) Current Mode Width Height Refresh Rate Bits per Pixel Bits per Sample Mode Usable For Desktop GUI? IOFlags Samples per Pixel
This commit is contained in:
parent
0cb5ad8794
commit
9cd5cebb11
17
macosx/CGLInfo.h
Normal file
17
macosx/CGLInfo.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// CGLInfo.h
|
||||
// celestia
|
||||
//
|
||||
// Created by Bob Ippolito on Wed Jun 26 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <OpenGL/OpenGL.h>
|
||||
|
||||
@interface CGLInfo : NSObject {
|
||||
|
||||
}
|
||||
+(NSArray*)displayDescriptions;
|
||||
+(NSString*)rendererFromID:(unsigned)rc;
|
||||
@end
|
80
macosx/CGLInfo.m
Normal file
80
macosx/CGLInfo.m
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// CGLInfo.m
|
||||
// celestia
|
||||
//
|
||||
// Created by Bob Ippolito on Wed Jun 26 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CGLInfo.h"
|
||||
#import <OpenGL/OpenGL.h>
|
||||
#import <OpenGL/CGLRenderers.h>
|
||||
#define NSUNSIGNED(x) [NSNumber numberWithUnsignedInt:x]
|
||||
#define MAX_DISPLAYS 16
|
||||
FOUNDATION_STATIC_INLINE NSRect NSRectFromCGRect(CGRect r) {
|
||||
return NSMakeRect(r.origin.x,r.origin.y,r.size.width,r.size.height);
|
||||
}
|
||||
NSDictionary* _CGLRenderers;
|
||||
@implementation CGLInfo
|
||||
+(void)initialize
|
||||
{
|
||||
_CGLRenderers = [[NSDictionary dictionaryWithObjectsAndKeys:@"Generic",NSUNSIGNED(kCGLRendererGenericID),@"Software",NSUNSIGNED(kCGLRendererAppleSWID),@"ATI Rage 128",NSUNSIGNED(kCGLRendererATIRage128ID),@"ATI Rage Pro",NSUNSIGNED(kCGLRendererATIRageProID),@"ATI Radeon",NSUNSIGNED(kCGLRendererATIRadeonID),@"nVidia GeForce2MX",NSUNSIGNED(kCGLRendererGeForce2MXID),@"nVidia GeForce3",NSUNSIGNED(kCGLRendererGeForce3ID),@"3DFX (Mesa)",NSUNSIGNED(kCGLRendererMesa3DFXID),nil,nil] retain];
|
||||
}
|
||||
+(NSString*)rendererFromID:(unsigned)rc
|
||||
{
|
||||
NSString* obj = [_CGLRenderers objectForKey:NSUNSIGNED(rc)];
|
||||
return ((id)obj == nil) ? (NSString*)@"Unknown" : (NSString*)obj;
|
||||
}
|
||||
+(NSArray*)displayDescriptions
|
||||
{
|
||||
NSMutableArray* allDisplays = [NSMutableArray arrayWithCapacity:1];
|
||||
CGDirectDisplayID* displayList;
|
||||
CGDisplayCount displayIndex, displayCount;
|
||||
CGDisplayErr err;
|
||||
|
||||
err = CGGetActiveDisplayList(0, NULL, &displayCount);
|
||||
if (err != CGDisplayNoErr)
|
||||
return nil;
|
||||
displayList = (CGDirectDisplayID*)malloc(displayCount*sizeof(CGDirectDisplayID));
|
||||
err = CGGetActiveDisplayList(displayCount, displayList, &displayCount);
|
||||
for (displayIndex = 0; displayIndex<displayCount; ++displayIndex) {
|
||||
CGDirectDisplayID selectedDisplay;
|
||||
CGOpenGLDisplayMask glMask;
|
||||
NSMutableDictionary* displayInfo = [NSMutableDictionary dictionaryWithCapacity:10];
|
||||
selectedDisplay = displayList[displayIndex];
|
||||
if ((glMask = CGDisplayIDToOpenGLDisplayMask(selectedDisplay)) != 0) {
|
||||
CGLRendererInfoObj rend;
|
||||
NSMutableArray* renderers;
|
||||
long i,nrend;
|
||||
err = CGLQueryRendererInfo(glMask, &rend, &nrend);
|
||||
renderers = [NSMutableArray arrayWithCapacity:nrend];
|
||||
for (i = 0; i < nrend; ++i) {
|
||||
long value;
|
||||
NSMutableDictionary *glInfo = [NSMutableDictionary dictionaryWithCapacity:10];
|
||||
CGLDescribeRenderer(rend, i, kCGLRPAccelerated, &value);
|
||||
[glInfo setObject:[NSNumber numberWithLong:value] forKey:@"Accelerated"];
|
||||
CGLDescribeRenderer(rend, i, kCGLRPMultiScreen, &value);
|
||||
[glInfo setObject:[NSNumber numberWithLong:value] forKey:@"MultiScreen"];
|
||||
CGLDescribeRenderer(rend, i, kCGLRPRendererID, &value);
|
||||
[glInfo setObject:[NSNumber numberWithLong:value] forKey:@"RendererID"];
|
||||
[glInfo setObject:[CGLInfo rendererFromID:value] forKey:@"Renderer"];
|
||||
CGLDescribeRenderer(rend, i, kCGLRPOffScreen, &value);
|
||||
[glInfo setObject:[NSNumber numberWithLong:value] forKey:@"OffScreen"];
|
||||
CGLDescribeRenderer(rend, i, kCGLRPVideoMemory, &value);
|
||||
[glInfo setObject:[NSNumber numberWithLong:value] forKey:@"VRAM"];
|
||||
CGLDescribeRenderer(rend, i, kCGLRPTextureMemory, &value);
|
||||
[glInfo setObject:[NSNumber numberWithLong:value] forKey:@"TextureVRAM"];
|
||||
[renderers addObject:glInfo];
|
||||
}
|
||||
CGLDestroyRendererInfo(rend);
|
||||
[displayInfo setObject:renderers forKey:@"Renderers"];
|
||||
}
|
||||
[displayInfo setObject:[NSNumber numberWithUnsignedInt:glMask] forKey:@"OpenGLDisplayMask"];
|
||||
[displayInfo setObject:NSStringFromRect(NSRectFromCGRect(CGDisplayBounds(selectedDisplay))) forKey:@"displayBounds"];
|
||||
[displayInfo setObject:[(NSDictionary*)CGDisplayCurrentMode(selectedDisplay) autorelease] forKey:@"currentMode"];
|
||||
[allDisplays addObject:displayInfo];
|
||||
}
|
||||
free(displayList);
|
||||
return allDisplays;
|
||||
}
|
||||
@end
|
|
@ -10,6 +10,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "CelestiaController.h"
|
||||
#import "FavoritesDrawerController.h"
|
||||
#import "CGLInfo.h"
|
||||
|
||||
@implementation CelestiaController
|
||||
|
||||
|
@ -112,6 +113,9 @@
|
|||
[menuCallback setSelector:@selector(synchronizeFavoritesMenu)];
|
||||
[menuCallback setTarget:favoritesDrawerController];
|
||||
[[CelestiaFavorites sharedFavorites] setSynchronize:menuCallback];
|
||||
[[CelestiaFavorites sharedFavorites] synchronize];
|
||||
// DEBUG
|
||||
NSLog(@"%@",[CGLInfo displayDescriptions]);
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
|
|
1
macosx/English.lproj/MainMenu.nib/info.nib
generated
1
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -25,6 +25,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>21</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/objects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/objects.nib
generated
Binary file not shown.
|
@ -16,6 +16,7 @@
|
|||
F5040B0F02A484DA014901DC,
|
||||
F5231C7102C2997601000006,
|
||||
F5274ED302AE88260100020A,
|
||||
F505BFFA02CA9DAE0100020A,
|
||||
F57F9FD402B94A0B01000006,
|
||||
F57FA4F002B9AB8601000006,
|
||||
F578B7B402B3E4DB0100020A,
|
||||
|
@ -24,6 +25,7 @@
|
|||
F5040B0E02A484DA014901DC,
|
||||
F5231C7202C2997601000006,
|
||||
F5274ED202AE88260100020A,
|
||||
F505BFFB02CA9DAE0100020A,
|
||||
F57FA4EF02B9AB8601000006,
|
||||
F578B7B302B3E4DB0100020A,
|
||||
F55C817702AF55890100020A,
|
||||
|
@ -412,6 +414,7 @@
|
|||
F5231C7402C2997601000006,
|
||||
F56FFFAB02C571280100020A,
|
||||
F56FFFB002C578050100020A,
|
||||
F505BFFD02CA9DAE0100020A,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
};
|
||||
|
@ -523,6 +526,7 @@
|
|||
F5231C7302C2997601000006,
|
||||
F56FFFAC02C571280100020A,
|
||||
F56FFFAF02C578050100020A,
|
||||
F505BFFC02CA9DAE0100020A,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
};
|
||||
|
@ -669,6 +673,28 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
F505BFFA02CA9DAE0100020A = {
|
||||
isa = PBXFileReference;
|
||||
path = CGLInfo.m;
|
||||
refType = 4;
|
||||
};
|
||||
F505BFFB02CA9DAE0100020A = {
|
||||
isa = PBXFileReference;
|
||||
path = CGLInfo.h;
|
||||
refType = 4;
|
||||
};
|
||||
F505BFFC02CA9DAE0100020A = {
|
||||
fileRef = F505BFFA02CA9DAE0100020A;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F505BFFD02CA9DAE0100020A = {
|
||||
fileRef = F505BFFB02CA9DAE0100020A;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
F51C6D3602959587014901DC = {
|
||||
isa = PBXFrameworkReference;
|
||||
name = OpenGL.framework;
|
||||
|
|
Loading…
Reference in a new issue