john-chapman / im3d

Immediate mode rendering and 3d gizmos.
MIT License
1.21k stars 63 forks source link

OSX support #61

Closed mickeyordog closed 1 year ago

mickeyordog commented 1 year ago

Hey, I was wondering if you were considering adding MacOS support to the example? I need a library that supports both Mac and Windows but I don't think I currently have the skill to implement it myself

john-chapman commented 1 year ago

I don't currently have any plans to add MacOS versions of the examples. Im3d itself is platform-independent C++, so integration with your application should be basically the same between Windows/Mac. The only major difference will be the shaders - presumably you'll need to port them to Metal?

mickeyordog commented 1 year ago

Thanks for the response. I'm actually using OpenGL3 on Mac, since it still works fine for now even though it's been deprecated. I'll take another look at trying to get this integrated, just having a bit of trouble with it since I'm still a beginner. If I understand right, if I want to start integrating this library into my project based off your example, out of all the files I pretty much only need to write my own implementation for the stuff at the top of im3d_example.cpp right? Since it has the #if defined(IM3D_PLATFORM_WIN) meaning it's Windows specific. And all the code in that part is really doing is initializing OpenGL, creating a window, and handling input as far as I can tell, so those are the things I need to do with SDL in my own project. Let me know if what I gathered is reasonable, thanks!

john-chapman commented 1 year ago

out of all the files I pretty much only need to write my own implementation for the stuff at the top of im3d_example.cpp right?

That's right - nothing in the examples/ folder is actually required to integrate Im3d. If you're using SDL you should be able to ignore im3d_example.cpp, the code in there is just a framework for the examples and nothing to do with the library itself.

Take a look at im3d_opengl33.cpp. This shows you exactly what you need to do to during init and at the start/end of every frame your application draws. There are lots of comments explaining how the integration works in there.

mickeyordog commented 1 year ago

Thanks for the help! I'll get started on that