OpenGL with Metal

Is it possible to mix OpenGL and Metal ?

I would try to use Metal as an OpenCL replacement for compute kernels and keep my OpenGL renderer in place as a first approach.

Does it make sense ?

Accepted Reply

Well, you can use both, but with cost of transferring data between Metal buffer and Opengl buffers, because they are not aware of each other. So in case you are using results of repeatedly invoked Metal Kernels(not just single precomputations) in OpenGL realtime rendering, I guess you will lose too much performance on that data synchronization.

Replies

Why wouldn't you just use it for everything?

I'll do it... but I don't have enough time for both today.

OpenCL is a painfull experience with big kernels on Yosemite, and I really hope that Metal performs better...

So, my first attempt will be to replace my OpenCL code, and to let the things that work in place.

Well, you can use both, but with cost of transferring data between Metal buffer and Opengl buffers, because they are not aware of each other. So in case you are using results of repeatedly invoked Metal Kernels(not just single precomputations) in OpenGL realtime rendering, I guess you will lose too much performance on that data synchronization.

You're right... With one exception concerning textures and images : you can use IOSurface to synchronize data.