Attempting to get 1.91 built on Mac
Posted: Mon Jun 24, 2024 3:50 am
I've been trying to get an up-to-date Mac build working, and I think I'm close, but I keep running into a road block. I can get the code to compile, but no matter what I try, I can't get Oolite to use Open GL 3.3. It is stuck using Open GL 2.1 (according to the log file):
Which means, when I run the app, I get this
For the technically curious, this is what I've changed:
Switch to the Open GL 3 headers in "src/OOOpenGLOnly.h"
Added some missing definitions to "src/Cocoa/MyOpenGLView.h"
Added some extra definitions to NSOpenGLView in "src/Cocoa/MyOpenGLView.h"
Added the missing functions to "src/Cocoa/MyOpenGLView.m"
Added some extra parameters to the NSOpenGLPixelFormatAttribute settings in the "initWithFrame" function in "src/Cocoa/MyOpenGLView.m", and preset the colorSaturation level:
I've also tried using "NSOpenGLProfileVersion3_2Core" (instead of NSOpenGLProfileVersion4_1Core), and moving the two new options in front of the existing "NSOpenGLPFAWindow" option, but the result is the same.
Finally, I've changed the macOS Deployment Target to "macOS 10.7",and I've added some compiler flags to the "Other C flags" in the build settings:
(Edit: nevermind about these compiler flags. They're not related.)
There are some other changes I've made (for example, I've removed all the "Sparkle" package references and code), and there are a bunch of caveats to the environment I'm using. First, I'm using Mac OS 10.12.6 (Sierra), which is seriously out of date and support. Second, I'm doing this in a Hackintosh VM inside VirtualBox.
So that's the sum total of where I'm at. I think the extra options added to NSOpenGLPixelGFormatAttribute are correct, but I don't know why they're not being applied.
Any suggestions anyone can throw my way would be great. And please note that *I am not a Mac developer*. I largely have no idea what I'm doing, and I've been relying of Google to help me get this far. So if a real Xcode dev was to offer input, please make it as idiot-proof as you can. For reference, I'm using Xcode v9.2
Code: Select all
[rendering.opengl.version]: OpenGL renderer version: 2.1.0 ("2.1 APPLE-14.0.16"). Vendor: "Apple Inc.". Renderer: "Apple Software Rendered".
For the technically curious, this is what I've changed:
Switch to the Open GL 3 headers in "src/OOOpenGLOnly.h"
Code: Select all
...
// Apple OpenGL includes...
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl3.h>
#include <OpenGL/glu.h>
#include <OpenGL/gl3ext.h>
Code: Select all
#define MAX_COLOR_SATURATION 2.0f
#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A
#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
#define GL_CLAMP_VERTEX_COLOR 0x891A
#define GL_CLAMP_FRAGMENT_COLOR 0x891B
Code: Select all
@interface MyOpenGLView: NSOpenGLView
{
@private
...
float _colorSaturation;
}
- (float) colorSaturation;
- (void) adjustColorSaturation:(float)colorSaturationAdjustment;
Code: Select all
- (float) colorSaturation
{
return _colorSaturation;
}
- (void) adjustColorSaturation:(float)colorSaturationAdjustment
{
_colorSaturation += colorSaturationAdjustment;
_colorSaturation = OOClamp_0_max_f(_colorSaturation, MAX_COLOR_SATURATION);
}
Code: Select all
NSOpenGLPixelFormatAttribute attrs[]
{
...
NSOpenGLPFAWindow,
NSOpenGLPFAOpenGLProfile, (NSOpenGLPixelFormatAttribute)NSOpenGLProfileVersion4_1Core,
...
}
_colorSaturation = 1.0f;
Finally, I've changed the macOS Deployment Target to "macOS 10.7",
Code: Select all
-DOSG_GL3_AVAILABLE::BOOL=1 -DOSG_GL1_AVAILABLE::BOOL=0 -DOSG_GL2_AVAILABLE::BOOL=0 -DOSG_GLES1_AVAILABLE::BOOL=0 -DOSG_GLES2_AVAILABLE::BOOL=0
There are some other changes I've made (for example, I've removed all the "Sparkle" package references and code), and there are a bunch of caveats to the environment I'm using. First, I'm using Mac OS 10.12.6 (Sierra), which is seriously out of date and support. Second, I'm doing this in a Hackintosh VM inside VirtualBox.
So that's the sum total of where I'm at. I think the extra options added to NSOpenGLPixelGFormatAttribute are correct, but I don't know why they're not being applied.
Any suggestions anyone can throw my way would be great. And please note that *I am not a Mac developer*. I largely have no idea what I'm doing, and I've been relying of Google to help me get this far. So if a real Xcode dev was to offer input, please make it as idiot-proof as you can. For reference, I'm using Xcode v9.2