Deprecated OpenGL

After the WWDC Announcement of deprecating OpenGL, I was a little bit upset.
The OpenGL implementation on Apple was always behind the mainstream, but it was useable. Now with the move to Metal, I had to rethink.
I found a a solution, at least for me… :wink: Vulkan from Khronos. There is a Wrapper SDK to Metal called MoltenVK. It can be downloaded at the Khronos WebPage.
And the really nice part. It is a Framework you can simply use in Elements. FxGen is the Keyword here.
What I have done for now is only import the Framework in Fire.
In the MoltenVK, is a example of a terminal app to show all Information about the device.
With the help of oxidizer it was a 10 min thing to compile it with oxygene on Cocoa.
And now the true reason for these post:

Thanks to all people on Remobjects to bring up these kind of tools. Thank you, it is amazing what you have done.

I will port the OpenGl Examples from Element to Vulkan (also the basic Examples from Khronos), (Cocoa, and Island Win and Linux), in the next weeks (I hope no more than 2).
I think it can be a nice thing for doing crossplatform with Elements.
And again, thanks for the tools.
And be fair English is not my native language.

that is really cool! can you share that project so we could make it into a sample? Also, glad to hear that FxGen worked seamlessly!

Out of curiosity: have you considered using Metal directly? or is that too low an API for what you need? (I hav no experience with it, but I’m curious how well It’d work from Elements, especially for more esoteric stuff thats not just “build cocoa code that talks to an API”, such as shaders and other stuff.

Much appreciated, thank you! this is the kind of messages that make it all worthwhile!

—marc

Yes I will make samples and send a pull request.

Out of curiosity: have you considered using Metal directly? or is that too low an API for what you need? (I hav no experience with it, but I’m curious how well It’d work from Elements, especially for more esoteric stuff thats not just “build cocoa code that talks to an API”, such as shaders and other stuff.

Metal and Vulkan are very similar, the MoltenVK is a small wrapper from Vulkan to Metal. I will use the wrapper because the cross platform possibilities. It is a little bit slower on Mac, but these way I don’t have to support different tools on the platforms.
With these way I can support Cocoa on Mac / Ios and Windows / Linux.

What I can do, is to prepare some samples for using Metal direct. Doing now 3d work with OpenGL and Co now for more than 20 years it should not be a big work (beside the learning Curve on Elements).

1 Like

Ok the Examples from Apple (first Steps)
13%202
Bildschirmaufnahme 2018-06-11 um 12.26.13.mov.zip (4.3 MB)

i will create a Pullrequest for Elements Samples now

Hello Marc,
I have now finished (I hope) the first steps for using Metal with Oxygene.
There is a Pullrequest for the Examples from me.
But, (there is always a but…) can you look if there is a way to compile *.metal files during Build a Project (like Xcode)? At moment the shaders are compiled at runtime, it would be better to compile these at Build-Time. So I think we need a option for resources in Fire like compileShader.
Not a big deal for now, I can setup a corresponding Xcode Project, but would be nice.

I was gonna ask if we need a phase for that. will do. Do you have an Xcode sa mple project handy that I can use to look at what the build does?

BTW, I did fix that .metal files now show as text, using C++ highlighting. I think .metal has some extra keywords but I could not find a full list — do you have one?

If you download the
example from https://developer.apple.com/documentation/metal/hello_triangle
there should be all in for a Build.
if you add the .metal extension for showing as text (C++) can you do it also for .vs and .fs? These are used for OpenGL Shaders. It will make the transition easier when porting OpenglApps.

Keywords I actual know out of brain are
fragment
vertex
used in front of a method
like here

// Fragment function
fragment float4 fragmentShader(RasterizerData in [[stage_in]])
{
    // We return the color we just set which will be written to our color attachment.
    return in.color;
}  

The Brakets [] are Attributes in .metal

But I will look at others and come back to you.

Done.

Yeah, those two I gathered; I was hoping to find a full list before i split this off from C++ and give it a separate syntax definition…

yeah, I won’t go as far as actually adjusting/doing a full parser. This uses the regular C/Objecttve-C highlighting parser, just with it’s own list of keywords.

cool, thanx!

thanx, will have a look (but probably not this week)

1 Like

Thanks, logged as bugs://80371

I found a document that might be useful to you:

yeah. that’s the only link i found myself, and it does t have a list :frowning:

Not easy to find something,
But found something for Notepad++.
After a short Test it looks good.
It is a xml so I think you will find all insideNotepadPP_Shaders.xml (9.2 KB)

thanx!

Done.

1 Like

Wow, thanks
It is realy amazing to work with you and your team

1 Like

Working on EBuild integration now, but oddly:

            -> Task ProcessMetalShaders started for MetalExample.
D:             /usr/bin/xcrun metal -arch air64 -emit-llvm -c -gline-tables-only -isysroot /Users/mh/Applications/Xcode-10Beta1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -ffast-math -o "/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.air" -mmacosx-version-min=10.14 -MMD -MT dependencies -MF /Users/mh/Downloads/MetalExample/Shader/AAPLShaders.metal
E:             metal: no input files

Works if I drop -MF:

            -> Task ProcessMetalShaders started for MetalExample.
D:             /usr/bin/xcrun metal /Users/mh/Downloads/MetalExample/Shader/AAPLShaders.metal -arch air64 -emit-llvm -c -gline-tables-only -isysroot /Users/mh/Applications/Xcode-10Beta1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -ffast-math -o "/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.air" -mmacosx-version-min=10.14 -MMD -MT dependencies
D:             /usr/bin/xcrun metallib -o "/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.metallib" "/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.air"
D:             Adding AppResource '/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.air'
D:             Adding AppResource '/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.d'
D:             Adding AppResource '/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/MetalExample-0E221F0806BEFE729039A5A4E31CC16584B12C06/Debug/Toffee-macOS/MetalShaders/AAPLShaders/AAPLShaders.metallib'
            <- Task ProcessMetalShaders finished for MetalExample, took 19.9115s (19.9165s).

Next strip is to to out what to do with each of those files, I assume not all three shoukld just get packaged as app resource…

I can send you a new build (just compiler, not Fire) in 30 or so, to test. Adjust your project manually so the build action for the .metal file is <MetalShader Include="..."> instead of <AppResource Include="..."> (ofc next Fire will let you pick that in the UI, too)

Wow, thanks. Will check it. Tomorrow (my time) in the morning. Out of office now on my ipad
Thanks a lot

1 Like

up now.

Thanks,
i see only a “RemObjects Elements - 10.0.0.2294.exe” in my personal Downloads?