Mac OpenGL basic compile problem

I am new and trying to compile on the Mac.

I finally got passed the initial compile errors with the sdk, and now I am getting OpenGL shader compile errors that will complain about the OpenGL version no matter what version I type in.

This is on a 2018 MacBook pro with an intel chipset that should support OpenGL 4.2, but even when I set the version to “100” in the shader, it will throw a shader compile error.

Hi, you need to set the open GL renderer version in the main file as well as in the shader.
take a look at the shader examples and look at the main.cpp file. There is where you set the version. These examples support opengl 2 and >3

Well, I think it is a mess on Mac.

I am trying to run the SMAA/fxaa anti-alias example, but in the main.cpp it fails at the first line:


I had to remove this line to get it to run, but in the debug console, it says that the shaders failed to compile because of the version number.

I tried adding the following to main.cpp:

ofGLWindowSettings settings;

But it did not help.

I looked at the other examples and they are using that same ofGLProgrammableRenderer. This tells me perhaps the examples are old and wrong.

I got passed the compile error with:

        ofGLWindowSettings settings;
        settings.glVersionMajor = 4;
        settings.glVersionMinor = 1;

        settings.width = 1024;
        settings.height = 768;
        settings.windowMode = OF_WINDOW;

However, it is still bad, the screen turns blue, it flickers, and it doesn’t appear to be applying the AA as expected - it looks wrong.

can you point me to the example you are trying to run please?

The blue and flickering could be that the shader itself that is not written for the mac, I don’t know, I always work in Metal, so the glsl and hlsl shader stuff I am not as familiar with - but since the OFX in general is a broken project on the Mac, my first assumption is that it could be an issue with OFX.

Do you use OFX on the Mac a lot? I really am just trying to compare the results of SMAA vs FXAA vs my other few anti-aliasing scripts. But I’ve been battling OFX for hours just trying to get the examples to run.

  • But maybe it is just because the shader is .hlsl which is a windows format?

where do you get this idea from? by OFX do you mean the addon or openFrameworks in general? if the former, it might be, although the latter it is not broken at all on Mac.

I’ll take a look to that addon and let you know.

right, hlsl is a windows format .

By broken, I merely mean, that if I take a new Mac off the shelf and try to download and compile OFX, it will fail to compile. -My thinking was merely that a project that is not well maintained for the Mac, is likely to have numerous other problems on the Mac, and so when I ran into the blue and flicker/blank screen problem, I merely assume that it is either a problem in OFX or the shader.

one thing to note is that this is a project is almost 5 years old (and written for OF 0.8.0), so you might be suffering from some incompatibilities. Please take a look at the gl folder in examples for projects that are up to date, which may be helpful as a reference, etc.

Interesting, I’ve always found OF to be super easy to set up on with fresh Mac’s, much more so than any other platform. Maybe you’re not using the Project Generator to update projects and/or missing some steps in the setup process?

So do you think it’s possible that it may work in OF 0.8? Or do you think it more likely that the hlsl shader format is the issue?

…ah I am starting to see it now, I downloaded a forked copy of OFX… I am leaning heavily on the cause being the hlsl windows format.

I got it working, i’ve attached the project. You’ll need to regenerate the xcode project using project generator. Just drag and drop the folder into project generator and press generate. (855.7 KB)

is it running on Mac or are you on a PC?

Getting OF to run on Mac is super easy and straight forwards. It is by far the easiest platform to work with.
I already posted a working version of the example you tried to run. Mostly, the problem was that the project needed to be updated with the project generator. There were some other minor things to change too, although all related to being some old code.
The hlsl thing is not an issue. all the shaders are in glsl.

last but not least, when speaking about openFrameworks we use OF while when speaking about an addon or addons in general we use OFX. I mention this as it is still not clear to me what you mean by OFX.

Can you resend it as an Xcode project?

no, thats the whole point of the project generator.
it will create the xcode project for you just with the files I sent,

Also, did you try pressing F2? For SMAA? The smaa uses the hlsl shader, and this is really what I want to see: the smaa

I changed the keeys to be 1, 2 and 3 instead of the F keys