[Visualization] Remove OpenGL fallback

The OpenGL fallback was causing division by zero errors on Intel Macs
running macOS High Sierra.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-05-28 18:23:15 -07:00
parent 5e5b2e4071
commit 6b381f3d08
1 changed files with 4 additions and 19 deletions

View File

@ -28,7 +28,6 @@ extern NSString *CogPlaybackDidStopNotficiation;
BOOL isListening;
BOOL bandsReset;
BOOL cameraControlEnabled;
BOOL isOpenGL;
NSColor *backgroundColor;
ddb_analyzer_t _analyzer;
@ -47,20 +46,10 @@ extern NSString *CogPlaybackDidStopNotficiation;
- (id)initWithFrame:(NSRect)frame {
NSDictionary *sceneOptions = @{
SCNPreferredRenderingAPIKey: @(SCNRenderingAPIOpenGLCore32)
SCNPreferredRenderingAPIKey: @(SCNRenderingAPIMetal),
SCNPreferredDeviceKey: MTLCreateSystemDefaultDevice(),
SCNPreferLowPowerDeviceKey: @(NO)
};
isOpenGL = YES;
if(@available(macOS 10.15, *)) {
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
if([device supportsFamily:MTLGPUFamilyMac2]) {
sceneOptions = @{
SCNPreferredRenderingAPIKey: @(SCNRenderingAPIMetal),
SCNPreferredDeviceKey: device
};
isOpenGL = NO;
}
}
self = [super initWithFrame:frame options:sceneOptions];
if(self) {
@ -117,8 +106,6 @@ extern NSString *CogPlaybackDidStopNotficiation;
SCNMaterial *material = materials[0];
material.diffuse.contents = barColor;
material.emission.contents = barColor;
if(isOpenGL)
material.emission.intensity = 0;
}
{
@ -128,8 +115,6 @@ extern NSString *CogPlaybackDidStopNotficiation;
SCNMaterial *material = materials[0];
material.diffuse.contents = dotColor;
material.emission.contents = dotColor;
if(isOpenGL)
material.emission.intensity = 0;
}
}
@ -345,7 +330,7 @@ extern NSString *CogPlaybackDidStopNotficiation;
SCNNode *dotNode = nodes[i + 1 + 11];
SCNVector3 position = node.position;
position.y = maxValue * 0.5;
node.scale = SCNVector3Make(1.0, maxValue + 1e-7, 1.0);
node.scale = SCNVector3Make(1.0, maxValue, 1.0);
node.position = position;
position = dotNode.position;