### OSX Support

Moderator: andrewmac

#### OSX Support

andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm

I've been working on OSX support over the holidays. It's almost ready. Just a few more things to fix up. For now this is just OpenGL. I've tested bgfx samples with Metal but I haven't got Metal working in Torque 6 yet. That will most likely be next after fixing SkyLight.

Early screenshots:

#### Re: OSX Support

lowlevelsoul
Posts: 23
Joined: Mon Mar 30, 2015 10:02 pm
Awesome stuff! I was just lamenting the slightly broken Mac build own the scene partition thread.

#### Re: OSX Support

andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm

@ lowlevelsoul : This is a sort of pet project of mine. I have a macbook but use windows on desktop for primary development so anytime I'm being lazy and watching TV on the sofa, etc I'll work on OSX support. Lately I'm having issues with order of operations. Basically I'm trying to initialize the graphics on a window that's not fully open (I'm assuming) and it results in a GL invalid framebuffer operation but I'm not sure why it's not "ready". I'm relatively new to Cocoa and Objective-C and all that so my development in these areas can be a bit slow

#### Re: OSX Support

lowlevelsoul
Posts: 23
Joined: Mon Mar 30, 2015 10:02 pm
I wouldn't be much use here - I tend to use SDL when writing mac gfx stuff. Dealing with Cocoa windowing can be a pain.

But It's odd, because I had a similar issue with Android - I had to wait until the window was "ready"which wasn't the same as it having been created. This was a bit easier than on OSX, because the window creation happened on a different thread and so I just waited for the message to be processed.

The thing about SDL is that it won't return from the window creation function, until the window is ready and so you end up creating the gl context outside of the message loop. I can have a look at it (when I have time) and see if anythings amiss - but I may be as much in the dark as you are.

#### Re: OSX Support

LukasPJ
Posts: 426
Joined: Tue Feb 03, 2015 7:25 pm

dglMac_Binding.h -> there are no dglSetFSAASamples defined anywhere.

osxCocoaUtilities.mm ->
#import "fileDialog.h"
should be:
#import "platform/nativeDialogs/fileDialog.h"
Also, I get this message:

#### Re: OSX Support

andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm

there is nothing in dglMac_binding.h that's still being used. You can kill it, I thought I already did.

Regarding the metal problem, it should be detecting that your system doesn't support metal. Maybe try forcing this to 0 to disable metal support:
https://github.com/andr3wmac/Torque6/bl ... .h#L46-L51

I'll try to take another look at OSX support soon.

#### Re: OSX Support

LukasPJ
Posts: 426
Joined: Tue Feb 03, 2015 7:25 pm

there is nothing in dglMac_binding.h that's still being used. You can kill it, I thought I already did.

Regarding the metal problem, it should be detecting that your system doesn't support metal. Maybe try forcing this to 0 to disable metal support:
https://github.com/andr3wmac/Torque6/bl ... .h#L46-L51

I'll try to take another look at OSX support soon.
Should totally mention, I'm running Yosemite on a Macbook Pro from Mid 2015. I'll have a go at disabling Metal support tomorrow or the day after

#### Re: OSX Support

LukasPJ
Posts: 426
Joined: Tue Feb 03, 2015 7:25 pm

Alright, so just tried it again with that config setting you said. This is the full output:
DKR1707:build dklukjor\$ make debug64
./genie_mac gmake
Building configurations...
Running action 'gmake'...
Generating ../gmake/Makefile...
Generating ../gmake/Torque6App.make...
Generating ../gmake/Torque6.make...
Generating ../gmake/lib/assimp.make...
Generating ../gmake/lib/bgfx.make...
Generating ../gmake/lib/bullet.make...
Generating ../gmake/lib/ljpeg.make...
Generating ../gmake/lib/lpng.make...
Generating ../gmake/lib/zlib.make...
Generating ../gmake/plugins/Sky.make...
Generating ../gmake/plugins/Terrain.make...
Generating ../gmake/plugins/Particles.make...
Generating ../gmake/plugins/CSG.make...
Done.
/Library/Developer/CommandLineTools/usr/bin/make -R -C ./gmake config=debug64
==== Building assimp (debug64) ====
Archiving assimp
==== Building bgfx (debug64) ====
Archiving bgfx
==== Building bullet (debug64) ====
Archiving bullet
==== Building ljpeg (debug64) ====
Archiving ljpeg
==== Building lpng (debug64) ====
Archiving lpng
==== Building zlib (debug64) ====
Archiving zlib
==== Building Torque6 (debug64) ====
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../bin/libTorque6_DEBUG.dylib] Error 1
make[1]: *** [Torque6] Error 2
make: *** [debug64] Error 2
From what I gathered, it's because of this build configuration: "-framework Metal" on Torque6 and bgfx, but removing it from the lua scripts results in a lot of undefined symbols, so that is not the way to go

Edit: some of the undefined symbols:

Code: Select all

==== Building Torque6 (debug64) ==== Linking Torque6 Undefined symbols for architecture x86_64: "nsglGetProcAddress(unsigned char const*)", referenced from: rmtglGetProcAddress(OpenGL*, char const*) in libbgfx.a(bgfx.o) "bgfx::gl::glCullFace", referenced from: bgfx::gl::RendererContextGL::submit(bgfx::Frame*, bgfx::ClearQuad&, bgfx::TextVideoMemBlitter&) in libbgfx.a(renderer_gl.o) "bgfx::gl::glDisablei", referenced from: bgfx::gl::RendererContextGL::submit(bgfx::Frame*, bgfx::ClearQuad&, bgfx::TextVideoMemBlitter&) in libbgfx.a(renderer_gl.o) "bgfx::gl::glEndQuery", referenced from: bgfx::gl::OcclusionQueryGL::end() in libbgfx.a(renderer_gl.o) bgfx::gl::RendererContextGL::init() in libbgfx.a(renderer_gl.o) bgfx::gl::TimerQueryGL::end() in libbgfx.a(renderer_gl.o) "bgfx::gl::glGetError", referenced from: bgfx::gl::glGet(unsigned int) in libbgfx.a(renderer_gl.o) bgfx::gl::ProgramGL::create(bgfx::gl::ShaderGL const&, bgfx::gl::ShaderGL const&) in libbgfx.a(renderer_gl.o) bgfx::gl::ProgramGL::init() in libbgfx.a(renderer_gl.o) bgfx::gl::ProgramGL::destroy() in libbgfx.a(renderer_gl.o) bgfx::gl::ProgramGL::bindAttributes(bgfx::VertexDecl const&, unsigned int) const in libbgfx.a(renderer_gl.o) bgfx::gl::ProgramGL::bindInstanceData(unsigned int, unsigned int) const in libbgfx.a(renderer_gl.o) bgfx::gl::IndexBufferGL::destroy() in libbgfx.a(renderer_gl.o)

#### Re: OSX Support

andrewmac
Posts: 295
Joined: Tue Feb 03, 2015 9:45 pm

I'll try to find some time to look at OSX again soon, though the issue you're seeing doesn't ring any bells. The majority of the issues I had with OSX are invalid framebuffer operations during initial launch of the application. A good place to start would be to just clone bgfx and try to run the samples on your macbook. If that succeeds and Torque 6 still fails then I must have something messed up in the build scripts.

LukasPJ