openscenegraph / OpenSceneGraph

OpenSceneGraph git repository
http://www.openscenegraph.org
Other
3.17k stars 1.4k forks source link

OSG_WINDOWING_SYSTEM=X11 does not prevent use of OpenGL Framework #936

Open RiotNrrrd opened 4 years ago

RiotNrrrd commented 4 years ago

I have OpenSceneGraph built for 64-bit RHEL 7.x (X11) and was asked to build it on macOS Mojave - also as an X11 app. (Our Mac is headless, so building it natively as a Cocoa app is useless to us.)

A primary use we have for OSG is with Inventor files; I had previously built Coin and using COINDIR, CMake finds it and enables the Inventor plug-in. But my Coin installation uses the X11 libGL/libGLU versions, not the OpenGL Framework versions.

I thought I could solve this by setting _OSG_WINDOWINGSYSTEM=X11 in CMakeCache.txt. While that does generate the correct <GL/gl.h> include path, it still generates OpenGL.framework references so when it goes to link shared library ../../lib/libosgViewer.dylib, it gets a bunch of Undefined symbols because it's not looking for /opt/X11/lib/libGL.dylib.

If I hand-edit CMakeCache.txt and replace the framework references (OPENGL_gl_LIBRARY, OPENGL_glu_LIBRARY et al.) with links to the X11 versions, make notices that the file has changed - so it goes and re-does the CMake first before it starts building, which of course wipes out my changes. :-/

I see in src/README.md that X11 support is "no longer actively supported". Am I hosed?

openscenegraph commented 4 years ago

On Thu, 26 Mar 2020 at 10:50, RiotNrrrd notifications@github.com wrote:

I have OpenSceneGraph built for 64-bit RHEL 7.x (X11) and was asked to build it on macOS Mojave - also as an X11 app. (Our Mac is headless, so building it natively as a Cocoa app is useless to us.)

A primary use we have for OSG is with Inventor files; I had previously built Coin and using COINDIR, CMake finds it and enables the Inventor plug-in. But my Coin installation uses the X11 libGL/libGLU versions, not the OpenGL Framework versions.

Why not rebuild Coin to work with OpenGL Framework?

I thought I could solve this by setting OSG_WINDOWING_SYSTEM=X11 in

CMakeCache.txt. While that does generate the correct <GL/gl.h> include path, it still generates OpenGL.framework references so when it goes to link shared library ../../lib/libosgViewer.dylib, it gets a bunch of Undefined symbols because it's not looking for /opt/X11/lib/libGL.dylib.

If I hand-edit CMakeCache.txt and replace the framework references ( OPENGL_gl_LIBRARY, OPENGL_glu_LIBRARY et al.) with links to the X11 versions, make notices that the file has changed - so it goes and re-does the CMake first before it starts building, which of course wipes out my changes. :-/

I see in src/README.md that X11 support is "no longer actively supported". Am I hosed?

I don't know of anyone user X11 under MacOS/OSX since the very earliest days when the initial port to Mac was done, not quite 20 years but it'll be that order of magnitude. All the focus on Mac support has long been Cocoa.

I have no clue whether it might still be possible, but I'm not a Mac user so have to defer to others in the community or the wider web for guidance on how possible it might be to use X11 under Mac these days. The place to make a call out for help with this would be the osg-users googlegroup, the Issue tracker is seen only by a small fraction of the community.

RiotNrrrd commented 4 years ago

Thanks for the quick response. I'll go look up that osg-users Google Group. As for

Why not rebuild Coin to work with OpenGL Framework?

Because our use of it is on a headless Mac mini. We are primarily a Linux shop with an 'experimental' Mac port of our image processing suite. So everything is built for X11.

openscenegraph commented 4 years ago

On Thu, 26 Mar 2020 at 11:16, RiotNrrrd notifications@github.com wrote:

Thanks for the quick response. I'll go look up that osg-users Google Group. As for

Why not rebuild Coin to work with OpenGL Framework?

Because our use of it is on a headless Mac mini. We are primarily a Linux shop with an 'experimental' Mac port of our image processing suite. So everything is built for X11.

Could you not install linux on the Mac mini ;-)

Another route would be to convert all your inventor files to a modern alternative, or or just native OSG. Or write a Inventor reader that isn't dependent on Coin. All more work but might release you from an orphaned project that is constraining things.

RiotNrrrd commented 4 years ago

Could you not install linux on the Mac mini ;-)

Haha :-)

Another route would be to convert all your Inventor files to a modern alternative, or or just native OSG. Or write a Inventor reader that isn't dependent on Coin. All more work but might release you from an orphaned project that is constraining things.

Unfortunately I'm not the developer so I can't speak for him. I will tell him (after I wake up) what the situation is, i.e. that OpenSceneGraph on the Mac is really meant for local, Cocoa/OpenGL-based display.

Thanks!